From 028156c6a68aa9ceddc36e09e24a3cb8044d72c1 Mon Sep 17 00:00:00 2001 From: Sen Date: Sun, 20 Jul 2025 17:59:51 +0200 Subject: [PATCH] eliminate special render types except liquids --- .../java/client/network/ClientPlayer.java | 4 +- .../java/client/renderer/BlockRenderer.java | 2 - .../java/client/renderer/RenderGlobal.java | 59 +++++-------- .../client/renderer/chunk/RenderChunk.java | 6 +- .../client/renderer/entity/RenderItem.java | 34 +------- .../java/client/renderer/model/ModelSign.java | 26 ------ .../renderer/tileentity/DisplayRenderer.java | 8 +- .../renderer/tileentity/ElementRenderer.java | 11 +++ .../renderer/tileentity/SignRenderer.java | 82 ++++--------------- ...tityRenderer.java => SpecialRenderer.java} | 43 ++++------ .../renderer/tileentity/TileRenderer.java | 30 ------- .../block/artificial/BlockFloorPortal.java | 4 - .../java/common/block/tech/BlockChest.java | 22 ++--- .../java/common/block/tile/BlockSign.java | 8 -- .../common/block/tile/BlockStandingSign.java | 10 +++ .../java/common/block/tile/BlockWallSign.java | 13 ++- .../common/tileentity/TileEntitySign.java | 8 +- .../src/main/java/server/network/Player.java | 2 +- 18 files changed, 108 insertions(+), 264 deletions(-) delete mode 100755 client/src/main/java/client/renderer/model/ModelSign.java create mode 100755 client/src/main/java/client/renderer/tileentity/ElementRenderer.java rename client/src/main/java/client/renderer/tileentity/{TileEntityRenderer.java => SpecialRenderer.java} (51%) delete mode 100755 client/src/main/java/client/renderer/tileentity/TileRenderer.java diff --git a/client/src/main/java/client/network/ClientPlayer.java b/client/src/main/java/client/network/ClientPlayer.java index ebdd80c6..0bd8dc79 100755 --- a/client/src/main/java/client/network/ClientPlayer.java +++ b/client/src/main/java/client/network/ClientPlayer.java @@ -1281,7 +1281,7 @@ public class ClientPlayer implements IClientPlayer tileentity.setPos(packetIn.getSignPosition()); } - this.gm.show(new GuiSign(packetIn.getSignPosition(), ((TileEntitySign)tileentity).signText)); + this.gm.show(new GuiSign(packetIn.getSignPosition(), ((TileEntitySign)tileentity).text)); } public void handleForm(SPacketDisplayForm packet) { @@ -1305,7 +1305,7 @@ public class ClientPlayer implements IClientPlayer { // if (tileentitysign.getIsEditable()) // { - System.arraycopy(packetIn.getLines(), 0, tileentitysign.signText, 0, 4); + System.arraycopy(packetIn.getLines(), 0, tileentitysign.text, 0, 4); // tileentitysign.command = packetIn.getCommand(); tileentitysign.markDirty(); // } diff --git a/client/src/main/java/client/renderer/BlockRenderer.java b/client/src/main/java/client/renderer/BlockRenderer.java index 8b48f6f6..04d4c33b 100755 --- a/client/src/main/java/client/renderer/BlockRenderer.java +++ b/client/src/main/java/client/renderer/BlockRenderer.java @@ -76,8 +76,6 @@ public class BlockRenderer { case 1: return this.renderFluid(blockAccess, state, pos, worldRendererIn); - case 2: - return false; case 3: IBakedModel ibakedmodel = this.getModelFromBlockState(state, blockAccess, pos); return this.renderBase(blockAccess, ibakedmodel, state, pos, worldRendererIn, !this.gm.xrayActive); diff --git a/client/src/main/java/client/renderer/RenderGlobal.java b/client/src/main/java/client/renderer/RenderGlobal.java index f159f56d..6fc93a80 100755 --- a/client/src/main/java/client/renderer/RenderGlobal.java +++ b/client/src/main/java/client/renderer/RenderGlobal.java @@ -24,19 +24,16 @@ import client.renderer.entity.RenderManager; import client.renderer.texture.Sprite; import client.renderer.texture.TextureManager; import client.renderer.texture.TextureMap; -import client.renderer.tileentity.TileEntityRenderer; +import client.renderer.tileentity.SpecialRenderer; import client.world.ChunkClient; import client.world.WorldClient; import common.block.Block; -import common.block.tech.BlockChest; -import common.block.tile.BlockSign; import common.collect.Lists; import common.collect.Maps; import common.collect.Sets; import common.dimension.DimType; import common.entity.Entity; import common.entity.npc.EntityNPC; -import common.entity.projectile.EntityBox; import common.entity.types.EntityLiving; import common.init.Blocks; import common.model.BlockLayer; @@ -495,7 +492,7 @@ public class RenderGlobal double d0 = renderViewEntity.prevX + (renderViewEntity.posX - renderViewEntity.prevX) * (double)partialTicks; double d1 = renderViewEntity.prevY + (renderViewEntity.posY - renderViewEntity.prevY) * (double)partialTicks; double d2 = renderViewEntity.prevZ + (renderViewEntity.posZ - renderViewEntity.prevZ) * (double)partialTicks; - TileEntityRenderer.instance.setPosition(this.theWorld, this.gm.getTextureManager(), this.gm.getRenderViewEntity(), partialTicks); + SpecialRenderer.instance.setPosition(this.theWorld, this.gm.getRenderViewEntity(), partialTicks); this.renderManager.cacheActiveRenderInfo(this.theWorld, this.gm.getRenderViewEntity(), this.gm.getPointedEntity(), this.gm, partialTicks); this.countEntitiesTotal = 0; this.countEntitiesRendered = 0; @@ -504,9 +501,9 @@ public class RenderGlobal double d3 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; double d4 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; double d5 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks; - TileEntityRenderer.entityX = d3; - TileEntityRenderer.entityY = d4; - TileEntityRenderer.entityZ = d5; + SpecialRenderer.entityX = d3; + SpecialRenderer.entityY = d4; + SpecialRenderer.entityZ = d5; this.renderManager.setRenderPosition(d3, d4, d5); this.gm.entityRenderer.enableLightmap(); List list = this.theWorld.getLoadedEntityList(); @@ -661,7 +658,7 @@ public class RenderGlobal { for (TileEntity tileentity2 : list1) { - TileEntityRenderer.instance.renderTile(tileentity2, partialTicks, -1); + SpecialRenderer.instance.renderTile(tileentity2, partialTicks); } } } @@ -670,25 +667,10 @@ public class RenderGlobal { for (TileEntity tileentity : this.setTileEntities) { - TileEntityRenderer.instance.renderTile(tileentity, partialTicks, -1); + SpecialRenderer.instance.renderTile(tileentity, partialTicks); } } - this.preRenderDamagedBlocks(); - - for (DestroyBlockProgress destroyblockprogress : this.damagedBlocks.values()) - { - BlockPos blockpos = destroyblockprogress.getPosition(); - TileEntity tileentity1 = this.theWorld.getTileEntity(blockpos); - Block block = this.theWorld.getState(blockpos).getBlock(); - - if (tileentity1 != null && block instanceof BlockSign) - { - TileEntityRenderer.instance.renderTile(tileentity1, partialTicks, destroyblockprogress.getPartialBlockDamage()); - } - } - - this.postRenderDamagedBlocks(); this.gm.entityRenderer.disableLightmap(); } } @@ -1565,23 +1547,20 @@ public class RenderGlobal double d5 = (double)blockpos.getZ() - d2; Block block = this.theWorld.getState(blockpos).getBlock(); - if (!(block instanceof BlockSign)) + if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) { - if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) - { - iterator.remove(); - } - else - { - State iblockstate = this.theWorld.getState(blockpos); + iterator.remove(); + } + else + { + State iblockstate = this.theWorld.getState(blockpos); - if (iblockstate.getBlock() != Blocks.air) - { - int i = destroyblockprogress.getPartialBlockDamage(); - Sprite textureatlassprite = this.destroyBlockIcons[i]; - BlockRenderer blockrendererdispatcher = this.gm.getBlockRendererDispatcher(); - blockrendererdispatcher.renderBlockDamage(iblockstate, blockpos, textureatlassprite, this.theWorld); - } + if (iblockstate.getBlock() != Blocks.air) + { + int i = destroyblockprogress.getPartialBlockDamage(); + Sprite textureatlassprite = this.destroyBlockIcons[i]; + BlockRenderer blockrendererdispatcher = this.gm.getBlockRendererDispatcher(); + blockrendererdispatcher.renderBlockDamage(iblockstate, blockpos, textureatlassprite, this.theWorld); } } } diff --git a/client/src/main/java/client/renderer/chunk/RenderChunk.java b/client/src/main/java/client/renderer/chunk/RenderChunk.java index be0c25ed..8213aeb2 100755 --- a/client/src/main/java/client/renderer/chunk/RenderChunk.java +++ b/client/src/main/java/client/renderer/chunk/RenderChunk.java @@ -17,8 +17,8 @@ import client.renderer.RegionRenderCache; import client.renderer.RenderBuffer; import client.renderer.RenderGlobal; import client.renderer.VertexBuffer; -import client.renderer.tileentity.TileEntityRenderer; -import client.renderer.tileentity.TileRenderer; +import client.renderer.tileentity.SpecialRenderer; +import client.renderer.tileentity.ElementRenderer; import client.world.WorldClient; import common.block.Block; import common.block.ITileEntityProvider; @@ -157,7 +157,7 @@ public class RenderChunk if (block instanceof ITileEntityProvider) { TileEntity tileentity = iblockaccess.getTileEntity(new BlockPos(blockpos$mutableblockpos)); - TileRenderer tileentityspecialrenderer = TileEntityRenderer.instance.getRenderer(tileentity); + ElementRenderer tileentityspecialrenderer = SpecialRenderer.instance.getRenderer(tileentity); if (tileentity != null && tileentityspecialrenderer != null) { diff --git a/client/src/main/java/client/renderer/entity/RenderItem.java b/client/src/main/java/client/renderer/entity/RenderItem.java index 222cdb5f..d31bd898 100755 --- a/client/src/main/java/client/renderer/entity/RenderItem.java +++ b/client/src/main/java/client/renderer/entity/RenderItem.java @@ -4,7 +4,6 @@ import java.util.List; import org.lwjgl.opengl.GL11; -import client.Client; import client.renderer.DefaultVertexFormats; import client.renderer.GlState; import client.renderer.ItemModelMesher; @@ -17,9 +16,6 @@ import client.renderer.layers.LayerArmor; import client.renderer.model.ModelHorse; import client.renderer.texture.TextureManager; import client.renderer.texture.TextureMap; -import client.renderer.tileentity.TileEntityRenderer; -import common.block.tech.BlockChest; -import common.block.tile.BlockStandingSign; import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; import common.item.Item; @@ -28,11 +24,8 @@ import common.item.WieldType; import common.item.material.ItemArmor; import common.item.material.ItemHorseArmor; import common.model.Transform; -import common.tileentity.TileEntityChest; -import common.tileentity.TileEntitySign; import common.util.Facing; import common.util.Vec3i; -import common.world.State; public class RenderItem { @@ -40,25 +33,6 @@ public class RenderItem private final ItemModelMesher mesher; private final TextureManager manager; - private final TileEntityChest chest = new TileEntityChest(0) { - public boolean hasWorldObj() { - return true; - } - - public State getBlockState() { - return RenderItem.this.state; - } - }; - - private final TileEntitySign sign = new TileEntitySign() { - public boolean hasWorldObj() { - return true; - } - - public State getBlockState() { - return RenderItem.this.state; - } - }; private final LayerArmor armor = new LayerArmor(null, 12, 12) { public ItemStack getCurrentArmor(EntityLiving entitylivingbaseIn, int armorSlot) { return ((ItemArmor)RenderItem.this.stack.getItem()).armorType.getIndex() == armorSlot ? RenderItem.this.stack : null; @@ -66,7 +40,6 @@ public class RenderItem }; private final ModelHorse horse = new ModelHorse(); - private State state; private ItemStack stack; public float zLevel; @@ -136,12 +109,7 @@ public class RenderItem } private void renderBuiltin(ItemStack stack) { - if(stack.getItem().getBlock() instanceof BlockStandingSign sign) { - this.state = sign.getState(); - TileEntityRenderer.instance.renderItem(this.sign, 0.0D, 0.0D, 0.0D, 0.0F); - this.state = null; - } - else if(stack.getItem() instanceof ItemArmor armor) { + if(stack.getItem() instanceof ItemArmor armor) { this.stack = stack; GL11.glPushMatrix(); float offset = 0.0f; diff --git a/client/src/main/java/client/renderer/model/ModelSign.java b/client/src/main/java/client/renderer/model/ModelSign.java deleted file mode 100755 index 3685860a..00000000 --- a/client/src/main/java/client/renderer/model/ModelSign.java +++ /dev/null @@ -1,26 +0,0 @@ -package client.renderer.model; - -public class ModelSign extends ModelBase -{ - /** The board on a sign that has the writing on it. */ - public ModelRenderer signBoard = new ModelRenderer(this, 0, 0); - - /** The stick a sign stands on. */ - public ModelRenderer signStick; - - public ModelSign() - { - this.signBoard.addBox(-12.0F, -14.0F, -1.0F, 24, 12, 2, 0.0F); - this.signStick = new ModelRenderer(this, 0, 14); - this.signStick.addBox(-1.0F, -2.0F, -1.0F, 2, 14, 2, 0.0F); - } - - /** - * Renders the sign model through TileEntitySignRenderer - */ - public void renderSign() - { - this.signBoard.render(0.0625F); - this.signStick.render(0.0625F); - } -} diff --git a/client/src/main/java/client/renderer/tileentity/DisplayRenderer.java b/client/src/main/java/client/renderer/tileentity/DisplayRenderer.java index 2fbd85db..da491bbb 100644 --- a/client/src/main/java/client/renderer/tileentity/DisplayRenderer.java +++ b/client/src/main/java/client/renderer/tileentity/DisplayRenderer.java @@ -17,7 +17,7 @@ import common.util.BlockPos; import common.util.Facing; import common.world.State; -public class DisplayRenderer extends TileRenderer { +public class DisplayRenderer extends ElementRenderer { private static class TimedTexture { public long time; public long updated; @@ -78,12 +78,8 @@ public class DisplayRenderer extends TileRenderer { tex.time = System.currentTimeMillis(); return tex.texture; } - - public DisplayRenderer(TileEntityRenderer renderer) { - super(renderer); - } - public void renderTileEntityAt(TileEntityDisplay te, double x, double y, double z, float partialTicks, int destroyStage) { + public void renderElements(TileEntityDisplay te, double x, double y, double z, float partialTicks) { Block block = te.getBlockType(); State state = te.getBlockState(); diff --git a/client/src/main/java/client/renderer/tileentity/ElementRenderer.java b/client/src/main/java/client/renderer/tileentity/ElementRenderer.java new file mode 100755 index 00000000..d43cc105 --- /dev/null +++ b/client/src/main/java/client/renderer/tileentity/ElementRenderer.java @@ -0,0 +1,11 @@ +package client.renderer.tileentity; + +import common.tileentity.TileEntity; + +public abstract class ElementRenderer { + public abstract void renderElements(T te, double x, double y, double z, float partial); + + public boolean isAlwaysRendered() { + return false; + } +} diff --git a/client/src/main/java/client/renderer/tileentity/SignRenderer.java b/client/src/main/java/client/renderer/tileentity/SignRenderer.java index ccb779f4..0ca5e823 100755 --- a/client/src/main/java/client/renderer/tileentity/SignRenderer.java +++ b/client/src/main/java/client/renderer/tileentity/SignRenderer.java @@ -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 +public class SignRenderer extends ElementRenderer { - 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 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 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 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); - } } } diff --git a/client/src/main/java/client/renderer/tileentity/TileEntityRenderer.java b/client/src/main/java/client/renderer/tileentity/SpecialRenderer.java similarity index 51% rename from client/src/main/java/client/renderer/tileentity/TileEntityRenderer.java rename to client/src/main/java/client/renderer/tileentity/SpecialRenderer.java index 5728e0c9..cfd0393c 100755 --- a/client/src/main/java/client/renderer/tileentity/TileEntityRenderer.java +++ b/client/src/main/java/client/renderer/tileentity/SpecialRenderer.java @@ -5,7 +5,6 @@ import java.util.Map; import org.lwjgl.opengl.GL13; import client.renderer.GlState; -import client.renderer.texture.TextureManager; import client.world.WorldClient; import common.collect.Maps; import common.entity.Entity; @@ -14,47 +13,45 @@ import common.tileentity.TileEntityDisplay; import common.tileentity.TileEntitySign; import common.util.BlockPos; -public class TileEntityRenderer { - public static TileEntityRenderer instance = new TileEntityRenderer(); - public static double entityX; // TODO: useless, duplicate render view entity position? +public class SpecialRenderer { + public static SpecialRenderer instance = new SpecialRenderer(); + public static double entityX; // TODO: useless duplicate render view entity position? public static double entityY; public static double entityZ; - private final Map, TileRenderer> renderers = Maps., TileRenderer>newHashMap(); + private final Map, ElementRenderer> renderers = Maps., ElementRenderer>newHashMap(); - public TextureManager manager; private WorldClient world; private double posX; private double posY; private double posZ; - private TileEntityRenderer() { - this.renderers.put(TileEntitySign.class, new SignRenderer(this)); - this.renderers.put(TileEntityDisplay.class, new DisplayRenderer(this)); + private SpecialRenderer() { + this.renderers.put(TileEntitySign.class, new SignRenderer()); + this.renderers.put(TileEntityDisplay.class, new DisplayRenderer()); } - private TileRenderer getRenderer(Class clazz) { - TileRenderer renderer = (TileRenderer)this.renderers.get(clazz); + private ElementRenderer getRenderer(Class clazz) { + ElementRenderer renderer = (ElementRenderer)this.renderers.get(clazz); if(renderer == null && clazz != TileEntity.class) { renderer = this.getRenderer((Class)clazz.getSuperclass()); this.renderers.put(clazz, renderer); } - return (TileRenderer)renderer; + return (ElementRenderer)renderer; } - public TileRenderer getRenderer(TileEntity tile) { - return (TileRenderer)(tile == null ? null : this.getRenderer(tile.getClass())); + public ElementRenderer getRenderer(TileEntity tile) { + return (ElementRenderer)(tile == null ? null : this.getRenderer(tile.getClass())); } - public void setPosition(WorldClient world, TextureManager manager, Entity entity, float partial) { + public void setPosition(WorldClient world, Entity entity, float partial) { this.world = world; - this.manager = manager; this.posX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partial; this.posY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partial; this.posZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partial; } - public void renderTile(TileEntity tile, float partial, int destroy) { + public void renderTile(TileEntity tile, float partial) { if(tile.getDistanceSq(this.posX, this.posY, this.posZ) < tile.getMaxRenderDistanceSquared()) { int light = this.world.getCombinedLight(tile.getPos(), 0); int block = light % 65536; @@ -62,17 +59,13 @@ public class TileEntityRenderer { GL13.glMultiTexCoord2f(GL13.GL_TEXTURE1, (float)block / 1.0F, (float)sky / 1.0F); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); BlockPos pos = tile.getPos(); - this.render(tile, (double)pos.getX() - entityX, (double)pos.getY() - entityY, (double)pos.getZ() - entityZ, partial, destroy); + this.render(tile, (double)pos.getX() - entityX, (double)pos.getY() - entityY, (double)pos.getZ() - entityZ, partial); } } - public void renderItem(TileEntity tile, double x, double y, double z, float partial) { - this.render(tile, x, y, z, partial, -1); - } - - private void render(TileEntity tile, double x, double y, double z, float partial, int destroy) { - TileRenderer renderer = this.getRenderer(tile); + private void render(TileEntity tile, double x, double y, double z, float partial) { + ElementRenderer renderer = this.getRenderer(tile); if(renderer != null) - renderer.renderTileEntityAt(tile, x, y, z, partial, destroy); + renderer.renderElements(tile, x, y, z, partial); } } diff --git a/client/src/main/java/client/renderer/tileentity/TileRenderer.java b/client/src/main/java/client/renderer/tileentity/TileRenderer.java deleted file mode 100755 index 1718637f..00000000 --- a/client/src/main/java/client/renderer/tileentity/TileRenderer.java +++ /dev/null @@ -1,30 +0,0 @@ -package client.renderer.tileentity; - -import client.renderer.texture.TextureManager; -import common.tileentity.TileEntity; - -public abstract class TileRenderer { - protected static final String[] DESTROY_STAGES = new String[] { - "textures/blocks/destroy_stage_0.png", "textures/blocks/destroy_stage_1.png", "textures/blocks/destroy_stage_2.png", "textures/blocks/destroy_stage_3.png", - "textures/blocks/destroy_stage_4.png", "textures/blocks/destroy_stage_5.png", "textures/blocks/destroy_stage_6.png", "textures/blocks/destroy_stage_7.png", - "textures/blocks/destroy_stage_8.png", "textures/blocks/destroy_stage_9.png" - }; - - private final TileEntityRenderer renderer; - - public TileRenderer(TileEntityRenderer renderer) { - this.renderer = renderer; - } - - public abstract void renderTileEntityAt(T te, double x, double y, double z, float partialTicks, int destroyStage); - - protected final void bindTexture(String location) { - TextureManager manager = this.renderer.manager; - if(manager != null) - manager.bindTexture(location); - } - - public boolean isAlwaysRendered() { - return false; - } -} diff --git a/common/src/main/java/common/block/artificial/BlockFloorPortal.java b/common/src/main/java/common/block/artificial/BlockFloorPortal.java index 6c69349e..0f48d034 100755 --- a/common/src/main/java/common/block/artificial/BlockFloorPortal.java +++ b/common/src/main/java/common/block/artificial/BlockFloorPortal.java @@ -147,10 +147,6 @@ public class BlockFloorPortal extends Block map.put("floor_portal", 5); } - public String getFallbackTexture() { - return "obsidian"; - } - protected boolean hasRegisteredItem() { return false; } diff --git a/common/src/main/java/common/block/tech/BlockChest.java b/common/src/main/java/common/block/tech/BlockChest.java index 24d9e2c3..6edc3c64 100755 --- a/common/src/main/java/common/block/tech/BlockChest.java +++ b/common/src/main/java/common/block/tech/BlockChest.java @@ -262,11 +262,11 @@ public class BlockChest extends Block implements ITileEntityProvider, Rotatable .w(name + "_side").noCull() .e(name + "_side").noCull() .add(7, 7, 0, 9, 11, 1) - .d(name + "_handle").uv(7, 8, 9, 9).noCull() - .u(name + "_handle").uv(7, 5, 9, 6).noCull() - .n(name + "_handle").noCull() - .w(name + "_handle").uv(8, 5, 9, 9).noCull() - .e(name + "_handle").uv(7, 5, 8, 9).noCull() + .d("chest_handle").uv(7, 8, 9, 9).noCull() + .u("chest_handle").uv(7, 5, 9, 6).noCull() + .n("chest_handle").noCull() + .w("chest_handle").uv(8, 5, 9, 9).noCull() + .e("chest_handle").uv(7, 5, 8, 9).noCull() .rotate(ModelRotation.getNorthRot(state.getValue(FACING))) : provider.getModel(name + "_top") .add(1, 0, 1, 15, 10, 15) @@ -284,12 +284,12 @@ public class BlockChest extends Block implements ITileEntityProvider, Rotatable .w(name + "_side").uv(1, 2, 15, 7).rot(90).noCull() .e(name + "_side").uv(1, 2, 15, 7).rot(270).noCull() .add(7, 23, 13, 9, 24, 17) - .n(name + "_handle").uv(7, 8, 9, 9).noCull() - .s(name + "_handle").uv(7, 5, 9, 6).rot(180).noCull() - .u(name + "_handle").uv(7, 5, 9, 9).rot(180).noCull() - .d(name + "_handle").uv(9, 5, 7, 9).noCull() - .w(name + "_handle").uv(8, 5, 9, 9).rot(90).noCull() - .e(name + "_handle").uv(7, 5, 8, 9).rot(270).noCull() + .n("chest_handle").uv(7, 8, 9, 9).noCull() + .s("chest_handle").uv(7, 5, 9, 6).rot(180).noCull() + .u("chest_handle").uv(7, 5, 9, 9).rot(180).noCull() + .d("chest_handle").uv(9, 5, 7, 9).noCull() + .w("chest_handle").uv(8, 5, 9, 9).rot(90).noCull() + .e("chest_handle").uv(7, 5, 8, 9).rot(270).noCull() .rotate(ModelRotation.getNorthRot(state.getValue(FACING))); } } diff --git a/common/src/main/java/common/block/tile/BlockSign.java b/common/src/main/java/common/block/tile/BlockSign.java index 4df94dca..5477c6f2 100755 --- a/common/src/main/java/common/block/tile/BlockSign.java +++ b/common/src/main/java/common/block/tile/BlockSign.java @@ -142,12 +142,4 @@ public class BlockSign extends Block implements ITileEntityProvider, Rotatable { return true; } - - public String getFallbackTexture() { - return "oak_planks"; - } - - public int getRenderType() { - return 2; - } } diff --git a/common/src/main/java/common/block/tile/BlockStandingSign.java b/common/src/main/java/common/block/tile/BlockStandingSign.java index 4d79958d..0ba855f3 100755 --- a/common/src/main/java/common/block/tile/BlockStandingSign.java +++ b/common/src/main/java/common/block/tile/BlockStandingSign.java @@ -6,6 +6,9 @@ import common.entity.npc.EntityNPC; import common.init.Blocks; import common.item.CheatTab; import common.item.ItemStack; +import common.model.Model; +import common.model.ModelProvider; +import common.model.ModelRotation; import common.properties.PropertyInteger; import common.tileentity.TileEntity; import common.tileentity.TileEntitySign; @@ -101,4 +104,11 @@ public class BlockStandingSign extends BlockSign implements Rotatable { return side != Facing.DOWN && worldIn.getState(pos).getBlock().getMaterial().isSolid(); } + + public Model getModel(ModelProvider provider, String name, State state) { + return provider.getModel("oak_planks") + .add(0, 8, 7, 16, 16, 9).all().noCull() + .add(7, 0, 7, 9, 8, 9).all().noCull() + .rotate(ModelRotation.getNorthRot(state.getValue(FACING))); + } } diff --git a/common/src/main/java/common/block/tile/BlockWallSign.java b/common/src/main/java/common/block/tile/BlockWallSign.java index 100c378f..a32cba78 100755 --- a/common/src/main/java/common/block/tile/BlockWallSign.java +++ b/common/src/main/java/common/block/tile/BlockWallSign.java @@ -2,6 +2,9 @@ package common.block.tile; import common.block.Block; import common.block.Rotatable; +import common.model.Model; +import common.model.ModelProvider; +import common.model.ModelRotation; import common.util.BlockPos; import common.util.Facing; import common.world.IWorldAccess; @@ -13,8 +16,8 @@ public class BlockWallSign extends BlockSign implements Rotatable public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { Facing enumfacing = (Facing)worldIn.getState(pos).getValue(FACING); - float f = 0.28125F; - float f1 = 0.78125F; + float f = 0.25f; + float f1 = 0.75f; float f2 = 0.0F; float f3 = 1.0F; float f4 = 0.125F; @@ -55,4 +58,10 @@ public class BlockWallSign extends BlockSign implements Rotatable protected boolean hasRegisteredItem() { return false; } + + public Model getModel(ModelProvider provider, String name, State state) { + return provider.getModel("oak_planks") + .add(0, 4, 14, 16, 12, 16).all().noCull() + .rotate(ModelRotation.getNorthRot(state.getValue(FACING))); + } } diff --git a/common/src/main/java/common/tileentity/TileEntitySign.java b/common/src/main/java/common/tileentity/TileEntitySign.java index 59db6be8..c1276fba 100755 --- a/common/src/main/java/common/tileentity/TileEntitySign.java +++ b/common/src/main/java/common/tileentity/TileEntitySign.java @@ -6,7 +6,7 @@ import common.packet.SPacketUpdateSign; import common.tags.TagObject; public class TileEntitySign extends TileEntity { - public final String[] signText = new String[] {"", "", "", ""}; + public final String[] text = new String[] {"", "", "", ""}; private EntityNPC player; @@ -14,7 +14,7 @@ public class TileEntitySign extends TileEntity { super.writeTags(compound); for(int i = 0; i < 4; ++i) { - compound.setString("Text" + (i + 1), this.signText[i]); + compound.setString("Text" + (i + 1), this.text[i]); } } @@ -22,13 +22,13 @@ public class TileEntitySign extends TileEntity { super.readTags(compound); for(int i = 0; i < 4; ++i) { - this.signText[i] = compound.getString("Text" + (i + 1)); + this.text[i] = compound.getString("Text" + (i + 1)); } } public Packet getDescriptionPacket() { String[] aichatcomponent = new String[4]; - System.arraycopy(this.signText, 0, aichatcomponent, 0, 4); + System.arraycopy(this.text, 0, aichatcomponent, 0, 4); // Sign sign = Server.getServer().getSigns().getEntry(new WorldPos(this).toString()); return new SPacketUpdateSign(this.pos, aichatcomponent); } diff --git a/server/src/main/java/server/network/Player.java b/server/src/main/java/server/network/Player.java index 7cd298cb..1ac39724 100755 --- a/server/src/main/java/server/network/Player.java +++ b/server/src/main/java/server/network/Player.java @@ -2939,7 +2939,7 @@ public class Player extends User implements Executor, IPlayer // boolean color = this.playerEntity.canUse(Permissions.SIGNFORMAT); for (int i = 0; i < lines.length; ++i) { - tileentitysign.signText[i] = TextColor.stripCodes(lines[i]); // lines[i]; // color ? lines[i] : ChatFormat.stripCodes(lines[i]); + tileentitysign.text[i] = TextColor.stripCodes(lines[i]); // lines[i]; // color ? lines[i] : ChatFormat.stripCodes(lines[i]); } // if(this.signCommand != null) {