From 187a49f43c3523eb3ab17dced052722825681d4a Mon Sep 17 00:00:00 2001 From: Blood-Asp Date: Wed, 19 Oct 2016 22:27:27 +0200 Subject: [PATCH] Some Block fixes --- .../common/blocks/GT_Block_Reinforced.java | 8 +++++- .../blocks/GT_Block_Stones_Abstract.java | 27 ++++++++++--------- 2 files changed, 21 insertions(+), 14 deletions(-) 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 a2d46f39..fa5e8162 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java @@ -21,6 +21,7 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EnumCreatureType; +import net.minecraft.entity.boss.EntityWither; import net.minecraft.entity.item.EntityTNTPrimed; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -237,9 +238,10 @@ public class GT_Block_Reinforced extends GT_Generic_Block { public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion) { + if(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); + world.spawnEntityInWorld(entitytntprimed);} } public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer player, int side, float xOffset, float yOffset, float zOffset) @@ -264,4 +266,8 @@ public class GT_Block_Reinforced extends GT_Generic_Block { if (!aStack.getDisplayName().contains(".name")) aList.add(aStack); } } + + public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) { + return !(entity instanceof EntityWither); + } } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Stones_Abstract.java b/src/main/java/gregtech/common/blocks/GT_Block_Stones_Abstract.java index a681e713..064f6841 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Stones_Abstract.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Stones_Abstract.java @@ -72,43 +72,43 @@ public class GT_Block_Stones_Abstract GT_Values.RA.addLaserEngraverRecipe(new ItemStack(this, 1, 15), GT_Utility.copyAmount(0L, new Object[]{aStack}), new ItemStack(this, 1, 14), 50, 16); } } - + @Override public String getHarvestTool(int aMeta) { return "pickaxe"; } - + @Override public int getHarvestLevel(int aMeta) { return 1; } - + @Override public float getBlockHardness(World aWorld, int aX, int aY, int aZ) { return this.blockHardness = Blocks.stone.getBlockHardness(aWorld, aX, aY, aZ) * 3.0F; } - + @Override public String getUnlocalizedName() { return this.mUnlocalizedName; } - + @Override public String getLocalizedName() { return StatCollector.translateToLocal(this.mUnlocalizedName + ".name"); } - + @Override public boolean canBeReplacedByLeaves(IBlockAccess aWorld, int aX, int aY, int aZ) { return false; } - + @Override public boolean isNormalCube(IBlockAccess aWorld, int aX, int aY, int aZ) { return true; } - + @Override public boolean renderAsNormalBlock() { return true; } - + @Override public boolean isOpaqueCube() { return true; } - + @Override public IIcon getIcon(int aSide, int aMeta) { if ((aMeta >= 0) && (aMeta < 16)) { return gregtech.api.enums.Textures.BlockIcons.GRANITES[aMeta].getIcon(); @@ -116,18 +116,19 @@ public class GT_Block_Stones_Abstract return null; } + @Override public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) { return world.getBlockMetadata(x, y, z) % 8 < 3; } - + @Override public int damageDropped(int par1) { return par1 % 8 == 0 ? par1 + 1 : par1; } - + @Override public int getDamageValue(World par1World, int par2, int par3, int par4) { return par1World.getBlockMetadata(par2, par3, par4); } - + @Override public int quantityDropped(Random par1Random) { return 1; }