Cardboard Box no longer picks up blocks that have -1 hardness values, also prevented Electric Chests from being vulnerable to explosives when locked
This commit is contained in:
parent
b2e532964c
commit
7d17192173
2 changed files with 16 additions and 2 deletions
|
@ -73,6 +73,7 @@ import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -687,7 +688,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
|
||||||
@Override
|
@Override
|
||||||
public float getBlockHardness(World world, int x, int y, int z)
|
public float getBlockHardness(World world, int x, int y, int z)
|
||||||
{
|
{
|
||||||
if(!(blockType == MachineBlock.MACHINE_BLOCK_1 && world.getBlockMetadata(x, y, z) == 13))
|
if(MachineType.get(world.getBlock(x, y, z), world.getBlockMetadata(x, y, z)) != MachineType.ELECTRIC_CHEST)
|
||||||
{
|
{
|
||||||
return blockHardness;
|
return blockHardness;
|
||||||
}
|
}
|
||||||
|
@ -696,6 +697,19 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
|
||||||
return tileEntity.canAccess() ? 3.5F : -1;
|
return tileEntity.canAccess() ? 3.5F : -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getExplosionResistance(Entity entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ)
|
||||||
|
{
|
||||||
|
if(MachineType.get(world.getBlock(x, y, z), world.getBlockMetadata(x, y, z)) != MachineType.ELECTRIC_CHEST)
|
||||||
|
{
|
||||||
|
return blockResistance;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TileEntityElectricChest tileEntity = (TileEntityElectricChest)world.getTileEntity(x, y, z);
|
||||||
|
return tileEntity.canAccess() ? 3.5F : -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest)
|
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest)
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class ItemBlockCardboardBox extends ItemBlock
|
||||||
Block block = world.getBlock(x, y, z);
|
Block block = world.getBlock(x, y, z);
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
|
|
||||||
if(!world.isRemote && MekanismAPI.isBlockCompatible(Item.getItemFromBlock(block), meta))
|
if(!world.isRemote && MekanismAPI.isBlockCompatible(Item.getItemFromBlock(block), meta) && block.getBlockHardness(world, x, y, z) != -1)
|
||||||
{
|
{
|
||||||
BlockData data = new BlockData();
|
BlockData data = new BlockData();
|
||||||
data.block = block;
|
data.block = block;
|
||||||
|
|
Loading…
Reference in a new issue