Fix sounds
This commit is contained in:
parent
9c6e9aef64
commit
caaa5a3e7f
6 changed files with 36 additions and 26 deletions
|
@ -16,11 +16,13 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.SoundCategory;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import reborncore.RebornCore;
|
import reborncore.RebornCore;
|
||||||
import techreborn.client.TechRebornCreativeTabMisc;
|
import techreborn.client.TechRebornCreativeTabMisc;
|
||||||
|
import techreborn.init.ModSounds;
|
||||||
import techreborn.items.ItemParts;
|
import techreborn.items.ItemParts;
|
||||||
import techreborn.items.tools.ItemTreeTap;
|
import techreborn.items.tools.ItemTreeTap;
|
||||||
|
|
||||||
|
@ -173,9 +175,9 @@ public class BlockRubberLog extends Block implements ITexturedBlock
|
||||||
{
|
{
|
||||||
worldIn.setBlockState(pos,
|
worldIn.setBlockState(pos,
|
||||||
state.withProperty(HAS_SAP, false).withProperty(SAP_SIDE, EnumFacing.getHorizontal(0)));
|
state.withProperty(HAS_SAP, false).withProperty(SAP_SIDE, EnumFacing.getHorizontal(0)));
|
||||||
// TODO 1.9 sounds
|
worldIn.playSound(null, pos.getX(), pos.getY(),
|
||||||
// worldIn.playSoundAtEntity(playerIn,
|
pos.getZ(), ModSounds.extract,
|
||||||
// "techreborn:sap_extract", 0.8F, 1F);
|
SoundCategory.BLOCKS, 0.6F, 1F);
|
||||||
if (!worldIn.isRemote)
|
if (!worldIn.isRemote)
|
||||||
{
|
{
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
|
|
|
@ -2,6 +2,7 @@ package techreborn.init;
|
||||||
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.SoundEvent;
|
import net.minecraft.util.SoundEvent;
|
||||||
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Mark on 20/03/2016.
|
* Created by Mark on 20/03/2016.
|
||||||
|
@ -10,16 +11,20 @@ public class ModSounds
|
||||||
{
|
{
|
||||||
|
|
||||||
public static SoundEvent shock;
|
public static SoundEvent shock;
|
||||||
|
public static SoundEvent dismantle;
|
||||||
|
public static SoundEvent extract;
|
||||||
|
|
||||||
public static void init()
|
public static void init()
|
||||||
{
|
{
|
||||||
shock = getSound("cable_shock");
|
shock = getSound("cable_shock");
|
||||||
|
dismantle = getSound("block_dismantle");
|
||||||
|
extract = getSound("sap_extract");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SoundEvent getSound(String str)
|
private static SoundEvent getSound(String str)
|
||||||
{
|
{
|
||||||
SoundEvent soundEvent = SoundEvent.REGISTRY.getObject(new ResourceLocation("techreborn" + str));
|
ResourceLocation resourceLocation = new ResourceLocation("techreborn" , str);
|
||||||
return soundEvent;
|
return GameRegistry.register(new SoundEvent(resourceLocation).setRegistryName(resourceLocation));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,15 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumActionResult;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.SoundCategory;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import techreborn.init.ModSounds;
|
||||||
import techreborn.items.ItemTR;
|
import techreborn.items.ItemTR;
|
||||||
import techreborn.lib.ModInfo;
|
import techreborn.lib.ModInfo;
|
||||||
|
|
||||||
|
@ -20,14 +27,13 @@ public class ItemHammer extends ItemTR implements ITexturedItem
|
||||||
setMaxDamage(MaxDamage);
|
setMaxDamage(MaxDamage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
@Override
|
||||||
// public boolean onItemUse(ItemStack stack, EntityPlayer player, World
|
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||||
// world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
|
world.playSound(player, player.posX, player.posY,
|
||||||
// {
|
player.posZ, ModSounds.dismantle,
|
||||||
// world.playSoundAtEntity(player, "techreborn:block_dismantle", 0.8F,
|
SoundCategory.BLOCKS, 0.6F, 1F);
|
||||||
// 0.4F);
|
return EnumActionResult.SUCCESS;
|
||||||
// return true;
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item setUnlocalizedName(String par1Str)
|
public Item setUnlocalizedName(String par1Str)
|
||||||
|
|
|
@ -16,6 +16,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumActionResult;
|
import net.minecraft.util.EnumActionResult;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.SoundCategory;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
@ -24,6 +25,7 @@ import reborncore.common.tile.TileMachineBase;
|
||||||
import techreborn.blocks.fluid.BlockFluidBase;
|
import techreborn.blocks.fluid.BlockFluidBase;
|
||||||
import techreborn.blocks.storage.BlockBatBox;
|
import techreborn.blocks.storage.BlockBatBox;
|
||||||
import techreborn.client.TechRebornCreativeTabMisc;
|
import techreborn.client.TechRebornCreativeTabMisc;
|
||||||
|
import techreborn.init.ModSounds;
|
||||||
import techreborn.items.ItemTR;
|
import techreborn.items.ItemTR;
|
||||||
import techreborn.lib.ModInfo;
|
import techreborn.lib.ModInfo;
|
||||||
import techreborn.tiles.storage.TileEnergyStorage;
|
import techreborn.tiles.storage.TileEnergyStorage;
|
||||||
|
@ -152,10 +154,9 @@ public class ItemWrench extends ItemTR implements ITexturedItem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
world.playSound(null, player.posX, player.posY,
|
||||||
// TODO 1.9 sounds
|
player.posZ, ModSounds.dismantle,
|
||||||
// world.playSoundAtEntity(player, "techreborn:block_dismantle",
|
SoundCategory.BLOCKS, 0.6F, 1F);
|
||||||
// 0.8F, 1F);
|
|
||||||
if (!world.isRemote)
|
if (!world.isRemote)
|
||||||
{
|
{
|
||||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
||||||
|
|
|
@ -30,6 +30,7 @@ import reborncore.common.misc.Functions;
|
||||||
import reborncore.common.misc.vecmath.Vecs3dCube;
|
import reborncore.common.misc.vecmath.Vecs3dCube;
|
||||||
import reborncore.common.util.WorldUtils;
|
import reborncore.common.util.WorldUtils;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
|
import techreborn.init.ModSounds;
|
||||||
import techreborn.parts.walia.IPartWaliaProvider;
|
import techreborn.parts.walia.IPartWaliaProvider;
|
||||||
import techreborn.power.TRPowerNet;
|
import techreborn.power.TRPowerNet;
|
||||||
import techreborn.utils.damageSources.ElectrialShockSource;
|
import techreborn.utils.damageSources.ElectrialShockSource;
|
||||||
|
@ -305,9 +306,6 @@ public abstract class CableMultipart extends Multipart
|
||||||
@Override
|
@Override
|
||||||
public void onEntityCollided(Entity entity) {
|
public void onEntityCollided(Entity entity) {
|
||||||
if (getCableType().canKill && entity instanceof EntityLivingBase) {
|
if (getCableType().canKill && entity instanceof EntityLivingBase) {
|
||||||
if (entity instanceof EntityPlayer && ((EntityPlayer) entity).capabilities.isCreativeMode) {
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if (network != null) {
|
if (network != null) {
|
||||||
if (network.getEnergy() != 0) {
|
if (network.getEnergy() != 0) {
|
||||||
if (ConfigTechReborn.UninsulatedElectocutionDamage) {
|
if (ConfigTechReborn.UninsulatedElectocutionDamage) {
|
||||||
|
@ -318,9 +316,9 @@ public abstract class CableMultipart extends Multipart
|
||||||
entity.attackEntityFrom(new ElectrialShockSource(), 1F);
|
entity.attackEntityFrom(new ElectrialShockSource(), 1F);
|
||||||
}
|
}
|
||||||
if (ConfigTechReborn.UninsulatedElectocutionSound) {
|
if (ConfigTechReborn.UninsulatedElectocutionSound) {
|
||||||
// getWorld().playSound(entity.posX, entity.posY,
|
getWorld().playSound(null, entity.posX, entity.posY,
|
||||||
// entity.posZ, ModSounds.shock,
|
entity.posZ, ModSounds.shock,
|
||||||
// SoundCategory.BLOCKS, 0.6F, 1F, false);
|
SoundCategory.BLOCKS, 0.6F, 1F);
|
||||||
}
|
}
|
||||||
if (ConfigTechReborn.UninsulatedElectocutionParticle) {
|
if (ConfigTechReborn.UninsulatedElectocutionParticle) {
|
||||||
getWorld().spawnParticle(EnumParticleTypes.CRIT, entity.posX, entity.posY, entity.posZ, 0,
|
getWorld().spawnParticle(EnumParticleTypes.CRIT, entity.posX, entity.posY, entity.posZ, 0,
|
||||||
|
@ -328,7 +326,6 @@ public abstract class CableMultipart extends Multipart
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import techreborn.client.hud.ChargeHud;
|
||||||
import techreborn.client.keybindings.KeyBindings;
|
import techreborn.client.keybindings.KeyBindings;
|
||||||
import techreborn.client.render.entitys.RenderNukePrimed;
|
import techreborn.client.render.entitys.RenderNukePrimed;
|
||||||
import techreborn.entitys.EntityNukePrimed;
|
import techreborn.entitys.EntityNukePrimed;
|
||||||
|
import techreborn.init.ModSounds;
|
||||||
import techreborn.manual.loader.ManualLoader;
|
import techreborn.manual.loader.ManualLoader;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -77,8 +78,6 @@ public class ClientProxy extends CommonProxy
|
||||||
// TODO FIX ME
|
// TODO FIX ME
|
||||||
ClientRegistry.registerKeyBinding(KeyBindings.config);
|
ClientRegistry.registerKeyBinding(KeyBindings.config);
|
||||||
ClientMultiBlocks.init();
|
ClientMultiBlocks.init();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void registerItemModel(ItemStack item, String name) {
|
protected void registerItemModel(ItemStack item, String name) {
|
||||||
|
|
Loading…
Reference in a new issue