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