Fixed SILLY rendering errors with the Mimic
This commit is contained in:
parent
215b337f71
commit
b422e00019
|
@ -207,7 +207,7 @@ public class BlockMimic extends BlockStringContainer implements IVariantProvider
|
|||
@Override
|
||||
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer)
|
||||
{
|
||||
return layer == BlockRenderLayer.CUTOUT_MIPPED || layer == BlockRenderLayer.TRANSLUCENT;
|
||||
return layer == BlockRenderLayer.CUTOUT_MIPPED || layer == BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -43,7 +43,7 @@ public class RenderEntityMimic extends RenderLiving<EntityMimic>
|
|||
super.doRender(mimic, x, y, z, entityYaw, partialTicks);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
if (mimic.getItemStack() != null)
|
||||
if (mimic.getMimicItemStack() != null)
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
|
@ -55,7 +55,7 @@ public class RenderEntityMimic extends RenderLiving<EntityMimic>
|
|||
|
||||
GlStateManager.translate(x, y, z);
|
||||
|
||||
ItemStack itemstack = mimic.getItemStack();
|
||||
ItemStack itemstack = mimic.getMimicItemStack();
|
||||
Item item = itemstack.getItem();
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
GlStateManager.pushMatrix();
|
||||
|
|
|
@ -47,6 +47,7 @@ public class EntityMimic extends EntityMob
|
|||
public boolean dropItemsOnBreak = true;
|
||||
public NBTTagCompound tileTag = new NBTTagCompound();
|
||||
public int metaOfReplacedBlock = 0;
|
||||
public int playerCheckRadius = 5;
|
||||
|
||||
public EntityMimic(World worldIn)
|
||||
{
|
||||
|
@ -75,14 +76,7 @@ public class EntityMimic extends EntityMob
|
|||
tag.setBoolean("dropItemsOnBreak", dropItemsOnBreak);
|
||||
tag.setTag("tileTag", tileTag);
|
||||
tag.setInteger("metaOfReplacedBlock", metaOfReplacedBlock);
|
||||
|
||||
// NBTTagCompound itemTag = new NBTTagCompound();
|
||||
// if (heldStack != null)
|
||||
// {
|
||||
// heldStack.writeToNBT(itemTag);
|
||||
// }
|
||||
//
|
||||
// tag.setTag("heldItem", itemTag);
|
||||
tag.setInteger("playerCheckRadius", playerCheckRadius);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -93,20 +87,12 @@ public class EntityMimic extends EntityMob
|
|||
dropItemsOnBreak = tag.getBoolean("dropItemsOnBreak");
|
||||
tileTag = tag.getCompoundTag("tileTag");
|
||||
metaOfReplacedBlock = tag.getInteger("metaOfReplacedBlock");
|
||||
// NBTTagCompound itemTag = tag.getCompoundTag("heldItem");
|
||||
//
|
||||
// if (!itemTag.hasNoTags())
|
||||
// {
|
||||
// heldStack = ItemStack.loadItemStackFromNBT(itemTag);
|
||||
// }
|
||||
// mimicedTile = getTileFromStackWithTag(worldObj, pos, getStackInSlot(0), tileTag, metaOfReplacedBlock);
|
||||
playerCheckRadius = tag.getInteger("playerCheckRadius");
|
||||
}
|
||||
|
||||
public ItemStack getItemStack()
|
||||
public ItemStack getMimicItemStack()
|
||||
{
|
||||
// System.out.println(heldStack);
|
||||
return this.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
// return ItemStack.copyItemStack(heldStack);
|
||||
}
|
||||
|
||||
public void setItemStack(ItemStack stack)
|
||||
|
@ -116,7 +102,7 @@ public class EntityMimic extends EntityMob
|
|||
|
||||
public boolean spawnHeldBlockOnDeath(World world, BlockPos pos)
|
||||
{
|
||||
return world.isAirBlock(pos) && TileMimic.replaceMimicWithBlockActual(world, pos, getItemStack(), tileTag, metaOfReplacedBlock);
|
||||
return world.isAirBlock(pos) && TileMimic.replaceMimicWithBlockActual(world, pos, getMimicItemStack(), tileTag, metaOfReplacedBlock);
|
||||
}
|
||||
|
||||
public boolean spawnMimicBlockAtPosition(World world, BlockPos pos)
|
||||
|
@ -131,7 +117,7 @@ public class EntityMimic extends EntityMob
|
|||
TileMimic mimic = (TileMimic) tile;
|
||||
mimic.metaOfReplacedBlock = metaOfReplacedBlock;
|
||||
mimic.tileTag = tileTag;
|
||||
mimic.setInventorySlotContents(0, getItemStack());
|
||||
mimic.setInventorySlotContents(0, getMimicItemStack());
|
||||
mimic.dropItemsOnBreak = dropItemsOnBreak;
|
||||
mimic.refreshTileEntity();
|
||||
}
|
||||
|
@ -142,12 +128,13 @@ public class EntityMimic extends EntityMob
|
|||
return false;
|
||||
}
|
||||
|
||||
public void initializeMimic(ItemStack heldStack, NBTTagCompound tileTag, boolean dropItemsOnBreak, int metaOfReplacedBlock)
|
||||
public void initializeMimic(ItemStack heldStack, NBTTagCompound tileTag, boolean dropItemsOnBreak, int metaOfReplacedBlock, int playerCheckRadius)
|
||||
{
|
||||
this.setItemStack(heldStack);
|
||||
this.tileTag = tileTag;
|
||||
this.dropItemsOnBreak = dropItemsOnBreak;
|
||||
this.metaOfReplacedBlock = metaOfReplacedBlock;
|
||||
this.playerCheckRadius = playerCheckRadius;
|
||||
}
|
||||
|
||||
public void reformIntoMimicBlock()
|
||||
|
|
|
@ -39,20 +39,6 @@ public class ItemSigilDivination extends ItemSigilBase implements IAltarReader
|
|||
// DungeonTester.testDungeonElementWithOutput((WorldServer) world, player.getPosition());
|
||||
// }
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
EntityMimic mimic = new EntityMimic(world);
|
||||
|
||||
mimic.setPosition(player.posX, player.posY, player.posZ);
|
||||
world.spawnEntityInWorld(mimic);
|
||||
|
||||
System.out.println("Spawning Mimic");
|
||||
// EntityZombie zombie = new EntityZombie(world);
|
||||
// zombie.setPosition(player.posX, player.posY, player.posZ);
|
||||
// zombie.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(Blocks.CHEST));
|
||||
// world.spawnEntityInWorld(zombie);
|
||||
}
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
super.onItemRightClick(stack, world, player, hand);
|
||||
|
|
|
@ -256,7 +256,7 @@ public class TileMimic extends TileInventory implements ITickable
|
|||
EntityMimic mimicEntity = new EntityMimic(worldObj);
|
||||
mimicEntity.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
|
||||
|
||||
mimicEntity.initializeMimic(getStackInSlot(0), tileTag, dropItemsOnBreak, metaOfReplacedBlock);
|
||||
mimicEntity.initializeMimic(getStackInSlot(0), tileTag, dropItemsOnBreak, metaOfReplacedBlock, playerCheckRadius);
|
||||
tileTag = null;
|
||||
mimicedTile = null;
|
||||
this.setInventorySlotContents(0, null);
|
||||
|
|
Loading…
Reference in a new issue