mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-24 01:19:41 +00:00
77 lines
2.6 KiB
Java
77 lines
2.6 KiB
Java
package noppes.npcs.client.renderer.blocks;
|
|
|
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.client.renderer.RenderBlocks;
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import net.minecraft.util.ResourceLocation;
|
|
import noppes.npcs.CustomItems;
|
|
import noppes.npcs.blocks.BlockTallLamp;
|
|
import noppes.npcs.blocks.tiles.TileTallLamp;
|
|
import noppes.npcs.client.model.blocks.ModelTallLamp;
|
|
import noppes.npcs.client.model.blocks.ModelTallLampTop;
|
|
import org.lwjgl.opengl.GL11;
|
|
import org.lwjgl.opengl.GL12;
|
|
|
|
public class BlockTallLampRenderer extends BlockRendererInterface{
|
|
|
|
private final ModelTallLamp model = new ModelTallLamp();
|
|
|
|
private final ModelTallLampTop top = new ModelTallLampTop();
|
|
public static final ResourceLocation resourceTop = new ResourceLocation("customnpcs","textures/cache/wool_colored_white.png");
|
|
|
|
public BlockTallLampRenderer(){
|
|
((BlockTallLamp)CustomItems.tallLamp).renderId = RenderingRegistry.getNextAvailableRenderId();
|
|
RenderingRegistry.registerBlockHandler(this);
|
|
}
|
|
|
|
@Override
|
|
public void renderTileEntityAt(TileEntity var1, double var2, double var4,
|
|
double var6, float var8) {
|
|
TileTallLamp tile = (TileTallLamp) var1;
|
|
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
|
GL11.glPushMatrix();
|
|
GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.5f, (float)var6 + 0.5f);
|
|
//GL11.glScalef(0.95f, 0.95f, 0.95f);
|
|
GL11.glRotatef(180, 0, 0, 1);
|
|
GL11.glRotatef(90 * tile.rotation, 0, 1, 0);
|
|
GL11.glColor3f(1, 1, 1);
|
|
|
|
setMaterialTexture(var1.getBlockMetadata());
|
|
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
|
|
|
this.bindTexture(resourceTop);
|
|
float[] color = BlockBannerRenderer.colorTable[tile.color];
|
|
GL11.glColor3f(color[0], color[1], color[2]);
|
|
top.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
|
|
|
GL11.glPopMatrix();
|
|
}
|
|
|
|
@Override
|
|
public void renderInventoryBlock(Block block, int metadata, int modelId,
|
|
RenderBlocks renderer) {
|
|
GL11.glPushMatrix();
|
|
GL11.glTranslatef(0, 0.42f, 0);
|
|
GL11.glScalef(0.76f, 0.66f, 0.76f);
|
|
GL11.glRotatef(180, 0, 0, 1);
|
|
GL11.glRotatef(180, 0, 1, 0);
|
|
|
|
setMaterialTexture(metadata);
|
|
GL11.glColor3f(1, 1, 1);
|
|
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
|
|
|
this.bindTexture(resourceTop);
|
|
float[] color = BlockBannerRenderer.colorTable[15 - metadata];
|
|
GL11.glColor3f(color[0], color[1], color[2]);
|
|
top.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
|
GL11.glPopMatrix();
|
|
}
|
|
|
|
|
|
@Override
|
|
public int getRenderId() {
|
|
return CustomItems.tallLamp.getRenderType();
|
|
}
|
|
}
|