diff --git a/src/main/java/twilightforest/TFCommonProxy.java b/src/main/java/twilightforest/TFCommonProxy.java index 9d16e61686..087a19624d 100644 --- a/src/main/java/twilightforest/TFCommonProxy.java +++ b/src/main/java/twilightforest/TFCommonProxy.java @@ -2,6 +2,7 @@ import net.minecraft.client.model.ModelBiped; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; import cpw.mods.fml.common.network.IGuiHandler; @@ -160,4 +161,8 @@ public ModelBiped getCritterArmorModel(int boss) { public void doBlockAnnihilateEffect(World worldObj, int blockX, int blockY, int blockZ) {} + public boolean checkForSound(ChunkCoordinates chunkcoordinates) { + return true; + } + } diff --git a/src/main/java/twilightforest/TwilightForestMod.java b/src/main/java/twilightforest/TwilightForestMod.java index 0bcc703416..e849ad06b1 100644 --- a/src/main/java/twilightforest/TwilightForestMod.java +++ b/src/main/java/twilightforest/TwilightForestMod.java @@ -39,8 +39,10 @@ import twilightforest.item.TFItems; import twilightforest.item.TFRecipes; import twilightforest.structures.StructureTFMajorFeatureStart; +import twilightforest.tileentity.TileEntityTFAlphaYetiSpawner; import twilightforest.tileentity.TileEntityTFCReactorActive; import twilightforest.tileentity.TileEntityTFCake; +import twilightforest.tileentity.TileEntityTFChest; import twilightforest.tileentity.TileEntityTFCicada; import twilightforest.tileentity.TileEntityTFCinderFurnace; import twilightforest.tileentity.TileEntityTFFirefly; @@ -50,6 +52,7 @@ import twilightforest.tileentity.TileEntityTFHydraSpawner; import twilightforest.tileentity.TileEntityTFKnightPhantomsSpawner; import twilightforest.tileentity.TileEntityTFLichSpawner; +import twilightforest.tileentity.TileEntityTFMinoshroomSpawner; import twilightforest.tileentity.TileEntityTFMoonworm; import twilightforest.tileentity.TileEntityTFNagaSpawner; import twilightforest.tileentity.TileEntityTFNagastone; @@ -886,7 +889,12 @@ private void registerTileEntities() { GameRegistry.registerTileEntity(TileEntityTFCicada.class, "Cicada"); GameRegistry.registerTileEntity(TileEntityTFNagaSpawner.class, "Naga Spawner"); GameRegistry.registerTileEntity(TileEntityTFLichSpawner.class, "Lich Spawner"); + GameRegistry.registerTileEntity(TileEntityTFMinoshroomSpawner.class, "Minoshroom Spawner"); GameRegistry.registerTileEntity(TileEntityTFHydraSpawner.class, "Hydra Spawner"); + GameRegistry.registerTileEntity(TileEntityTFKnightPhantomsSpawner.class, "Knight Phantom Spawner"); + GameRegistry.registerTileEntity(TileEntityTFTowerBossSpawner.class, "Tower Boss Spawner"); + GameRegistry.registerTileEntity(TileEntityTFAlphaYetiSpawner.class, "Alpha Yeti Spawner"); + GameRegistry.registerTileEntity(TileEntityTFSnowQueenSpawner.class, "Snow Queen Spawner"); GameRegistry.registerTileEntity(TileEntityTFSmoker.class, "Swamp Smoker"); GameRegistry.registerTileEntity(TileEntityTFPoppingJet.class, "Popping Flame Jet"); GameRegistry.registerTileEntity(TileEntityTFFlameJet.class, "Lit Flame Jet"); @@ -894,13 +902,11 @@ private void registerTileEntities() { GameRegistry.registerTileEntity(TileEntityTFTowerBuilder.class, "Tower Builder"); GameRegistry.registerTileEntity(TileEntityTFReverter.class, "Tower Reverter"); GameRegistry.registerTileEntity(TileEntityTFTrophy.class, "TF Trophy"); - GameRegistry.registerTileEntity(TileEntityTFTowerBossSpawner.class, "Tower Boss Spawner"); GameRegistry.registerTileEntity(TileEntityTFGhastTrapInactive.class, "Inactive Ghast Trap"); GameRegistry.registerTileEntity(TileEntityTFGhastTrapActive.class, "Active Ghast Trap"); GameRegistry.registerTileEntity(TileEntityTFCReactorActive.class, "Active Carminite Reactor"); - GameRegistry.registerTileEntity(TileEntityTFKnightPhantomsSpawner.class, "Knight Phantom Spawner"); - GameRegistry.registerTileEntity(TileEntityTFSnowQueenSpawner.class, "Snow Queen Spawner"); GameRegistry.registerTileEntity(TileEntityTFCinderFurnace.class, "Cinder Furnace"); + GameRegistry.registerTileEntity(TileEntityTFChest.class, "TF Chest"); } /** diff --git a/src/main/java/twilightforest/block/BlockTFCicada.java b/src/main/java/twilightforest/block/BlockTFCicada.java index 1afc073565..54d74d29c3 100644 --- a/src/main/java/twilightforest/block/BlockTFCicada.java +++ b/src/main/java/twilightforest/block/BlockTFCicada.java @@ -10,6 +10,8 @@ import net.minecraft.world.Explosion; import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import twilightforest.tileentity.TileEntityTFCicada; public class BlockTFCicada extends BlockTFCritter { @@ -78,17 +80,16 @@ public boolean onBlockActivated(World worldIn, int x, int y, int z, EntityPlayer return false; } + @SideOnly(Side.CLIENT) public void stopSinging(World worldIn, int x, int y, int z) { - if (worldIn.isRemote) { - ChunkCoordinates chunkcoordinates = new ChunkCoordinates(x, y, z); - Minecraft mc = Minecraft.getMinecraft(); - ISound isound = (ISound) mc.renderGlobal.mapSoundPositions.get(chunkcoordinates); + ChunkCoordinates chunkcoordinates = new ChunkCoordinates(x, y, z); + Minecraft mc = Minecraft.getMinecraft(); + ISound isound = (ISound) mc.renderGlobal.mapSoundPositions.get(chunkcoordinates); - while (isound != null) { - mc.getSoundHandler().stopSound(isound); - mc.renderGlobal.mapSoundPositions.remove(chunkcoordinates); - isound = (ISound) mc.renderGlobal.mapSoundPositions.get(chunkcoordinates); - } + while (isound != null) { + mc.getSoundHandler().stopSound(isound); + mc.renderGlobal.mapSoundPositions.remove(chunkcoordinates); + isound = (ISound) mc.renderGlobal.mapSoundPositions.get(chunkcoordinates); } } diff --git a/src/main/java/twilightforest/client/TFClientProxy.java b/src/main/java/twilightforest/client/TFClientProxy.java index 1f07702fba..2af6ca611d 100644 --- a/src/main/java/twilightforest/client/TFClientProxy.java +++ b/src/main/java/twilightforest/client/TFClientProxy.java @@ -1,6 +1,7 @@ package twilightforest.client; import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.ISound; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelPig; import net.minecraft.client.model.ModelSilverfish; @@ -12,6 +13,7 @@ import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.init.Items; import net.minecraft.item.Item; +import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.common.MinecraftForge; @@ -856,4 +858,9 @@ public void doBlockAnnihilateEffect(World worldObj, int blockX, int blockY, int } } + public boolean checkForSound(ChunkCoordinates chunkcoordinates) { + ISound isound = (ISound) Minecraft.getMinecraft().renderGlobal.mapSoundPositions.get(chunkcoordinates); + return isound != null; + } + } diff --git a/src/main/java/twilightforest/tileentity/TileEntityTFCicada.java b/src/main/java/twilightforest/tileentity/TileEntityTFCicada.java index 112c3b88e3..28a4ba943a 100644 --- a/src/main/java/twilightforest/tileentity/TileEntityTFCicada.java +++ b/src/main/java/twilightforest/tileentity/TileEntityTFCicada.java @@ -1,7 +1,6 @@ package twilightforest.tileentity; import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.ISound; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.ResourceLocation; @@ -96,12 +95,10 @@ public void doSingAnimation() { } public void playSong() { - if (!TwilightForestMod.silentCicadas && worldObj.isRemote) { - ResourceLocation resource = new ResourceLocation(TwilightForestMod.ID + ":mob.cicada"); + if (!TwilightForestMod.silentCicadas) { ChunkCoordinates chunkcoordinates = new ChunkCoordinates(xCoord, yCoord, zCoord); - Minecraft mc = Minecraft.getMinecraft(); - ISound isound = (ISound) mc.renderGlobal.mapSoundPositions.get(chunkcoordinates); - if (isound == null) { + if (!TwilightForestMod.proxy.checkForSound(chunkcoordinates)) { + ResourceLocation resource = new ResourceLocation(TwilightForestMod.ID + ":mob.cicada"); PositionedSoundRecord positionedsoundrecord = new PositionedSoundRecord( resource, 1.0f, @@ -109,6 +106,7 @@ public void playSong() { (float) xCoord, (float) yCoord, (float) zCoord); + Minecraft mc = Minecraft.getMinecraft(); mc.renderGlobal.mapSoundPositions.put(chunkcoordinates, positionedsoundrecord); mc.getSoundHandler().playSound(positionedsoundrecord); }