Fix some facades playing the wrong sound on place

This commit is contained in:
tterrag committed 2015-11-19 08:12:47 -05:00
1 parent a7c88fff59
commit becde23fe8
3 files changed
+14 -3

No files matched your search

@@ -731,7 +731,7 @@ public class BlockConduitBundle extends BlockEio implements IGuiHandler, IFacade
bundle.setFacadeMetadata(facadeMeta);
bundle.setFacadeType(FacadeType.values()[facadeType]);
if (!world.isRemote) {
ConduitUtil.playStepSound(facadeID.stepSound, world, x, y, z);
ConduitUtil.playPlaceSound(facadeID.stepSound, world, x, y, z);
}
if (!player.capabilities.isCreativeMode) {
stack.stackSize--;
@@ -402,4 +402,16 @@ public class ConduitUtil {
private static void playClientStepSound(SoundType snd) {
FMLClientHandler.instance().getClientPlayerEntity().playSound(snd.getStepResourcePath(), (snd.getVolume() + 1.0F) / 8.0F, snd.getPitch());
}
public static void playPlaceSound(SoundType snd, World world, int x, int y, int z) {
if (!world.isRemote) {
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, snd.func_150496_b(), (snd.getVolume() + 1.0F) / 2.0F, snd.getPitch() * 0.8F);
} else {
playClientPlaceSound(snd);
}
}
private static void playClientPlaceSound(SoundType snd) {
FMLClientHandler.instance().getClientPlayerEntity().playSound(snd.func_150496_b(), (snd.getVolume() + 1.0F) / 8.0F, snd.getPitch());
}
}
@@ -3,7 +3,6 @@ package crazypants.enderio.conduit.facade;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
@@ -131,7 +130,7 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
bundle.setFacadeId(facadeID);
bundle.setFacadeMetadata(facadeMeta);
bundle.setFacadeType(FacadeType.values()[itemStack.getItemDamage()]);
ConduitUtil.playStepSound(facadeID.stepSound, world, x, y, z);
ConduitUtil.playPlaceSound(facadeID.stepSound, world, x, y, z);
if (!player.capabilities.isCreativeMode) {
itemStack.stackSize--;
}