use of riskyken.armourersWorkshop.common.tileentities.TileEntitySkinnableChild in project Armourers-Workshop by RiskyKen.
the class BlockSkinnableChild method getDebugHoverText.
@Override
public void getDebugHoverText(World world, int x, int y, int z, ArrayList<String> textLines) {
TileEntitySkinnableChild te = (TileEntitySkinnableChild) world.getTileEntity(x, y, z);
super.getDebugHoverText(world, x, y, z, textLines);
textLines.add("parent X=" + te.parentX);
textLines.add("parent Y=" + te.parentY);
textLines.add("parent Z=" + te.parentZ);
textLines.add("offset X=" + (-te.parentX + te.xCoord));
textLines.add("offset Y=" + (te.yCoord - te.parentY));
textLines.add("offset Z=" + (-(te.parentZ - te.zCoord)));
}
use of riskyken.armourersWorkshop.common.tileentities.TileEntitySkinnableChild in project Armourers-Workshop by RiskyKen.
the class RenderBlockSkinnable method renderTileEntityAt.
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTickTime) {
if (!(tileEntity instanceof TileEntitySkinnableChild)) {
renderList.add(new RenderLast(tileEntity, x, y, z));
}
if (ConfigHandlerClient.showSkinBlockBounds) {
if (!(tileEntity.getBlockType() instanceof BlockSkinnable)) {
return;
}
BlockSkinnable block = (BlockSkinnable) tileEntity.getBlockType();
block.setBlockBoundsBasedOnState(tileEntity.getWorldObj(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
double minX = block.getBlockBoundsMinX();
double minY = block.getBlockBoundsMinY();
double minZ = block.getBlockBoundsMinZ();
double maxX = block.getBlockBoundsMaxX();
double maxY = block.getBlockBoundsMaxY();
double maxZ = block.getBlockBoundsMaxZ();
float f1 = 0.002F;
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
aabb.offset(x, y, z);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LIGHTING);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glColor4f(0.0F, 1.0F, 0.0F, 0.4F);
GL11.glLineWidth(1.0F);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDepthMask(false);
RenderGlobal.drawOutlinedBoundingBox(aabb.contract(f1, f1, f1), -1);
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
}
if (ConfigHandlerClient.showSkinRenderBounds) {
if ((tileEntity instanceof TileEntitySkinnableChild)) {
return;
}
float f1 = 0.002F;
AxisAlignedBB aabb = tileEntity.getRenderBoundingBox().copy();
aabb.offset(x - tileEntity.xCoord, y - tileEntity.yCoord, z - tileEntity.zCoord);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LIGHTING);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glColor4f(1.0F, 1.0F, 0.0F, 0.4F);
GL11.glLineWidth(1.0F);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDepthMask(false);
RenderGlobal.drawOutlinedBoundingBox(aabb.contract(f1, f1, f1), -1);
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
}
}
use of riskyken.armourersWorkshop.common.tileentities.TileEntitySkinnableChild in project Armourers-Workshop by RiskyKen.
the class ItemSkin method placeChild.
private void placeChild(World world, EntityPlayer player, int side, int x, int y, int z, int ix, int iy, int iz, Skin skin, SkinPointer skinPointer, ArrayList<BlockLocation> relatedBlocks) {
ForgeDirection dir = UtilPlayer.getDirectionSide(player).getOpposite();
BlockSkinnable targetBlock = (BlockSkinnable) ModBlocks.skinnableChild;
int meta = targetBlock.convertDirectionToMetadata(dir);
if (SkinProperties.PROP_BLOCK_GLOWING.getValue(skin.getProperties())) {
targetBlock = (BlockSkinnable) ModBlocks.skinnableChildGlowing;
}
float[] bounds = TileEntitySkinnable.getBlockBounds(skin, -ix + 2, iy, iz, dir);
if (bounds != null) {
int childX = x;
int childY = y;
int childZ = z;
childX += ix - 1 - dir.offsetX * 1;
childY += iy;
childZ += iz - 1 - dir.offsetZ * 1;
world.setBlock(childX, childY, childZ, targetBlock, meta, 2);
world.setTileEntity(childX, childY, childZ, targetBlock.createTileEntity(world, meta));
TileEntitySkinnableChild te = (TileEntitySkinnableChild) world.getTileEntity(childX, childY, childZ);
te.setSkinPointer(skin, skinPointer);
te.setParentLocation(x, y, z);
te.setRelatedBlocks(relatedBlocks);
}
}
Aggregations