mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-22 01:32:19 +00:00
Upgraded Barrel & Campfire Models
This commit is contained in:
1 parent
435c31ddda
commit
db9ac7f7c4
19 files changed
+466
-206
No files matched your search
@@ -4,28 +4,37 @@ import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.blocks.BlockBarrel;
|
||||
import noppes.npcs.blocks.tiles.TileColorable;
|
||||
import noppes.npcs.client.model.blocks.ModelBarrel;
|
||||
import noppes.npcs.client.model.blocks.ModelBarrelLit;
|
||||
import noppes.npcs.client.model.blocks.barrel.BarrelCore;
|
||||
import noppes.npcs.client.model.blocks.barrel.BarrelTrim;
|
||||
import noppes.npcs.client.model.blocks.barrel.ModelBarrel;
|
||||
import noppes.npcs.client.model.blocks.legacy.ModelLegacyBarrel;
|
||||
import noppes.npcs.client.model.blocks.legacy.ModelLegacyBarrelLid;
|
||||
import noppes.npcs.config.ConfigClient;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
public class BlockBarrelRenderer extends BlockRendererInterface{
|
||||
|
||||
private final ModelBarrel model = new ModelBarrel();
|
||||
private final ModelBarrelLit modelLit = new ModelBarrelLit();
|
||||
private static final ResourceLocation resource1 = new ResourceLocation("customnpcs","textures/models/Barrel.png");
|
||||
// Legacy
|
||||
private final ModelLegacyBarrel legacyModel = new ModelLegacyBarrel();
|
||||
private final ModelLegacyBarrelLid legacyLid = new ModelLegacyBarrelLid();
|
||||
private static final ResourceLocation legacy_texture = new ResourceLocation("customnpcs","textures/models/Barrel.png");
|
||||
|
||||
|
||||
private final BarrelCore core = new BarrelCore();
|
||||
private final BarrelTrim trim = new BarrelTrim();
|
||||
private static final ResourceLocation trimTexture = new ResourceLocation("customnpcs","textures/models/BarrelTrim.png");
|
||||
// Modern
|
||||
private final ModelBarrel barrel = new ModelBarrel();
|
||||
private static final ResourceLocation trimTexture = new ResourceLocation("customnpcs","textures/models/barrel/trim.png");
|
||||
|
||||
private static final ResourceLocation oak_lid = new ResourceLocation("customnpcs","textures/models/barrel/oak_lid.png");
|
||||
private static final ResourceLocation spruce_lid = new ResourceLocation("customnpcs","textures/models/barrel/oak_lid.png");
|
||||
private static final ResourceLocation birch_lid = new ResourceLocation("customnpcs","textures/models/barrel/oak_lid.png");
|
||||
private static final ResourceLocation jungle_lid = new ResourceLocation("customnpcs","textures/models/barrel/oak_lid.png");
|
||||
private static final ResourceLocation acacia_lid = new ResourceLocation("customnpcs","textures/models/barrel/oak_lid.png");
|
||||
private static final ResourceLocation dark_oak_lid = new ResourceLocation("customnpcs","textures/models/barrel/oak_lid.png");
|
||||
|
||||
public BlockBarrelRenderer(){
|
||||
((BlockBarrel)CustomItems.barrel).renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
@@ -39,17 +48,38 @@ public class BlockBarrelRenderer extends BlockRendererInterface{
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.42f, (float)var6 + 0.5f);
|
||||
GL11.glScalef(1.2f, 0.94f,1.2f);
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
GL11.glRotatef(45 * tile.rotation, 0, 1, 0);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
setWoodTexture(var1.getBlockMetadata());
|
||||
core.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(trimTexture);
|
||||
trim.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
|
||||
if(ConfigClient.LegacyBarrel){
|
||||
GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.42f, (float)var6 + 0.5f);
|
||||
GL11.glScalef(1.2f, 0.94f,1.2f);
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
GL11.glRotatef(45 * tile.rotation, 0, 1, 0);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
|
||||
setWoodTexture(var1.getBlockMetadata());
|
||||
legacyModel.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(legacy_texture);
|
||||
legacyLid.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
}
|
||||
else {
|
||||
GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.5f, (float)var6 + 0.5f);
|
||||
GL11.glScalef(1.0f, 1.0f,1.0f);
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
GL11.glRotatef(45 * tile.rotation, 0, 1, 0);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
|
||||
setWoodTexture(var1.getBlockMetadata());
|
||||
barrel.renderWall(0.0625F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(trimTexture);
|
||||
barrel.renderTrim(0.0625F);
|
||||
setLidTexture(var1.getBlockMetadata());
|
||||
barrel.renderBase(0.0625F);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@@ -58,20 +88,55 @@ public class BlockBarrelRenderer extends BlockRendererInterface{
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId,
|
||||
RenderBlocks renderer) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0, 1.05f, 0);
|
||||
GL11.glScalef(1f, 1f, 1f);
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
GL11.glRotatef(180, 0, 1, 0);
|
||||
if(ConfigClient.LegacyBarrel){
|
||||
GL11.glTranslatef(0, 0.75f, 0);
|
||||
GL11.glScalef(0.7f, 0.7f, 0.7f);
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
GL11.glRotatef(180, 0, 1, 0);
|
||||
|
||||
setWoodTexture(metadata);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
legacyModel.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(legacy_texture);
|
||||
legacyLid.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
}
|
||||
else {
|
||||
GL11.glTranslatef(0, 0.9f, 0);
|
||||
GL11.glScalef(0.9f, 0.9f, 0.9f);
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
GL11.glRotatef(180, 0, 1, 0);
|
||||
|
||||
setWoodTexture(metadata);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
barrel.renderWall(0.0625F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(trimTexture);
|
||||
barrel.renderTrim(0.0625F);
|
||||
setLidTexture(metadata);
|
||||
barrel.renderBase(0.0625F);
|
||||
}
|
||||
|
||||
setWoodTexture(metadata);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
core.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(trimTexture);
|
||||
trim.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLidTexture(int meta){
|
||||
TextureManager manager = Minecraft.getMinecraft().getTextureManager();
|
||||
if(meta == 1)
|
||||
manager.bindTexture(oak_lid);
|
||||
else if(meta == 2)
|
||||
manager.bindTexture(oak_lid);
|
||||
else if(meta == 3)
|
||||
manager.bindTexture(oak_lid);
|
||||
else if(meta == 4)
|
||||
manager.bindTexture(oak_lid);
|
||||
else if(meta == 5)
|
||||
manager.bindTexture(oak_lid);
|
||||
else
|
||||
manager.bindTexture(oak_lid);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return CustomItems.barrel.getRenderType();
|
||||
}
|
||||
|
||||
@@ -5,17 +5,29 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.blocks.BlockRotated;
|
||||
import noppes.npcs.blocks.tiles.TileColorable;
|
||||
import noppes.npcs.client.model.blocks.ModelCampfire;
|
||||
import noppes.npcs.client.model.blocks.campfire.ModelCampfireFlame;
|
||||
import noppes.npcs.client.model.blocks.campfire.ModelCampfireLog;
|
||||
import noppes.npcs.client.model.blocks.campfire.ModelCampfireStone;
|
||||
import noppes.npcs.config.ConfigClient;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
public class BlockCampfireRenderer extends BlockRendererInterface{
|
||||
|
||||
private final ModelCampfire model = new ModelCampfire();
|
||||
|
||||
// Legacy
|
||||
private final ModelCampfire legacy_model = new ModelCampfire();
|
||||
|
||||
// Modern
|
||||
private final ModelCampfireFlame flameModel = new ModelCampfireFlame();
|
||||
private final ModelCampfireLog logsModel = new ModelCampfireLog();
|
||||
private final ModelCampfireStone stonesModel = new ModelCampfireStone();
|
||||
|
||||
|
||||
public BlockCampfireRenderer(){
|
||||
((BlockRotated)CustomItems.campfire).renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
((BlockRotated)CustomItems.campfire_unlit).renderId = ((BlockRotated)CustomItems.campfire).renderId;
|
||||
@@ -29,15 +41,29 @@ public class BlockCampfireRenderer extends BlockRendererInterface{
|
||||
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(45 * tile.rotation, 0, 1, 0);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(PlanksOak);
|
||||
model.renderLog(0.0625F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(Stone);
|
||||
model.renderRock(0.0625F);
|
||||
|
||||
if(ConfigClient.LegacyCampfire){
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(PlanksOak);
|
||||
legacy_model.renderLog(0.0625F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(Stone);
|
||||
legacy_model.renderRock(0.0625F);
|
||||
}
|
||||
else {
|
||||
Block block = tile.getBlockType();
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(Logs);
|
||||
logsModel.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(Cobble);
|
||||
stonesModel.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
if(block == CustomItems.campfire){
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(Flame);
|
||||
flameModel.render(null, tile.getWorldObj().getWorldTime(), 0, 0, 0, 0.0F, 0.0625F);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@@ -51,10 +77,19 @@ public class BlockCampfireRenderer extends BlockRendererInterface{
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
GL11.glRotatef(180, 0, 1, 0);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(PlanksOak);
|
||||
model.renderLog(0.0625F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(Stone);
|
||||
model.renderRock(0.0625F);
|
||||
|
||||
if(ConfigClient.LegacyCampfire){
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(PlanksOak);
|
||||
legacy_model.renderLog(0.0625F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(Stone);
|
||||
legacy_model.renderRock(0.0625F);
|
||||
}
|
||||
else {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(Logs);
|
||||
logsModel.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(Cobble);
|
||||
stonesModel.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -24,16 +24,13 @@ public abstract class BlockRendererInterface extends TileEntitySpecialRenderer i
|
||||
protected static final ResourceLocation PlanksAcacia = new ResourceLocation("customnpcs","textures/cache/planks_acacia.png");
|
||||
protected static final ResourceLocation PlanksJungle = new ResourceLocation("customnpcs","textures/cache/planks_jungle.png");
|
||||
|
||||
|
||||
protected static final ResourceLocation MCPlanksOak = new ResourceLocation("customnpcs","textures/cache/planks_oak.png");
|
||||
protected static final ResourceLocation MCPlanksBigOak = new ResourceLocation("customnpcs","textures/cache/planks_big_oak.png");
|
||||
protected static final ResourceLocation MCPlanksSpruce = new ResourceLocation("customnpcs","textures/cache/planks_spruce.png");
|
||||
protected static final ResourceLocation MCPlanksBirch = new ResourceLocation("customnpcs","textures/cache/planks_birch.png");
|
||||
protected static final ResourceLocation MCPlanksAcacia = new ResourceLocation("customnpcs","textures/cache/planks_acacia.png");
|
||||
protected static final ResourceLocation MCPlanksJungle = new ResourceLocation("customnpcs","textures/cache/planks_jungle.png");
|
||||
|
||||
protected static final ResourceLocation Steel = new ResourceLocation("customnpcs","textures/models/Steel.png");
|
||||
protected static final RenderItem renderer = new RenderItem();
|
||||
|
||||
protected static final ResourceLocation Logs = new ResourceLocation("textures/blocks/log_oak.png");
|
||||
protected static final ResourceLocation Cobble = new ResourceLocation("textures/blocks/cobblestone.png");
|
||||
protected static final ResourceLocation Flame = new ResourceLocation("customnpcs","textures/models/flame.png");
|
||||
|
||||
protected static final RenderItem renderer = new RenderItem();
|
||||
|
||||
public static float colorTable[][] = {
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user