Updated Pedestal Model

This commit is contained in:
Kam committed 2025-02-12 22:29:16 -05:00
1 parent f74984a014
commit afa5bd81bd
10 files changed
+124 -47

No files matched your search

@@ -14,14 +14,23 @@ import noppes.npcs.CustomItems;
import noppes.npcs.blocks.BlockRotated;
import noppes.npcs.blocks.tiles.TilePedestal;
import noppes.npcs.client.model.blocks.ModelPedestal;
import noppes.npcs.client.model.blocks.legacy.ModelLegacyPedestal;
import noppes.npcs.config.ConfigClient;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
public class BlockPedestalRenderer extends BlockRendererInterface{
private final ModelPedestal model = new ModelPedestal();
private final static ResourceLocation resource = new ResourceLocation("customnpcs:textures/models/npcPedestal.png");
private final ModelLegacyPedestal legacyModel = new ModelLegacyPedestal();
private final static ResourceLocation resource = new ResourceLocation("customnpcs:textures/models/legacy/npcPedestal.png");
private final ModelPedestal model = new ModelPedestal();
private final static ResourceLocation wood = new ResourceLocation("customnpcs:textures/models/pedestal/wood.png");
private final static ResourceLocation stone = new ResourceLocation("customnpcs:textures/models/pedestal/stone.png");
private final static ResourceLocation iron = new ResourceLocation("customnpcs:textures/models/pedestal/iron.png");
private final static ResourceLocation gold = new ResourceLocation("customnpcs:textures/models/pedestal/gold.png");
private final static ResourceLocation diamond = new ResourceLocation("customnpcs:textures/models/pedestal/diamond.png");
public BlockPedestalRenderer(){
((BlockRotated)CustomItems.pedestal).renderId = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(this);
@@ -35,17 +44,26 @@ public class BlockPedestalRenderer extends BlockRendererInterface{
GL11.glEnable(GL11.GL_ALPHA_TEST);
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);
GL11.glScalef(1f, 0.99f, 1f);
TextureManager manager = Minecraft.getMinecraft().getTextureManager();
manager.bindTexture(resource);
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
if(ConfigClient.LegacyPedestal){
setMaterialTexture(var1.getBlockMetadata());
legacyModel.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
GL11.glScalef(1f, 0.99f, 1f);
TextureManager manager = Minecraft.getMinecraft().getTextureManager();
manager.bindTexture(resource);
legacyModel.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
} else {
setPedestalTexture(var1.getBlockMetadata());
GL11.glPushMatrix();
GL11.glScalef(1f, 1.3f, 1f);
GL11.glTranslatef(0f, -0.34f, 0f);
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
GL11.glPopMatrix();
GL11.glScalef(1f, 0.99f, 1f);
}
if(!this.playerTooFar(tile))
doRender(tile.getStackInSlot(0));
GL11.glPopMatrix();
@@ -55,7 +73,10 @@ public class BlockPedestalRenderer extends BlockRendererInterface{
if(item == null || item.getItem() == null || item.getItem() instanceof ItemBlock)
return;
GL11.glPushMatrix();
GL11.glTranslatef(0.06f, 0.30f, 0.02f);
if(ConfigClient.LegacyPedestal)
GL11.glTranslatef(0.06f, 0.30f, 0.02f);
else
GL11.glTranslatef(0.06f, 0.490f, 0.02f);
GL11.glRotatef(180, 0, 0, 1);
GL11.glRotatef(90, 0, 1, 0);
GL11.glScalef(0.6f, 0.6f, 0.6f);
@@ -90,30 +111,53 @@ public class BlockPedestalRenderer extends BlockRendererInterface{
RenderManager.instance.itemRenderer.renderItem(Minecraft.getMinecraft().thePlayer, item, 0);
}
GL11.glPopMatrix();
}
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId,
RenderBlocks renderer) {
GL11.glPushMatrix();
GL11.glTranslatef(0, 0.44f, 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);
if(ConfigClient.LegacyPedestal){
GL11.glTranslatef(0, 0.44f, 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);
legacyModel.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
} else {
GL11.glTranslatef(0, 1.9f, 0);
GL11.glScalef(1f, 1.4f, 1f);
GL11.glRotatef(180, 0, 0, 1);
GL11.glRotatef(180, 0, 1, 0);
setPedestalTexture(metadata);
GL11.glColor3f(1, 1, 1);
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
}
GL11.glPopMatrix();
}
public void setPedestalTexture(int meta){
TextureManager manager = Minecraft.getMinecraft().getTextureManager();
if(meta == 1)
manager.bindTexture(stone);
else if(meta == 2)
manager.bindTexture(iron);
else if(meta == 3)
manager.bindTexture(gold);
else if(meta == 4)
manager.bindTexture(diamond);
else
manager.bindTexture(wood);
}
@Override
public int getRenderId() {
return CustomItems.pedestal.getRenderType();
}
public int specialRenderDistance(){
return 40;
}