Fix sounds

This commit is contained in:
modmuss50 2016-05-08 11:42:59 +01:00
parent 9c6e9aef64
commit caaa5a3e7f
6 changed files with 36 additions and 26 deletions

View file

@ -5,8 +5,15 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
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.SideOnly;
import techreborn.init.ModSounds;
import techreborn.items.ItemTR;
import techreborn.lib.ModInfo;
@ -20,14 +27,13 @@ public class ItemHammer extends ItemTR implements ITexturedItem
setMaxDamage(MaxDamage);
}
// @Override
// public boolean onItemUse(ItemStack stack, EntityPlayer player, World
// world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
// {
// world.playSoundAtEntity(player, "techreborn:block_dismantle", 0.8F,
// 0.4F);
// return true;
// }
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
world.playSound(player, player.posX, player.posY,
player.posZ, ModSounds.dismantle,
SoundCategory.BLOCKS, 0.6F, 1F);
return EnumActionResult.SUCCESS;
}
@Override
public Item setUnlocalizedName(String par1Str)

View file

@ -16,6 +16,7 @@ import net.minecraft.tileentity.TileEntity;
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;
@ -24,6 +25,7 @@ import reborncore.common.tile.TileMachineBase;
import techreborn.blocks.fluid.BlockFluidBase;
import techreborn.blocks.storage.BlockBatBox;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.init.ModSounds;
import techreborn.items.ItemTR;
import techreborn.lib.ModInfo;
import techreborn.tiles.storage.TileEnergyStorage;
@ -152,10 +154,9 @@ public class ItemWrench extends ItemTR implements ITexturedItem
}
}
}
// TODO 1.9 sounds
// world.playSoundAtEntity(player, "techreborn:block_dismantle",
// 0.8F, 1F);
world.playSound(null, player.posX, player.posY,
player.posZ, ModSounds.dismantle,
SoundCategory.BLOCKS, 0.6F, 1F);
if (!world.isRemote)
{
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);