use of mchorse.blockbuster_pack.morphs.structure.StructureRenderer in project blockbuster by mchorse.
the class StructureMorph method renderOnScreen.
@Override
@SideOnly(Side.CLIENT)
public void renderOnScreen(EntityPlayer player, int x, int y, float scale, float alpha) {
StructureRenderer renderer = STRUCTURES.get(this.structure);
if (renderer != null) {
if (renderer.status != StructureStatus.LOADED) {
if (renderer.status == StructureStatus.UNLOADED) {
renderer.status = StructureStatus.LOADING;
Dispatcher.sendToServer(new PacketStructureRequest(this.structure));
}
return;
}
int max = Math.max(renderer.size.getX(), Math.max(renderer.size.getY(), renderer.size.getZ()));
scale /= 0.65F * max;
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
float lastX = OpenGlHelper.lastBrightnessX;
float lastY = OpenGlHelper.lastBrightnessY;
GlStateManager.enableDepth();
GlStateManager.enableAlpha();
GlStateManager.disableCull();
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, 0);
GlStateManager.scale(scale, scale, scale);
GlStateManager.rotate(45.0F, -1.0F, 0.0F, 0.0F);
GlStateManager.rotate(45.0F, 0.0F, -1.0F, 0.0F);
GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
renderer.render(this);
renderer.renderTEs(this);
GlStateManager.disableLighting();
GlStateManager.popMatrix();
GlStateManager.enableCull();
GlStateManager.disableAlpha();
GlStateManager.disableDepth();
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lastX, lastY);
}
}
Aggregations