1
0
Fork 0

eliminate special render types except liquids

This commit is contained in:
Sen 2025-07-20 17:59:51 +02:00
parent 1b52b26f15
commit 028156c6a6
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
18 changed files with 108 additions and 264 deletions

View file

@ -4,34 +4,24 @@ import org.lwjgl.opengl.GL11;
import client.renderer.Drawing;
import client.renderer.GlState;
import client.renderer.model.ModelSign;
import common.block.tile.BlockStandingSign;
import common.block.tile.BlockWallSign;
import common.init.Blocks;
import common.tileentity.TileEntitySign;
import common.world.State;
public class SignRenderer extends TileRenderer<TileEntitySign>
public class SignRenderer extends ElementRenderer<TileEntitySign>
{
private static final String SIGN_TEXTURE = "textures/blocks/sign.png";
private final ModelSign model = new ModelSign();
public SignRenderer(TileEntityRenderer renderer) {
super(renderer);
}
public void renderTileEntityAt(TileEntitySign te, double x, double y, double z, float partialTicks, int destroyStage)
public void renderElements(TileEntitySign te, double x, double y, double z, float partialTicks)
{
GL11.glPushMatrix();
float f = 0.6666667F;
State state = te.getBlockState();
if (state.getBlock() == Blocks.sign)
if (state.getBlock() instanceof BlockStandingSign)
{
GL11.glTranslatef((float)x + 0.5F, (float)y + 0.75F * f, (float)z + 0.5F);
int r = state.getBlock() == Blocks.sign ? state.getValue(BlockWallSign.FACING).getIndex() : 0;
int r = state.getValue(BlockStandingSign.FACING).getIndex();
float f1 = 0.0F;
if (r == 2)
@ -49,11 +39,11 @@ public class SignRenderer extends TileRenderer<TileEntitySign>
f1 = -90.0F;
}
GL11.glRotatef(-f1, 0.0F, 1.0F, 0.0F);
this.model.signStick.showModel = true;
GL11.glTranslatef(0.0F, f * -0.0625f * 2.0f, 0.0F);
}
else
{
int k = state.getBlock() == Blocks.wall_sign ? state.getValue(BlockWallSign.FACING).getIndex() : 0;
int k = state.getBlock() instanceof BlockWallSign ? state.getValue(BlockWallSign.FACING).getIndex() : 0;
float f2 = 0.0F;
if (k == 2)
@ -73,72 +63,30 @@ public class SignRenderer extends TileRenderer<TileEntitySign>
GL11.glTranslatef((float)x + 0.5F, (float)y + 0.75F * f, (float)z + 0.5F);
GL11.glRotatef(-f2, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(0.0F, -0.3125F, -0.4375F);
this.model.signStick.showModel = false;
}
if (destroyStage >= 0)
{
this.bindTexture(DESTROY_STAGES[destroyStage]);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPushMatrix();
GL11.glScalef(4.0F, 2.0F, 1.0F);
GL11.glTranslatef(0.0625F, 0.0625F, 0.0625F);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
else
{
this.bindTexture(SIGN_TEXTURE);
GL11.glTranslatef(0.0F, -0.3125F - f * 0.0625f * 0.5f, -0.4375F);
}
GlState.enableRescaleNormal();
GL11.glPushMatrix();
GL11.glScalef(f, -f, -f);
this.model.renderSign();
GL11.glPopMatrix();
// FontRenderer fontrenderer = this.getFontRenderer();
float f3 = 0.015625F * f;
GL11.glTranslatef(0.0F, 0.5F * f, 0.07F * f);
GL11.glTranslatef(0.0F, 0.5F * f, 0.1F * f);
GL11.glScalef(f3, -f3, f3);
GL11.glNormal3f(0.0F, 0.0F, -1.0F * f3);
GlState.depthMask(false);
int i = 0;
if (destroyStage < 0)
for (int j = 0; j < te.text.length; ++j)
{
for (int j = 0; j < te.signText.length; ++j)
if (te.text[j] != null && !te.text[j].isEmpty())
{
if (te.signText[j] != null)
{
// Text ichatcomponent = new Text(te.signText[j]);
// List<Text> list = ichatcomponent.split(90, false);
String s = te.signText[j].length() > 50 ? te.signText[j].substring(0, 50) : te.signText[j]; // list != null && list.size() > 0 ? ((Text)list.get(0)).getFormattedText() : "";
// if (j == te.lineBeingEdited)
// {
// s = "> " + s + " <";
// SKC.drawString(s, -SKC.getStringWidth(s) / 2, j * 10 - te.signText.length * 5, i);
// }
// else
// {
GL11.glPushMatrix();
GL11.glScalef(0.75f, 0.75f, 0.75f);
Drawing.drawTextCenteredN(s, 0, j * (18 - 3) - 30, 0xff000000);
GL11.glPopMatrix();
// }
}
String s = te.text[j].length() > 50 ? te.text[j].substring(0, 50) : te.text[j];
GL11.glPushMatrix();
GL11.glScalef(0.75f, 0.75f, 0.75f);
Drawing.drawTextCenteredN(s, 0, j * (18 - 3) - 30, 0xff000000);
GL11.glPopMatrix();
}
}
GlState.depthMask(true);
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glPopMatrix();
if (destroyStage >= 0)
{
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
}
}