Fix some conduit/facade sound bugs

This commit is contained in:
tterrag1098 committed 2015-07-14 20:12:04 -04:00
1 parent 13e28e4322
commit a4a6016181
4 files changed
+15 -10

No files matched your search

@@ -22,6 +22,8 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.client.event.sound.PlaySoundSourceEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
@@ -388,7 +390,7 @@ public class BlockConduitBundle extends BlockEio implements IGuiHandler, IFacade
@Override
@SideOnly(Side.CLIENT)
public boolean canRenderInPass(int pass) {
RenderUtil.theRenderPass = pass;
ForgeHooksClient.setRenderPass(pass);
return pass == 0 || pass == 1;
}
@@ -652,8 +654,8 @@ public class BlockConduitBundle extends BlockEio implements IGuiHandler, IFacade
if(!bundle.hasType(equipped.getBaseConduitType())) {
if(!world.isRemote) {
bundle.addConduit(equipped.createConduit(stack, player));
ConduitUtil.playBreakSound(soundTypeMetal, world, x, y, z);
if(!player.capabilities.isCreativeMode) {
ConduitUtil.playBreakSound(soundTypeMetal, world, x, y, z);
player.getCurrentEquippedItem().stackSize--;
}
}
@@ -679,7 +681,9 @@ public class BlockConduitBundle extends BlockEio implements IGuiHandler, IFacade
bundle.setFacadeId(facadeID);
bundle.setFacadeMetadata(facadeMeta);
bundle.setFacadeType(FacadeType.values()[player.getCurrentEquippedItem().getItemDamage()]);
ConduitUtil.playBreakSound(facadeID.stepSound, world, x, y, z);
if (!world.isRemote) {
ConduitUtil.playStepSound(facadeID.stepSound, world, x, y, z);
}
if (!player.capabilities.isCreativeMode) {
stack.stackSize--;
}
@@ -424,14 +424,14 @@ public class ConduitUtil {
public static void playBreakSound(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);
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, snd.getBreakSound(), (snd.getVolume() + 1.0F) / 2.0F, snd.getPitch() * 0.8F);
} else {
playClientBreakSound(snd);
}
}
private static void playClientBreakSound(SoundType snd) {
FMLClientHandler.instance().getClientPlayerEntity().playSound(snd.func_150496_b(), (snd.getVolume() + 1.0F) / 2.0F, snd.getPitch() * 0.8F);
FMLClientHandler.instance().getClientPlayerEntity().playSound(snd.getBreakSound(), (snd.getVolume() + 1.0F) / 2.0F, snd.getPitch() * 0.8F);
}
public static void playHitSound(SoundType snd, World world, int x, int y, int z) {
@@ -130,7 +130,7 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
bundle.setFacadeId(facadeID);
bundle.setFacadeMetadata(facadeMeta);
bundle.setFacadeType(FacadeType.values()[itemStack.getItemDamage()]);
ConduitUtil.playBreakSound(facadeID.stepSound, world, x, y, z);
ConduitUtil.playStepSound(facadeID.stepSound, world, x, y, z);
if (!player.capabilities.isCreativeMode) {
itemStack.stackSize--;
}
@@ -17,6 +17,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
@@ -111,7 +112,7 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
//enable the alpha pass based on state so the only work around is to ensure we always render something in this
//pass. Throwing in a polygon with a 0 area does the job
//See: https://github.com/MinecraftForge/MinecraftForge/issues/981
if(RenderUtil.theRenderPass == 1) {
if(ForgeHooksClient.getWorldRenderPass() == 1) {
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
@@ -124,7 +125,7 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
boolean renderedFacade = renderFacade(x, y, z, rb, bundle, player);
boolean renderConduit = !renderedFacade || ConduitUtil.isFacadeHidden(bundle, player);
if(renderConduit && (RenderUtil.theRenderPass == 0 || rb.overrideBlockTexture != null)) {
if(renderConduit && (ForgeHooksClient.getWorldRenderPass() == 0 || rb.overrideBlockTexture != null)) {
BlockCoord loc = bundle.getLocation();
float brightness;
if(!Config.updateLightingWhenHidingFacades && bundle.hasFacade() && ConduitUtil.isFacadeHidden(bundle, player)) {
@@ -162,8 +163,8 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
bundle.setFacadeRenderAs(FacadeRenderState.FULL);
boolean isFacadeOpaque = facadeId.isOpaqueCube();
if((isFacadeOpaque && RenderUtil.theRenderPass == 0) ||
(rb.hasOverrideBlockTexture() || (!isFacadeOpaque && RenderUtil.theRenderPass == 1))) {
if((isFacadeOpaque && ForgeHooksClient.getWorldRenderPass() == 0) ||
(rb.hasOverrideBlockTexture() || (!isFacadeOpaque && ForgeHooksClient.getWorldRenderPass() == 1))) {
IBlockAccess origBa = rb.blockAccess;
rb.blockAccess = new FacadeAccessWrapper(origBa);
try {