use of pl.asie.charset.lib.utils.Quaternion in project Charset by CharsetMC.
the class TileProjectorRenderer method render.
@Override
public void render(TileProjector projector, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
if (projector == null || projector.getStack().isEmpty()) {
return;
}
ItemStack stack = projector.getStack();
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z);
Orientation bo = projector.getOrientation();
EnumFacing face = bo.top;
if (SpaceUtils.sign(face) == 1) {
GlStateManager.translate(face.getDirectionVec().getX(), face.getDirectionVec().getY(), face.getDirectionVec().getZ());
}
GlStateManager.translate(0.5 * (1 - Math.abs(face.getDirectionVec().getX())), 0.5 * (1 - Math.abs(face.getDirectionVec().getY())), 0.5 * (1 - Math.abs(face.getDirectionVec().getZ())));
Quaternion quat = Quaternion.fromOrientation(bo);
quat.glRotate();
GlStateManager.rotate(90, 0, 1, 0);
GlStateManager.translate(0.25, 0.25 - 1.0 / 16.0, 31.0 / 128.0);
GlStateManager.enableAlpha();
GlStateManager.enableLighting();
GlStateManager.alphaFunc(GL11.GL_GREATER, 0.0F);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
handleRenderItem(stack, projector);
GlStateManager.popMatrix();
GlStateManager.disableBlend();
}
use of pl.asie.charset.lib.utils.Quaternion in project Charset by CharsetMC.
the class BlockProjector method getBoundingBox.
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
AxisAlignedBB base = BOUNDING_BOX;
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileProjector) {
Quaternion quaternion = Quaternion.fromOrientation(((TileProjector) tile).getOrientation());
base = quaternion.applyRotation(BOUNDING_BOX_ROTATE).offset(0.5, 0.5, 0.5);
}
return base;
}
Aggregations