fix: storage monitor properly displays if it's upgraded

This commit is contained in:
LordMZTE 2022-12-14 17:46:15 +01:00
parent e3abf47a96
commit 1c81059335
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
4 changed files with 24 additions and 19 deletions

View file

@ -1,6 +1,4 @@
- we demultiblocked the transition plane
- transition plane doesn't collect items
- legacy blocks aren't colorable
- storage monitor doesn't display if it's upgraded
- BlockLegacyDisplays don't rotate their faces correctly on the top and bottom
- storage monitors all show the same item

View file

@ -67,7 +67,7 @@ public class BlockStorageMonitor extends BlockLegacyDisplay {
.conversionMatrix()
.maybeItem()
.get()
&& !tile.upgraded && player.isSneaking()) {
&& !tile.upgraded) {
if (!w.isRemote) {
player.inventory.decrStackSize(player.inventory.currentItem, 1);
tile.upgraded = true;
@ -185,6 +185,10 @@ public class BlockStorageMonitor extends BlockLegacyDisplay {
public IIcon getIcon(IBlockAccess w, int x, int y, int z, int s) {
TileStorageMonitor te = (TileStorageMonitor) w.getTileEntity(x, y, z);
System.out.println(
"AAALEC: " + te.upgraded + " " + s + " " + te.getForward().ordinal()
);
if (te != null && te.upgraded && s == te.getForward().ordinal()) {
return ExtraBlockTextures.BlockStorageMonitorFrontMatrix.getIcon();
}

View file

@ -9,7 +9,6 @@ import appeng.tile.legacy.TileStorageMonitor;
import appeng.util.ReadableNumberConverter;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
@ -19,19 +18,6 @@ import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
public class RenderBlockStorageMonitor extends RenderBlockLegacyDisplay {
private int dspList;
public RenderBlockStorageMonitor() {
this.dspList = GLAllocation.generateDisplayLists(1);
}
@Override
protected void finalize() throws Throwable {
super.finalize();
GLAllocation.deleteDisplayLists(this.dspList);
}
@Override
public boolean hasTESR() {
return true;
@ -54,11 +40,11 @@ public class RenderBlockStorageMonitor extends RenderBlockLegacyDisplay {
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
if (tile.updateDisplayList) {
tile.updateDisplayList = false;
GL11.glNewList(this.dspList, GL11.GL_COMPILE_AND_EXECUTE);
GL11.glNewList(tile.dspList, GL11.GL_COMPILE_AND_EXECUTE);
this.tesrRenderScreen(tile, tess, tile.myItem);
GL11.glEndList();
} else {
GL11.glCallList(this.dspList);
GL11.glCallList(tile.dspList);
}
GL11.glPopMatrix();
}

View file

@ -14,8 +14,10 @@ import appeng.api.storage.data.IItemList;
import appeng.me.GridAccessException;
import appeng.tile.TileEvent;
import appeng.tile.events.TileEventType;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
@ -25,12 +27,27 @@ public class TileStorageMonitor extends TileLegacyDisplay implements IStackWatch
public IAEItemStack myItem;
public boolean updateDisplayList;
public int dspList;
private IStackWatcher watcher;
public TileStorageMonitor() {
this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
this.getProxy().setIdlePowerUsage(0.5);
this.getProxy().setValidSides(EnumSet.allOf(ForgeDirection.class));
if (Platform.isClient()) {
this.dspList = GLAllocation.generateDisplayLists(1);
}
}
@Override
protected void finalize() throws Throwable {
super.finalize();
if (Platform.isClient()) {
GLAllocation.deleteDisplayLists(this.dspList);
}
}
@Override