mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 03:47:27 +00:00
Revamped Model Table
This commit is contained in:
1 parent
a973eca54c
commit
dfb4c511cc
10 files changed
+197
-62
No files matched your search
@@ -1,53 +1,86 @@
|
||||
package noppes.npcs.client.model.blocks;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelBox;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelTable extends ModelBase {
|
||||
public ModelRenderer Shape1;
|
||||
public ModelRenderer Table;
|
||||
public ModelRenderer Shape3;
|
||||
public ModelRenderer Shape4;
|
||||
public ModelRenderer Shape5;
|
||||
public final ModelRenderer Shape1;
|
||||
private final ModelRenderer cube_r1;
|
||||
private final ModelRenderer cube_r2;
|
||||
public final ModelRenderer Shape3;
|
||||
public final ModelRenderer Shape4;
|
||||
private final ModelRenderer cube_r3;
|
||||
public final ModelRenderer Shape2;
|
||||
private final ModelRenderer cube_r4;
|
||||
public final ModelRenderer Table;
|
||||
|
||||
public ModelTable() {
|
||||
Shape1 = new ModelRenderer(this, 0, 0);
|
||||
Shape1.mirror = true;
|
||||
Shape1.addBox(-1F, 0F, -1F, 2, 14, 2);
|
||||
Shape1.setRotationPoint(-6F, 10F, 6F);
|
||||
|
||||
Table = new ModelRenderer(this, 0, 0);
|
||||
Table.addBox(0F, -2F, 0F, 16, 2, 16);
|
||||
Table.setRotationPoint(-8F, 10F, -8F);
|
||||
|
||||
Shape3 = new ModelRenderer(this, 0, 0);
|
||||
Shape3.addBox(-1F, 0F, -1F, 2, 14, 2);
|
||||
Shape3.setRotationPoint(6F, 10F, -6F);
|
||||
|
||||
Shape4 = new ModelRenderer(this, 0, 0);
|
||||
Shape4.addBox(-1F, 0F, -1F, 2, 14, 2);
|
||||
Shape4.setRotationPoint(6F, 10F, 6F);
|
||||
|
||||
Shape5 = new ModelRenderer(this, 0, 0);
|
||||
Shape5.mirror = true;
|
||||
Shape5.addBox(-1F, 0F, -1F, 2, 14, 2);
|
||||
Shape5.setRotationPoint(-6F, 10F, -6F);
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
Shape1 = new ModelRenderer(this);
|
||||
Shape1.setRotationPoint(-4.8333F, 14.8333F, 4.8333F);
|
||||
Shape1.cubeList.add(new ModelBox(Shape1, 0, 19, -2.1667F, -3.8333F, 0.1667F, 2, 13, 2, 0.0F));
|
||||
|
||||
cube_r1 = new ModelRenderer(this);
|
||||
cube_r1.setRotationPoint(-1.1667F, -1.3333F, -2.3333F);
|
||||
Shape1.addChild(cube_r1);
|
||||
setRotationAngle(cube_r1, 0.0F, 3.1416F, 0.0F);
|
||||
cube_r1.cubeList.add(new ModelBox(cube_r1, 8, 14, 0.0F, -2.5F, -2.5F, 0, 5, 5, 0.0F));
|
||||
|
||||
cube_r2 = new ModelRenderer(this);
|
||||
cube_r2.setRotationPoint(2.3333F, -1.3333F, 1.1667F);
|
||||
Shape1.addChild(cube_r2);
|
||||
setRotationAngle(cube_r2, 0.0F, 3.1416F, 0.0F);
|
||||
cube_r2.cubeList.add(new ModelBox(cube_r2, 8, 19, -2.5F, -2.5F, 0.0F, 5, 5, 0, 0.0F));
|
||||
|
||||
Shape3 = new ModelRenderer(this);
|
||||
Shape3.setRotationPoint(-6.0F, 24.0F, 6.0F);
|
||||
Shape3.cubeList.add(new ModelBox(Shape3, 8, 19, 6.0F, -13.0F, -12.0F, 5, 5, 0, 0.0F));
|
||||
Shape3.cubeList.add(new ModelBox(Shape3, 0, 19, 11.0F, -13.0F, -13.0F, 2, 13, 2, 0.0F));
|
||||
Shape3.cubeList.add(new ModelBox(Shape3, 8, 14, 12.0F, -13.0F, -11.0F, 0, 5, 5, 0.0F));
|
||||
|
||||
Shape4 = new ModelRenderer(this);
|
||||
Shape4.setRotationPoint(-6.0F, 24.0F, 6.0F);
|
||||
Shape4.cubeList.add(new ModelBox(Shape4, 8, 19, 6.0F, -13.0F, 0.0F, 5, 5, 0, 0.0F));
|
||||
Shape4.cubeList.add(new ModelBox(Shape4, 0, 19, 11.0F, -13.0F, -1.0F, 2, 13, 2, 0.0F));
|
||||
|
||||
cube_r3 = new ModelRenderer(this);
|
||||
cube_r3.setRotationPoint(12.0F, -10.5F, -3.5F);
|
||||
Shape4.addChild(cube_r3);
|
||||
setRotationAngle(cube_r3, 0.0F, 3.1416F, 0.0F);
|
||||
cube_r3.cubeList.add(new ModelBox(cube_r3, 8, 14, 0.0F, -2.5F, -2.5F, 0, 5, 5, 0.0F));
|
||||
|
||||
Shape2 = new ModelRenderer(this);
|
||||
Shape2.setRotationPoint(0.0F, 24.0F, 6.0F);
|
||||
Shape2.cubeList.add(new ModelBox(Shape2, 0, 19, -7.0F, -13.0F, -13.0F, 2, 13, 2, 0.0F));
|
||||
Shape2.cubeList.add(new ModelBox(Shape2, 8, 14, -6.0F, -13.0F, -11.0F, 0, 5, 5, 0.0F));
|
||||
|
||||
cube_r4 = new ModelRenderer(this);
|
||||
cube_r4.setRotationPoint(-2.5F, -10.5F, -12.0F);
|
||||
Shape2.addChild(cube_r4);
|
||||
setRotationAngle(cube_r4, 0.0F, 3.1416F, 0.0F);
|
||||
cube_r4.cubeList.add(new ModelBox(cube_r4, 8, 19, -2.5F, -2.5F, 0.0F, 5, 5, 0, 0.0F));
|
||||
|
||||
Table = new ModelRenderer(this);
|
||||
Table.setRotationPoint(0.0F, 24.0F, 6.0F);
|
||||
Table.cubeList.add(new ModelBox(Table, 0, 0, -8.0F, -16.0F, -14.0F, 16, 3, 16, 0.0F));
|
||||
}
|
||||
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3,
|
||||
float f4, float f5) {
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
Shape1.render(f5);
|
||||
@Override
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
Shape1.render(f5);
|
||||
Shape3.render(f5);
|
||||
Shape4.render(f5);
|
||||
Shape5.render(f5);
|
||||
Shape2.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
|
||||
modelRenderer.rotateAngleX = x;
|
||||
modelRenderer.rotateAngleY = y;
|
||||
modelRenderer.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package noppes.npcs.client.model.blocks.legacy;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelLegacyTable extends ModelBase {
|
||||
public ModelRenderer Shape1;
|
||||
public ModelRenderer Table;
|
||||
public ModelRenderer Shape3;
|
||||
public ModelRenderer Shape4;
|
||||
public ModelRenderer Shape5;
|
||||
|
||||
public ModelLegacyTable() {
|
||||
Shape1 = new ModelRenderer(this, 0, 0);
|
||||
Shape1.mirror = true;
|
||||
Shape1.addBox(-1F, 0F, -1F, 2, 14, 2);
|
||||
Shape1.setRotationPoint(-6F, 10F, 6F);
|
||||
|
||||
Table = new ModelRenderer(this, 0, 0);
|
||||
Table.addBox(0F, -2F, 0F, 16, 2, 16);
|
||||
Table.setRotationPoint(-8F, 10F, -8F);
|
||||
|
||||
Shape3 = new ModelRenderer(this, 0, 0);
|
||||
Shape3.addBox(-1F, 0F, -1F, 2, 14, 2);
|
||||
Shape3.setRotationPoint(6F, 10F, -6F);
|
||||
|
||||
Shape4 = new ModelRenderer(this, 0, 0);
|
||||
Shape4.addBox(-1F, 0F, -1F, 2, 14, 2);
|
||||
Shape4.setRotationPoint(6F, 10F, 6F);
|
||||
|
||||
Shape5 = new ModelRenderer(this, 0, 0);
|
||||
Shape5.mirror = true;
|
||||
Shape5.addBox(-1F, 0F, -1F, 2, 14, 2);
|
||||
Shape5.setRotationPoint(-6F, 10F, -6F);
|
||||
}
|
||||
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3,
|
||||
float f4, float f5) {
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
Shape1.render(f5);
|
||||
Shape3.render(f5);
|
||||
Shape4.render(f5);
|
||||
Shape5.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,25 +2,31 @@ package noppes.npcs.client.renderer.blocks;
|
||||
|
||||
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.BlockTable;
|
||||
import noppes.npcs.blocks.tiles.TileColorable;
|
||||
import noppes.npcs.client.model.blocks.ModelTable;
|
||||
import noppes.npcs.client.model.blocks.legacy.ModelLegacyTable;
|
||||
import noppes.npcs.config.ConfigClient;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class BlockTableRenderer extends BlockRendererInterface{
|
||||
|
||||
private final ModelTable model = new ModelTable();
|
||||
private static final ResourceLocation resource1 = new ResourceLocation("customnpcs","textures/cache/planks_oak.png");
|
||||
private static final ResourceLocation resource2 = new ResourceLocation("customnpcs","textures/cache/planks_big_oak.png");
|
||||
private static final ResourceLocation resource3 = new ResourceLocation("customnpcs","textures/cache/planks_spruce.png");
|
||||
private static final ResourceLocation resource4 = new ResourceLocation("customnpcs","textures/cache/planks_birch.png");
|
||||
private static final ResourceLocation resource5 = new ResourceLocation("customnpcs","textures/cache/planks_acacia.png");
|
||||
private static final ResourceLocation resource6 = new ResourceLocation("customnpcs","textures/cache/planks_jungle.png");
|
||||
|
||||
private final ModelLegacyTable legacyTable = new ModelLegacyTable();
|
||||
private final ModelTable table = new ModelTable();
|
||||
|
||||
private static final ResourceLocation oak = new ResourceLocation("customnpcs","textures/models/table/oak.png");
|
||||
private static final ResourceLocation spruce = new ResourceLocation("customnpcs","textures/models/table/spruce.png");
|
||||
private static final ResourceLocation birch = new ResourceLocation("customnpcs","textures/models/table/birch.png");
|
||||
private static final ResourceLocation jungle = new ResourceLocation("customnpcs","textures/models/table/jungle.png");
|
||||
private static final ResourceLocation acacia = new ResourceLocation("customnpcs","textures/models/table/acacia.png");
|
||||
private static final ResourceLocation dark_oak = new ResourceLocation("customnpcs","textures/models/table/dark_oak.png");
|
||||
|
||||
public BlockTableRenderer(){
|
||||
((BlockTable)CustomItems.table).renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(this);
|
||||
@@ -39,15 +45,29 @@ public class BlockTableRenderer extends BlockRendererInterface{
|
||||
boolean east = var1.getWorldObj().getBlock(var1.xCoord, var1.yCoord, var1.zCoord + 1) == CustomItems.table;
|
||||
boolean west = var1.getWorldObj().getBlock(var1.xCoord, var1.yCoord, var1.zCoord - 1) == CustomItems.table;
|
||||
|
||||
model.Shape1.showModel = !south && !east;
|
||||
model.Shape3.showModel = !north && !west;
|
||||
model.Shape4.showModel = !north && !east;
|
||||
model.Shape5.showModel = !south && !west;
|
||||
|
||||
setWoodTexture(var1.getBlockMetadata());
|
||||
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
GL11.glRotatef(90 * tile.rotation, 0, 1, 0);
|
||||
model.Table.render(0.0625f);
|
||||
legacyTable.Shape1.showModel = !south && !east;
|
||||
legacyTable.Shape3.showModel = !north && !west;
|
||||
legacyTable.Shape4.showModel = !north && !east;
|
||||
legacyTable.Shape5.showModel = !south && !west;
|
||||
|
||||
table.Shape1.showModel = !south && !east;
|
||||
table.Shape2.showModel = !south && !west;
|
||||
table.Shape3.showModel = !north && !west;
|
||||
table.Shape4.showModel = !north && !east;
|
||||
|
||||
if(ConfigClient.LegacyTable){
|
||||
setWoodTexture(var1.getBlockMetadata());
|
||||
legacyTable.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
GL11.glRotatef(90 * tile.rotation, 0, 1, 0);
|
||||
legacyTable.Table.render(0.0625f);
|
||||
} else {
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
setTableTexture(var1.getBlockMetadata());
|
||||
table.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
GL11.glRotatef(90 * tile.rotation, 0, 1, 0);
|
||||
table.Table.render(0.0625f);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@@ -60,18 +80,45 @@ public class BlockTableRenderer extends BlockRendererInterface{
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
GL11.glRotatef(180, 0, 1, 0);
|
||||
|
||||
setWoodTexture(metadata);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
model.Table.render(0.0625f);
|
||||
model.Shape1.showModel = true;
|
||||
model.Shape3.showModel = true;
|
||||
model.Shape4.showModel = true;
|
||||
model.Shape5.showModel = true;
|
||||
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
|
||||
if(ConfigClient.LegacyTable){
|
||||
setWoodTexture(metadata);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
legacyTable.Table.render(0.0625f);
|
||||
legacyTable.Shape1.showModel = true;
|
||||
legacyTable.Shape3.showModel = true;
|
||||
legacyTable.Shape4.showModel = true;
|
||||
legacyTable.Shape5.showModel = true;
|
||||
legacyTable.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
} else {
|
||||
setTableTexture(metadata);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
table.Table.render(0.0625f);
|
||||
table.Shape1.showModel = true;
|
||||
table.Shape2.showModel = true;
|
||||
table.Shape3.showModel = true;
|
||||
table.Shape4.showModel = true;
|
||||
table.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void setTableTexture(int meta){
|
||||
TextureManager manager = Minecraft.getMinecraft().getTextureManager();
|
||||
if(meta == 1)
|
||||
manager.bindTexture(spruce);
|
||||
else if(meta == 2)
|
||||
manager.bindTexture(birch);
|
||||
else if(meta == 3)
|
||||
manager.bindTexture(jungle);
|
||||
else if(meta == 4)
|
||||
manager.bindTexture(acacia);
|
||||
else if(meta == 5)
|
||||
manager.bindTexture(dark_oak);
|
||||
else
|
||||
manager.bindTexture(oak);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return CustomItems.table.getRenderType();
|
||||
|
||||
@@ -86,6 +86,7 @@ public class ConfigClient
|
||||
public static boolean LegacyBanner = false;
|
||||
public static boolean LegacyChair = false;
|
||||
public static boolean LegacyStool = false;
|
||||
public static boolean LegacyTable = false;
|
||||
public static boolean LegacyBarrel = false;
|
||||
public static boolean LegacyCarpentryBench = false;
|
||||
|
||||
@@ -152,6 +153,7 @@ public class ConfigClient
|
||||
LegacyBarrel = config.get(MODEL, "Legacy Barrel Model", false).getBoolean(false);
|
||||
LegacyChair = config.get(MODEL, "Legacy Chair Model", false).getBoolean(false);
|
||||
LegacyStool = config.get(MODEL, "Legacy Stool Model", false).getBoolean(false);
|
||||
LegacyTable = config.get(MODEL, "Legacy Table Model", false).getBoolean(false);
|
||||
LegacyCarpentryBench = config.get(MODEL, "Legacy Carpentry Bench Model", false).getBoolean(false);
|
||||
|
||||
// Convert to Legacy
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 986 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 840 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1015 B |
Binary file not shown.
|
After Width: | Height: | Size: 961 B |
Reference in new issue
Block a user