Search in sources :

Example 1 with ModelPylon

use of net.silentchaos512.gems.client.render.models.ModelPylon in project SilentGems by SilentChaos512.

the class RenderTileChaosPylon method renderTileEntityAt.

@Override
public void renderTileEntityAt(TileChaosPylon te, double x, double y, double z, float partialTicks, int destroyStage) {
    if (te != null && te.getWorld() != null && !te.getWorld().isBlockLoaded(te.getPos(), false)) {
        return;
    }
    if (model == null) {
        model = new ModelPylon();
    }
    if (plates == null) {
        plates = new ModelPylonPlates();
    }
    double worldTime = (te.getWorld() == null) ? 0 : (double) (ClientTickHandler.ticksInGame + partialTicks) + new Random(te.getPos().hashCode()).nextInt(360);
    int pylonType = te.getPylonType().getMeta();
    double bobFactor = 1.0;
    // render the pylon
    GlStateManager.pushMatrix();
    GlStateManager.enableRescaleNormal();
    GlStateManager.enableBlend();
    GlStateManager.disableLighting();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.color(1F, 1F, 1F, 1F);
    Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    GlStateManager.translate(x + 0.5, y + 0.5 + 0.1 * Math.sin(worldTime / 20) * bobFactor, z + 0.5);
    GlStateManager.rotate((float) worldTime, 0.0f, 1.0f, 0.0f);
    model.renderPylon(pylonType);
    GlStateManager.popMatrix();
    // render the plates
    GlStateManager.pushMatrix();
    GlStateManager.translate(x + 0.5, y + 0.5 + 0.1 * Math.sin(worldTime / 20) * bobFactor, z + 0.5);
    GlStateManager.rotate(-(float) worldTime, 0.0f, 1.0f, 0.0f);
    // model = new ModelPylon();
    plates.renderPylonPlates(pylonType);
    GlStateManager.popMatrix();
}
Also used : ModelPylon(net.silentchaos512.gems.client.render.models.ModelPylon) Random(java.util.Random) ModelPylonPlates(net.silentchaos512.gems.client.render.models.ModelPylonPlates)

Example 2 with ModelPylon

use of net.silentchaos512.gems.client.render.models.ModelPylon in project SilentGems by SilentChaos512.

the class RenderTileChaosPylon method clRender.

@Override
public void clRender(TileChaosPylon te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
    if (te != null && te.getWorld() != null && !te.getWorld().isBlockLoaded(te.getPos(), false)) {
        return;
    }
    if (model == null) {
        model = new ModelPylon();
    }
    if (plates == null) {
        plates = new ModelPylonPlates();
    }
    double worldTime = (te.getWorld() == null) ? 0 : (double) (ClientTickHandler.ticksInGame + partialTicks) + new Random(te.getPos().hashCode()).nextInt(360);
    int pylonType = te.getPylonType().getMeta();
    double bobFactor = 1.0;
    // render the pylon
    GlStateManager.pushMatrix();
    GlStateManager.enableRescaleNormal();
    GlStateManager.enableBlend();
    GlStateManager.disableLighting();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.color(1F, 1F, 1F, 1F);
    Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    GlStateManager.translate(x + 0.5, y + 0.5 + 0.1 * Math.sin(worldTime / 20) * bobFactor, z + 0.5);
    GlStateManager.rotate((float) worldTime, 0.0f, 1.0f, 0.0f);
    model.renderPylon(pylonType);
    GlStateManager.popMatrix();
    // render the plates
    GlStateManager.pushMatrix();
    GlStateManager.translate(x + 0.5, y + 0.5 + 0.1 * Math.sin(worldTime / 20) * bobFactor, z + 0.5);
    GlStateManager.rotate(-(float) worldTime, 0.0f, 1.0f, 0.0f);
    // model = new ModelPylon();
    plates.renderPylonPlates(pylonType);
    GlStateManager.popMatrix();
}
Also used : ModelPylon(net.silentchaos512.gems.client.render.models.ModelPylon) Random(java.util.Random) ModelPylonPlates(net.silentchaos512.gems.client.render.models.ModelPylonPlates)

Aggregations

Random (java.util.Random)2 ModelPylon (net.silentchaos512.gems.client.render.models.ModelPylon)2 ModelPylonPlates (net.silentchaos512.gems.client.render.models.ModelPylonPlates)2