From 945a13d4ae4c4f1cd47e481a0f3d3f980e353ae5 Mon Sep 17 00:00:00 2001 From: dohyun22 Date: Fri, 24 Mar 2017 12:24:02 +0900 Subject: Fixed various Bugs on the Powderbarrel. Fixed PrimedTNT Entity being spawned on client side when destroyed by player. Fixed PrimedTNT Entity spawning at misplaced location (about 0.5m from the center of the block). Fixed fuse sound not being played when ignited. Fixed Powderbarrel not being able to spawn PrimedTNT Entity when destroyed by explosion. --- .../gregtech/common/blocks/GT_Block_Reinforced.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/main/java/gregtech') diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java b/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java index 860760a789..40d2d1a5fe 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java @@ -215,10 +215,10 @@ public class GT_Block_Reinforced extends GT_Generic_Block { public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) { - if(world.getBlockMetadata(x, y, z)==5){ - EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, x, y, z, player == null ? null : player); + if(!world.isRemote && world.getBlockMetadata(x, y, z)==5){ + EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, x + 0.5F, y + 0.5F, z + 0.5F, player == null ? null : player); world.spawnEntityInWorld(entitytntprimed); - world.playSoundAtEntity(entitytntprimed, "random.fuse", 1.0F, 1.0F); + world.playSoundAtEntity(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F); world.setBlockToAir(x, y, z); return false; @@ -241,12 +241,13 @@ public class GT_Block_Reinforced extends GT_Generic_Block { } } - public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion) - { - if(!world.isRemote && world.getBlockMetadata(x, y, z)==5){ - EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, x, y, z, explosion.getExplosivePlacedBy()); - entitytntprimed.fuse = (world.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8); - world.spawnEntityInWorld(entitytntprimed);} + public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) { + if (!world.isRemote && world.getBlockMetadata(x, y, z)==5){ + EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, x + 0.5F, y + 0.5F, z + 0.5F, explosion.getExplosivePlacedBy()); + entitytntprimed.fuse = (world.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8); + world.spawnEntityInWorld(entitytntprimed); + } + super.onBlockExploded(world, x, y, z, explosion); } public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer player, int side, float xOffset, float yOffset, float zOffset) -- cgit From 15db129b1d381045e4eefae8277597cf5a659780 Mon Sep 17 00:00:00 2001 From: dohyun22 Date: Sat, 25 Mar 2017 18:53:21 +0900 Subject: simplified the code. --- src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/gregtech') diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java b/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java index 40d2d1a5fe..d7a47c0bb6 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java @@ -216,7 +216,7 @@ public class GT_Block_Reinforced extends GT_Generic_Block { public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) { if(!world.isRemote && world.getBlockMetadata(x, y, z)==5){ - EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, x + 0.5F, y + 0.5F, z + 0.5F, player == null ? null : player); + EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, x + 0.5F, y + 0.5F, z + 0.5F, player); world.spawnEntityInWorld(entitytntprimed); world.playSoundAtEntity(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F); -- cgit