mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
56 lines
1.4 KiB
Java
56 lines
1.4 KiB
Java
package com.hbm.render.tileentity;
|
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
import com.hbm.blocks.machine.rbmk.RBMKBase;
|
|
import com.hbm.lib.RefStrings;
|
|
import com.hbm.main.ResourceManager;
|
|
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKControl;
|
|
|
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import net.minecraft.util.ResourceLocation;
|
|
|
|
public class RenderRBMKControlRod extends TileEntitySpecialRenderer {
|
|
|
|
private ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/blocks/rbmk/rbmk_control.png");
|
|
|
|
@Override
|
|
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float i) {
|
|
|
|
GL11.glPushMatrix();
|
|
|
|
TileEntityRBMKControl control = (TileEntityRBMKControl)te;
|
|
|
|
int offset = 1;
|
|
|
|
for(int o = 1; o < 16; o++) {
|
|
|
|
if(te.getWorldObj().getBlock(te.xCoord, te.yCoord + o, te.zCoord) == te.getBlockType()) {
|
|
offset = o;
|
|
} else {
|
|
break;
|
|
}
|
|
}
|
|
|
|
GL11.glTranslated(x + 0.5, y + offset, z + 0.5);
|
|
|
|
GL11.glEnable(GL11.GL_LIGHTING);
|
|
GL11.glEnable(GL11.GL_CULL_FACE);
|
|
|
|
|
|
if(control.getBlockType() instanceof RBMKBase) {
|
|
bindTexture(((RBMKBase)control.getBlockType()).coverTexture);
|
|
} else {
|
|
bindTexture(texture);
|
|
}
|
|
|
|
double level = control.lastLevel + (control.level - control.lastLevel) * i;
|
|
|
|
GL11.glTranslated(0, level, 0);
|
|
ResourceManager.rbmk_rods_vbo.renderPart("Lid");
|
|
|
|
GL11.glPopMatrix();
|
|
}
|
|
}
|