Search in sources :

Example 6 with StructureRenderer

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);
    }
}
Also used : PacketStructureRequest(mchorse.blockbuster.network.common.structure.PacketStructureRequest) StructureRenderer(mchorse.blockbuster_pack.morphs.structure.StructureRenderer) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

StructureRenderer (mchorse.blockbuster_pack.morphs.structure.StructureRenderer)6 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)5 PacketStructureRequest (mchorse.blockbuster.network.common.structure.PacketStructureRequest)2 File (java.io.File)1 ModelTransform (mchorse.blockbuster.api.ModelTransform)1 AudioLibrary (mchorse.blockbuster.audio.AudioLibrary)1 RenderActor (mchorse.blockbuster.client.render.RenderActor)1 RenderGunProjectile (mchorse.blockbuster.client.render.RenderGunProjectile)1 TileEntityDirectorRenderer (mchorse.blockbuster.client.render.tileentity.TileEntityDirectorRenderer)1 TileEntityGunItemStackRenderer (mchorse.blockbuster.client.render.tileentity.TileEntityGunItemStackRenderer)1 TileEntityModelItemStackRenderer (mchorse.blockbuster.client.render.tileentity.TileEntityModelItemStackRenderer)1 TileEntityModelRenderer (mchorse.blockbuster.client.render.tileentity.TileEntityModelRenderer)1 ChunkProviderClient (net.minecraft.client.multiplayer.ChunkProviderClient)1 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)1 Item (net.minecraft.item.Item)1 Profiler (net.minecraft.profiler.Profiler)1 BlockPos (net.minecraft.util.math.BlockPos)1 WorldProvider (net.minecraft.world.WorldProvider)1 WorldProviderSurface (net.minecraft.world.WorldProviderSurface)1 WorldSettings (net.minecraft.world.WorldSettings)1