add basic displays
This commit is contained in:
parent
2fbdfde2ee
commit
b0f33c3be1
40 changed files with 249 additions and 197 deletions
|
@ -1322,8 +1322,8 @@ public class ClientPlayer implements IClientPlayer
|
|||
if(this.gm.world.isBlockLoaded(packet.getPos())) {
|
||||
TileEntity tileentity = this.gm.world.getTileEntity(packet.getPos());
|
||||
|
||||
if(tileentity instanceof TileEntityDisplay display) {
|
||||
System.arraycopy(packet.getPixels(), 0, display.data, 0, 256);
|
||||
if(tileentity instanceof TileEntityDisplay display && display.data.length == packet.getPixels().length) {
|
||||
System.arraycopy(packet.getPixels(), 0, display.data, 0, display.data.length);
|
||||
display.lastUpdated = System.currentTimeMillis();
|
||||
display.markDirty();
|
||||
}
|
||||
|
|
|
@ -57,8 +57,8 @@ public class TileEntityDisplayRenderer extends TileEntitySpecialRenderer<TileEnt
|
|||
tex = new TimedTexture();
|
||||
tex.texture = id;
|
||||
tex.updated = te.lastUpdated;
|
||||
DynamicTexture dtex = new DynamicTexture(16, 16);
|
||||
System.arraycopy(te.data, 0, dtex.getData(), 0, 256);
|
||||
DynamicTexture dtex = new DynamicTexture(te.density, te.density);
|
||||
System.arraycopy(te.data, 0, dtex.getData(), 0, te.data.length);
|
||||
dtex.updateTexture();
|
||||
Client.CLIENT.getTextureManager().loadTexture(tex.texture, dtex);
|
||||
DISPLAYS.put(id, tex);
|
||||
|
@ -66,7 +66,11 @@ public class TileEntityDisplayRenderer extends TileEntitySpecialRenderer<TileEnt
|
|||
else if(te.lastUpdated != tex.updated) {
|
||||
tex.updated = te.lastUpdated;
|
||||
if(Client.CLIENT.getTextureManager().getTexture(tex.texture) instanceof DynamicTexture dtex) {
|
||||
System.arraycopy(te.data, 0, dtex.getData(), 0, 256);
|
||||
if(dtex.getWidth() * dtex.getHeight() != te.data.length) {
|
||||
Client.CLIENT.getTextureManager().deleteTexture(tex.texture);
|
||||
Client.CLIENT.getTextureManager().loadTexture(tex.texture, dtex = new DynamicTexture(te.density, te.density));
|
||||
}
|
||||
System.arraycopy(te.data, 0, dtex.getData(), 0, te.data.length);
|
||||
dtex.updateTexture();
|
||||
}
|
||||
}
|
||||
|
@ -92,10 +96,11 @@ public class TileEntityDisplayRenderer extends TileEntitySpecialRenderer<TileEnt
|
|||
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.0f, (float)z + 0.5F);
|
||||
GL11.glRotatef(-rot, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glTranslatef(-0.5F, 0.0f, -0.5f + 0.0625f + 0.005f);
|
||||
GL11.glScalef(0.0625f, -0.0625f, 0.0625f);
|
||||
float density = 1.0f / (float)(te.density / 16);
|
||||
GL11.glScalef(0.0625f * density, -0.0625f * density, 0.0625f * density);
|
||||
|
||||
GlState.disableLighting();
|
||||
Drawing.drawTexturedRect(Client.CLIENT, getTexture(te), 16, 16, 0, 0, 0, 0, 16, 16);
|
||||
Drawing.drawTexturedRect(Client.CLIENT, getTexture(te), te.density, te.density, 0, 0, 0, 0, te.density, te.density);
|
||||
GlState.enableLighting();
|
||||
|
||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
|
BIN
client/src/main/resources/textures/blocks/display_area.png
Executable file
BIN
client/src/main/resources/textures/blocks/display_area.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 4.5 KiB |
BIN
client/src/main/resources/textures/items/display.png
Executable file
BIN
client/src/main/resources/textures/items/display.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
BIN
client/src/main/resources/textures/items/display2.png
Normal file
BIN
client/src/main/resources/textures/items/display2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
BIN
client/src/main/resources/textures/items/display4.png
Normal file
BIN
client/src/main/resources/textures/items/display4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
Loading…
Add table
Add a link
Reference in a new issue