Made the mimics actually render chests and other TESRs properly - need to add non-opaque mimics for wider selection and for chests to not look like crud.
This commit is contained in:
parent
80bf140ee5
commit
117e692969
5 changed files with 191 additions and 23 deletions
|
@ -6,7 +6,9 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityChest;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
|
@ -36,7 +38,7 @@ public class ItemBlockMimic extends ItemBlock
|
|||
IBlockState iblockstate = world.getBlockState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
if (player.isSneaking())
|
||||
if (!player.isSneaking())
|
||||
{
|
||||
return super.onItemUse(stack, player, world, pos, hand, facing, hitX, hitY, hitZ);
|
||||
}
|
||||
|
@ -54,6 +56,10 @@ public class ItemBlockMimic extends ItemBlock
|
|||
|
||||
ItemStack replacedStack = block.getItem(world, pos, iblockstate);
|
||||
|
||||
// ItemStack replacedStack = new ItemStack(block, 1, block.getMetaFromState(iblockstate));
|
||||
|
||||
NBTTagCompound tileTag = getTagFromTileEntity(tileReplaced);
|
||||
|
||||
if (placeBlockAt(stack, player, world, pos, facing, hitX, hitY, hitZ, iblockstate1))
|
||||
{
|
||||
SoundType soundtype = this.block.getSoundType();
|
||||
|
@ -80,9 +86,26 @@ public class ItemBlockMimic extends ItemBlock
|
|||
|
||||
public boolean canReplaceTile(int meta, TileEntity tile)
|
||||
{
|
||||
if (tile instanceof TileEntityChest)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return tile == null;
|
||||
}
|
||||
|
||||
public NBTTagCompound getTagFromTileEntity(TileEntity tile)
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
|
||||
if (tile != null)
|
||||
{
|
||||
return tile.writeToNBT(tag);
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int meta)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue