remove chest renderer

This commit is contained in:
Sen 2025-07-20 16:20:24 +02:00
parent e92e74336e
commit ba3e80b15c
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
14 changed files with 70 additions and 209 deletions

View file

@ -136,12 +136,7 @@ public class RenderItem
}
private void renderBuiltin(ItemStack stack) {
if(stack.getItem().getBlock() instanceof BlockChest chest) {
this.state = chest.getState().withProperty(BlockChest.FACING, Facing.SOUTH);
TileEntityRenderer.instance.renderItem(this.chest, 0.0D, 0.0D, 0.0D, 0.0F);
this.state = null;
}
else if(stack.getItem().getBlock() instanceof BlockStandingSign sign) {
if(stack.getItem().getBlock() instanceof BlockStandingSign sign) {
this.state = sign.getState().withProperty(BlockStandingSign.ROTATION, 8);
TileEntityRenderer.instance.renderItem(this.sign, 0.0D, 0.0D, 0.0D, 0.0F);
this.state = null;

View file

@ -1,42 +0,0 @@
package client.renderer.model;
public class ModelChest extends ModelBase
{
/** The chest lid in the chest's model. */
public ModelRenderer chestLid = (new ModelRenderer(this, 0, 0)).setTextureSize(64, 64);
/** The model of the bottom of the chest. */
public ModelRenderer chestBelow;
/** The chest's knob in the chest model. */
public ModelRenderer chestKnob;
public ModelChest()
{
this.chestLid.addBox(0.0F, -5.0F, -14.0F, 14, 5, 14, 0.0F);
this.chestLid.rotationPointX = 1.0F;
this.chestLid.rotationPointY = 7.0F;
this.chestLid.rotationPointZ = 15.0F;
this.chestKnob = (new ModelRenderer(this, 0, 0)).setTextureSize(64, 64);
this.chestKnob.addBox(-1.0F, -2.0F, -15.0F, 2, 4, 1, 0.0F);
this.chestKnob.rotationPointX = 8.0F;
this.chestKnob.rotationPointY = 7.0F;
this.chestKnob.rotationPointZ = 15.0F;
this.chestBelow = (new ModelRenderer(this, 0, 19)).setTextureSize(64, 64);
this.chestBelow.addBox(0.0F, 0.0F, 0.0F, 14, 10, 14, 0.0F);
this.chestBelow.rotationPointX = 1.0F;
this.chestBelow.rotationPointY = 6.0F;
this.chestBelow.rotationPointZ = 1.0F;
}
/**
* This method renders out all parts of the chest model.
*/
public void renderAll()
{
this.chestKnob.rotateAngleX = this.chestLid.rotateAngleX;
this.chestLid.render(0.0625F);
this.chestKnob.render(0.0625F);
this.chestBelow.render(0.0625F);
}
}

View file

@ -1,105 +0,0 @@
package client.renderer.tileentity;
import org.lwjgl.opengl.GL11;
import client.renderer.GlState;
import client.renderer.model.ModelChest;
import common.block.tech.BlockChest;
import common.init.BlockRegistry;
import common.init.Blocks;
import common.tileentity.TileEntityChest;
import common.world.State;
public class ChestRenderer extends TileRenderer<TileEntityChest>
{
private final ModelChest model = new ModelChest();
public ChestRenderer(TileEntityRenderer renderer) {
super(renderer);
}
public void renderTileEntityAt(TileEntityChest te, double x, double y, double z, float partialTicks, int destroyStage)
{
GlState.enableDepth();
GlState.depthFunc(GL11.GL_LEQUAL);
GlState.depthMask(true);
int i = 0;
BlockChest block = Blocks.chest;
if (te.hasWorldObj())
{
State state = te.getBlockState();
if(state.getBlock() instanceof BlockChest chest) {
i = state.getValue(BlockChest.FACING).getIndex();
block = chest;
}
}
if (destroyStage >= 0)
{
this.bindTexture(DESTROY_STAGES[destroyStage]);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPushMatrix();
GL11.glScalef(4.0F, 4.0F, 1.0F);
GL11.glTranslatef(0.0625F, 0.0625F, 0.0625F);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
else
{
this.bindTexture("textures/blocks/" + BlockRegistry.getName(block) + ".png");
}
GL11.glPushMatrix();
GlState.enableRescaleNormal();
if (destroyStage < 0)
{
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
}
GL11.glTranslatef((float)x, (float)y + 1.0F, (float)z + 1.0F);
GL11.glScalef(1.0F, -1.0F, -1.0F);
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
int j = 0;
if (i == 2)
{
j = 180;
}
if (i == 3)
{
j = 0;
}
if (i == 4)
{
j = 90;
}
if (i == 5)
{
j = -90;
}
GL11.glRotatef((float)j, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
float f = te.prevLidAngle + (te.lidAngle - te.prevLidAngle) * partialTicks;
f = 1.0F - f;
f = 1.0F - f * f * f;
this.model.chestLid.rotateAngleX = -(f * (float)Math.PI / 2.0F);
this.model.renderAll();
GlState.disableRescaleNormal();
GL11.glPopMatrix();
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
if (destroyStage >= 0)
{
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
}
}

View file

@ -32,7 +32,6 @@ public class TileEntityRenderer {
private TileEntityRenderer() {
this.renderers.put(TileEntitySign.class, new SignRenderer(this));
this.renderers.put(TileEntityDisplay.class, new DisplayRenderer(this));
this.renderers.put(TileEntityChest.class, new ChestRenderer(this));
}
private <T extends TileEntity> TileRenderer<T> getRenderer(Class<? extends TileEntity> clazz) {

View file

@ -664,8 +664,10 @@ public class WorldClient extends AWorldClient
case 2016:
TileEntity te = this.getTileEntity(blockPosIn);
if(te instanceof TileEntityChest chest)
if(te instanceof TileEntityChest chest) {
chest.setUsing(data);
this.markBlockForUpdate(blockPosIn);
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB