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

@ -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();
// }

View file

@ -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);

View file

@ -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<Entity> 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);
}
}
}

View file

@ -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<TileEntity> tileentityspecialrenderer = TileEntityRenderer.instance.<TileEntity>getRenderer(tileentity);
ElementRenderer<TileEntity> tileentityspecialrenderer = SpecialRenderer.instance.<TileEntity>getRenderer(tileentity);
if (tileentity != null && tileentityspecialrenderer != null)
{

View file

@ -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;

View file

@ -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);
}
}

View file

@ -17,7 +17,7 @@ import common.util.BlockPos;
import common.util.Facing;
import common.world.State;
public class DisplayRenderer extends TileRenderer<TileEntityDisplay> {
public class DisplayRenderer extends ElementRenderer<TileEntityDisplay> {
private static class TimedTexture {
public long time;
public long updated;
@ -78,12 +78,8 @@ public class DisplayRenderer extends TileRenderer<TileEntityDisplay> {
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();

View file

@ -0,0 +1,11 @@
package client.renderer.tileentity;
import common.tileentity.TileEntity;
public abstract class ElementRenderer<T extends TileEntity> {
public abstract void renderElements(T te, double x, double y, double z, float partial);
public boolean isAlwaysRendered() {
return false;
}
}

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);
}
}
}

View file

@ -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<Class<? extends TileEntity>, TileRenderer<? extends TileEntity>> renderers = Maps.<Class<? extends TileEntity>, TileRenderer<? extends TileEntity>>newHashMap();
private final Map<Class<? extends TileEntity>, ElementRenderer<? extends TileEntity>> renderers = Maps.<Class<? extends TileEntity>, ElementRenderer<? extends TileEntity>>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 <T extends TileEntity> TileRenderer<T> getRenderer(Class<? extends TileEntity> clazz) {
TileRenderer<? extends TileEntity> renderer = (TileRenderer)this.renderers.get(clazz);
private <T extends TileEntity> ElementRenderer<T> getRenderer(Class<? extends TileEntity> clazz) {
ElementRenderer<? extends TileEntity> renderer = (ElementRenderer)this.renderers.get(clazz);
if(renderer == null && clazz != TileEntity.class) {
renderer = this.<TileEntity>getRenderer((Class<? extends TileEntity>)clazz.getSuperclass());
this.renderers.put(clazz, renderer);
}
return (TileRenderer<T>)renderer;
return (ElementRenderer<T>)renderer;
}
public <T extends TileEntity> TileRenderer<T> getRenderer(TileEntity tile) {
return (TileRenderer<T>)(tile == null ? null : this.getRenderer(tile.getClass()));
public <T extends TileEntity> ElementRenderer<T> getRenderer(TileEntity tile) {
return (ElementRenderer<T>)(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<TileEntity> renderer = this.<TileEntity>getRenderer(tile);
private void render(TileEntity tile, double x, double y, double z, float partial) {
ElementRenderer<TileEntity> renderer = this.<TileEntity>getRenderer(tile);
if(renderer != null)
renderer.renderTileEntityAt(tile, x, y, z, partial, destroy);
renderer.renderElements(tile, x, y, z, partial);
}
}

View file

@ -1,30 +0,0 @@
package client.renderer.tileentity;
import client.renderer.texture.TextureManager;
import common.tileentity.TileEntity;
public abstract class TileRenderer<T extends TileEntity> {
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;
}
}

View file

@ -147,10 +147,6 @@ public class BlockFloorPortal extends Block
map.put("floor_portal", 5);
}
public String getFallbackTexture() {
return "obsidian";
}
protected boolean hasRegisteredItem() {
return false;
}

View file

@ -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)));
}
}

View file

@ -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;
}
}

View file

@ -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)));
}
}

View file

@ -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)));
}
}

View file

@ -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);
}

View file

@ -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) {