Some Block fixes

This commit is contained in:
Blood-Asp 2016-10-19 22:27:27 +02:00
parent 00d19d70be
commit 187a49f43c
2 changed files with 21 additions and 14 deletions

View file

@ -21,6 +21,7 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.item.EntityTNTPrimed; import net.minecraft.entity.item.EntityTNTPrimed;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; 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) 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 entitytntprimed = new EntityTNTPrimed(world, x, y, z, explosion.getExplosivePlacedBy());
entitytntprimed.fuse = (world.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8); 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) 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); 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);
}
} }

View file

@ -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); 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) { public String getHarvestTool(int aMeta) {
return "pickaxe"; return "pickaxe";
} }
@Override
public int getHarvestLevel(int aMeta) { public int getHarvestLevel(int aMeta) {
return 1; return 1;
} }
@Override
public float getBlockHardness(World aWorld, int aX, int aY, int aZ) { public float getBlockHardness(World aWorld, int aX, int aY, int aZ) {
return this.blockHardness = Blocks.stone.getBlockHardness(aWorld, aX, aY, aZ) * 3.0F; return this.blockHardness = Blocks.stone.getBlockHardness(aWorld, aX, aY, aZ) * 3.0F;
} }
@Override
public String getUnlocalizedName() { public String getUnlocalizedName() {
return this.mUnlocalizedName; return this.mUnlocalizedName;
} }
@Override
public String getLocalizedName() { public String getLocalizedName() {
return StatCollector.translateToLocal(this.mUnlocalizedName + ".name"); return StatCollector.translateToLocal(this.mUnlocalizedName + ".name");
} }
@Override
public boolean canBeReplacedByLeaves(IBlockAccess aWorld, int aX, int aY, int aZ) { public boolean canBeReplacedByLeaves(IBlockAccess aWorld, int aX, int aY, int aZ) {
return false; return false;
} }
@Override
public boolean isNormalCube(IBlockAccess aWorld, int aX, int aY, int aZ) { public boolean isNormalCube(IBlockAccess aWorld, int aX, int aY, int aZ) {
return true; return true;
} }
@Override
public boolean renderAsNormalBlock() { public boolean renderAsNormalBlock() {
return true; return true;
} }
@Override
public boolean isOpaqueCube() { public boolean isOpaqueCube() {
return true; return true;
} }
@Override
public IIcon getIcon(int aSide, int aMeta) { public IIcon getIcon(int aSide, int aMeta) {
if ((aMeta >= 0) && (aMeta < 16)) { if ((aMeta >= 0) && (aMeta < 16)) {
return gregtech.api.enums.Textures.BlockIcons.GRANITES[aMeta].getIcon(); return gregtech.api.enums.Textures.BlockIcons.GRANITES[aMeta].getIcon();
@ -116,18 +116,19 @@ public class GT_Block_Stones_Abstract
return null; return null;
} }
@Override
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) { public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
return world.getBlockMetadata(x, y, z) % 8 < 3; return world.getBlockMetadata(x, y, z) % 8 < 3;
} }
@Override
public int damageDropped(int par1) { public int damageDropped(int par1) {
return par1 % 8 == 0 ? par1 + 1 : par1; return par1 % 8 == 0 ? par1 + 1 : par1;
} }
@Override
public int getDamageValue(World par1World, int par2, int par3, int par4) { public int getDamageValue(World par1World, int par2, int par3, int par4) {
return par1World.getBlockMetadata(par2, par3, par4); return par1World.getBlockMetadata(par2, par3, par4);
} }
@Override
public int quantityDropped(Random par1Random) { public int quantityDropped(Random par1Random) {
return 1; return 1;
} }