Temporary fix for obtaining bedrock in Survival (#919)
This stops the mimic from being placed inside of any block marked as unbreakable. This should be expanded to a blacklist when I'm not late for work.
This commit is contained in:
parent
ea61ee201b
commit
80af2463b3
|
@ -48,6 +48,12 @@ public class ItemBlockMimic extends ItemBlock
|
|||
int i = this.getMetadata(stack.getMetadata());
|
||||
IBlockState iblockstate1 = this.block.onBlockPlaced(world, pos, facing, hitX, hitY, hitZ, i, player);
|
||||
|
||||
IBlockState blockReplaced = world.getBlockState(pos);
|
||||
if (!canReplaceBlock(world, pos, blockReplaced))
|
||||
{
|
||||
return super.onItemUse(stack, player, world, pos, hand, facing, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
TileEntity tileReplaced = world.getTileEntity(pos);
|
||||
if (!canReplaceTile(i, tileReplaced))
|
||||
{
|
||||
|
@ -109,6 +115,10 @@ public class ItemBlockMimic extends ItemBlock
|
|||
return tile == null;
|
||||
}
|
||||
|
||||
public boolean canReplaceBlock(World world, BlockPos pos, IBlockState state) {
|
||||
return state.getBlockHardness(world, pos) != -1.0F;
|
||||
}
|
||||
|
||||
public NBTTagCompound getTagFromTileEntity(TileEntity tile)
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
|
|
Loading…
Reference in a new issue