Compare commits

..
Author SHA1 Message Date
Martin Robertz fe5459167e Merge remote-tracking branch 'Laiff/feature/level-maintainer-terminal' into dev 2023-10-23 18:53:43 +02:00
Andrei Laiff d89608f378 Fix tooltip zIndexes
(cherry picked from commit 8d8b7d0c43)
2023-10-23 18:53:29 +02:00
Andrei Laiff 18e5d8c4c1 Change ForgeDirection side serialization to byte
(cherry picked from commit 3a87975b7c)
2023-10-23 18:53:21 +02:00
Andrei Laiff 8d8b7d0c43 Fix tooltip zIndexes 2023-10-23 16:33:33 +03:00
Andrei Laiff 3a87975b7c Change ForgeDirection side serialization to byte 2023-10-23 16:33:33 +03:00
Martin RobertzandAndrei Laiff bad5622723 Feature/level maintainer terminal (#166)
* Fix `zIndexes` for compatability with `DuraDisplay`

* Update AE2 and fix compatability

---------

Co-authored-by: Andrei Laiff <[email protected]>
2023-10-22 22:15:39 +02:00
Martin Robertz f8dd818f29 Merge branch 'dev' into feature/level-maintainer-terminal 2023-10-22 22:07:22 +02:00
Andrei Laiff f76e053167 Update AE2 and fix compatability 2023-10-22 22:51:40 +03:00
Andrei Laiff e09fc05ba2 Fix zIndexes for compatability with DuraDisplay 2023-10-22 21:50:46 +03:00
Martin Robertz 6d646f8c4a Update dependencies.gradle 2023-10-22 02:16:51 +02:00
Martin Robertz 3101820a7b Update dependencies.gradle 2023-10-22 02:05:54 +02:00
Martin Robertz 7a1adb40b0 update be+deps 2023-10-22 01:45:56 +02:00
Martin Robertz d8877db33a Merge remote-tracking branch 'origin/fix_interface_term' into dev
# Conflicts:
#	dependencies.gradle
2023-10-22 01:43:29 +02:00
Andrei Laiff 63b507edb0 Fix intercept dnd click from GT5 hook for AppEngGuiHandler
keyword `net.bdew.neiaddons.appeng.AppEngGuiHandler`
2023-10-21 22:41:45 +03:00
Andrei Laiff c341f22a36 Correct handle overwrite packet 2023-10-21 22:41:45 +03:00
Andrei Laiff ffb3b05d2e Fix packet corruption with level emitters 2023-10-21 22:41:45 +03:00
Andrei Laiff c92fa2af8a Fix packet corruption and log invalid data 2023-10-21 22:41:45 +03:00
Andrei Laiff a93f3f51ff Fix add logging around empty configuration 2023-10-21 22:41:45 +03:00
Andrei Laiff 7ac1c2f4c4 Fix add packet logging and try to not fail after receive corrupted packet 2023-10-21 22:41:45 +03:00
Andrei Laiff 0a3e7deb79 Fix fails on getCraftingItem
no root cause was found
2023-10-21 22:41:45 +03:00
Andrei Laiff 0ab87779b8 Fix rendering numbers bigger than 2.1G through aeRenderItem 2023-10-21 22:41:45 +03:00
Andrei Laiff c429150e21 Use aeRenderItem directly and fix zIndex in custom slots 2023-10-21 22:41:45 +03:00
Andrei Laiff f94792bc1b Fix LevelTerminal data recursion and few in fixes gui 2023-10-21 22:41:45 +03:00
Andrei Laiff 79e6448dce Implement new version of InterfaceWireless based on InterfaceTerminal 2023-10-21 22:41:45 +03:00
Andrei Laiff 8ba192c9cc fix correct InterfaceTerminalSupportedClassProvider deprecation 2023-10-21 22:41:45 +03:00
Andrei Laiff 42741d84bd use IGuiTooltipHandler directly from ae2
include #160
2023-10-21 22:41:43 +03:00
Andrei Laiff cf3e18aa08 feat: add back navigation in LevelMaintainer from terminal 2023-10-21 22:41:00 +03:00
Andrei Laiff e78194ef68 feat: Support back navigation functionality 2023-10-21 22:41:00 +03:00
Andrei Laiff 1eadad7e1e feat: Add new item LevelTerminal 2023-10-21 22:41:00 +03:00
Andrei Laiff f26d18e321 feat: Rework scheduling and data storage in TileLevelMaintainer functionality 2023-10-21 22:41:00 +03:00
Andrei Laiff 827bbf8aa8 feat: Use customName to display in GuiFluidLevelEmitter 2023-10-21 22:41:00 +03:00
Andrei Laiff d025c1f095 api: Add LevelTerminalRegistry functionality 2023-10-21 22:41:00 +03:00
Andrei Laiff 3ab27d4231 feat: Update core hooks and integrations 2023-10-21 22:41:00 +03:00
Martin Robertz dbc5f413eb Merge branch 'master' into fix_interface_term 2023-10-13 12:48:47 +02:00
15 changed files with 473 additions and 176 deletions

No files matched your search

+2 -2
View File
@@ -1,4 +1,4 @@
//version: 1696952014
//version: 1697697256
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
@@ -798,7 +798,7 @@ dependencies {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
}
if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.7')
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.17')
}
java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false}
+43 -7
View File
@@ -1,25 +1,61 @@
// Add your dependencies here
/*
* Add your dependencies here. Supported configurations:
* - api("group:name:version:classifier"): if you use the types from this dependency in the public API of this mod
* Available at runtime and compiletime for mods depending on this mod
* - implementation("g:n:v:c"): if you need this for internal implementation details of the mod, but none of it is visible via the public API
* Available at runtime but not compiletime for mods depending on this mod
* - compileOnly("g:n:v:c"): if the mod you're building doesn't need this dependency during runtime at all, e.g. for optional mods
* Not available at all for mods depending on this mod, only visible at compiletime for this mod
* - compileOnlyApi("g:n:v:c"): like compileOnly, but also visible at compiletime for mods depending on this mod
* Available at compiletime but not runtime for mods depending on this mod
* - runtimeOnlyNonPublishable("g:n:v:c"): if you want to include a mod in this mod's runClient/runServer runs, but not publish it as a dependency
* Not available at all for mods depending on this mod, only visible at runtime for this mod
* - devOnlyNonPublishable("g:n:v:c"): a combination of runtimeOnlyNonPublishable and compileOnly for dependencies present at both compiletime and runtime,
* but not published as Maven dependencies - useful for RFG-deobfuscated dependencies or local testing
* - runtimeOnly("g:n:v:c"): if you don't need this at compile time, but want it to be present at runtime
* Available at runtime for mods depending on this mod
* - annotationProcessor("g:n:v:c"): mostly for java compiler plugins, if you know you need this, use it, otherwise don't worry
* - testCONFIG("g:n:v:c") - replace CONFIG by one of the above (except api), same as above but for the test sources instead of main
*
* - shadowImplementation("g:n:v:c"): effectively the same as API, but the dependency is included in your jar under a renamed package name
* Requires you to enable usesShadowedDependencies in gradle.properties
*
* - compile("g:n:v:c"): deprecated, replace with "api" (works like the old "compile") or "implementation" (can be more efficient)
*
* You can exclude transitive dependencies (dependencies of the chosen dependency) by appending { transitive = false } if needed,
* but use this sparingly as it can break using your mod as another mod's dependency if you're not careful.
*
* To depend on obfuscated jars you can use `devOnlyNonPublishable(rfg.deobf("dep:spec:1.2.3"))` to fetch an obfuscated jar from maven,
* or `devOnlyNonPublishable(rfg.deobf(project.files("libs/my-mod-jar.jar")))` to use a file.
*
* Gradle names for some of the configuration can be misleading, compileOnlyApi and runtimeOnly both get published as dependencies in Maven, but compileOnly does not.
* The buildscript adds runtimeOnlyNonPublishable to also have a runtime dependency that's not published.
*
* For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph
*/
dependencies {
api('com.github.GTNewHorizons:NotEnoughItems:2.4.5-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-267-GTNH-pre:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-271-GTNH-pre:dev')
api('curse.maven:cofh-core-69162:2388751')
api('com.github.GTNewHorizons:waila:1.6.0:dev')
api('com.github.GTNewHorizons:waila:1.6.2:dev')
api("com.github.GTNewHorizons:WirelessCraftingTerminal:1.10.1:dev")
compileOnly('com.github.GTNewHorizons:Baubles:1.0.1.16:dev')
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.34:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:WirelessCraftingTerminal:1.10.1:dev")
compileOnly('com.github.GTNewHorizons:ForestryMC:4.6.14:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.5.3:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.44.50-pre:dev') {
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.44.59-pre:dev') {
exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework'
}
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:OpenComputers:1.9.17-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.4.13-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:GTplusplus:1.10.17:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.3.14:dev") { transitive = false }
compileOnly('com.github.GTNewHorizons:GTplusplus:1.10.21:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.3.18:dev") { transitive = false }
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.1.7:dev")
}
@@ -58,7 +58,7 @@ import appeng.core.localization.GuiColors;
import appeng.core.localization.GuiText;
import appeng.core.localization.PlayerMessages;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketIfaceTermUpdate;
import appeng.core.sync.packets.PacketInterfaceTerminalUpdate;
import appeng.core.sync.packets.PacketInventoryAction;
import appeng.helpers.InventoryAction;
import appeng.helpers.PatternHelper;
@@ -80,7 +80,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
AppEng.MOD_ID,
"textures/guis/newinterfaceterminal.png");
private final IfaceList masterList = new IfaceList();
private final InterfaceWirelessList masterList = new InterfaceWirelessList();
private final MEGuiTextField searchFieldOutputs;
private final MEGuiTextField searchFieldInputs;
private final MEGuiTextField searchFieldNames;
@@ -100,11 +100,13 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
* Z-level Map (FLOATS) 0.0 - BACKGROUND 1.0 - ItemStacks 2.0 - Slot color overlays 20.0 - ItemStack overlays 21.0 -
* Slot mouse hover overlay 200.0 - Tooltips
*/
private static final float ITEMSTACK_Z = 1.0f;
private static final float ITEM_STACK_Z = 100.0f;
private static final float SLOT_Z = 0.5f;
private static final float ITEMSTACK_OVERLAY_Z = 20.0f;
private static final float SLOT_HOVER_Z = 31.0f;
private static final float TOOLTIP_Z = 200.0f;
private static final float ITEM_STACK_OVERLAY_Z = 200.0f;
private static final float SLOT_HOVER_Z = 310.0f;
private static final float TOOLTIP_Z = 410.0f;
private static final float STEP_Z = 10.0f;
private static final float MAGIC_RENDER_ITEM_Z = 50.0f;
protected int offsetY;
@@ -327,7 +329,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
offsetY + HEADER_HEIGHT + viewHeight + 1,
0.0f,
0.0f,
(HEADER_HEIGHT + IfaceSection.TITLE_HEIGHT + 1.0f) / 256.0f,
(HEADER_HEIGHT + InterfaceWirelessSection.TITLE_HEIGHT + 1.0f) / 256.0f,
this.xSize / 256.0f,
(HEADER_HEIGHT + 106.0f) / 256.0f);
Tessellator.instance.draw();
@@ -359,7 +361,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
final int scroll = this.getScrollBar().getCurrentScroll();
int viewY = -scroll; // current y in viewport coordinates
int entryIdx = 0;
List<IfaceSection> visibleSections = this.masterList.getVisibleSections();
List<InterfaceWirelessSection> visibleSections = this.masterList.getVisibleSections();
final float guiScaleX = (float) mc.displayWidth / width;
final float guiScaleY = (float) mc.displayHeight / height;
@@ -374,7 +376,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
* Render each section
*/
while (viewY < this.viewHeight && entryIdx < visibleSections.size()) {
IfaceSection section = visibleSections.get(entryIdx);
InterfaceWirelessSection section = visibleSections.get(entryIdx);
int sectionHeight = section.getHeight();
/* Is it viewable/in the viewport at all? */
@@ -401,7 +403,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
* @param relMouseY transformed mouse coords relative to viewport
* @return the height of the section rendered in viewport coordinates, max of viewHeight.
*/
private int drawSection(IfaceSection section, int viewY, int relMouseX, int relMouseY) {
private int drawSection(InterfaceWirelessSection section, int viewY, int relMouseX, int relMouseY) {
int title;
int renderY = 0;
final int sectionBottom = viewY + section.getHeight() - 1;
@@ -409,49 +411,70 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
/*
* Render title
*/
GL11.glTranslatef(0.0f, 0.0f, 50f);
bindTexture(BACKGROUND);
if (sectionBottom > 0 && sectionBottom < IfaceSection.TITLE_HEIGHT) {
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z + ITEM_STACK_Z + STEP_Z);
if (sectionBottom > 0 && sectionBottom < InterfaceWirelessSection.TITLE_HEIGHT) {
/* Transition draw */
title = sectionBottom;
} else if (viewY < 0) {
/* Hidden title draw */
title = 0;
} else {
/* Normal title draw */
title = 0;
}
GL11.glTranslatef(0.0f, 0.0f, -(ITEM_STACK_OVERLAY_Z + ITEM_STACK_Z + STEP_Z));
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
Iterator<InerfaceWirelessEntry> visible = section.getVisible();
while (visible.hasNext()) {
if (viewY < viewHeight) {
renderY += drawEntry(
visible.next(),
viewY + InterfaceWirelessSection.TITLE_HEIGHT + renderY,
title,
relMouseX,
relMouseY);
} else {
InerfaceWirelessEntry entry = visible.next();
entry.dispY = -9999;
entry.optionsButton.yPosition = -1;
}
}
bindTexture(BACKGROUND);
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z + ITEM_STACK_Z + STEP_Z);
if (sectionBottom > 0 && sectionBottom < InterfaceWirelessSection.TITLE_HEIGHT) {
/* Transition draw */
drawTexturedModalRect(
0,
0,
VIEW_LEFT,
HEADER_HEIGHT + IfaceSection.TITLE_HEIGHT - sectionBottom,
HEADER_HEIGHT + InterfaceWirelessSection.TITLE_HEIGHT - sectionBottom,
VIEW_WIDTH,
sectionBottom);
fontRendererObj.drawString(section.name, 2, sectionBottom - IfaceSection.TITLE_HEIGHT + 2, fontColor);
title = sectionBottom;
fontRendererObj
.drawString(section.name, 2, sectionBottom - InterfaceWirelessSection.TITLE_HEIGHT + 2, fontColor);
} else if (viewY < 0) {
/* Hidden title draw */
drawTexturedModalRect(0, 0, VIEW_LEFT, HEADER_HEIGHT, VIEW_WIDTH, IfaceSection.TITLE_HEIGHT);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glTranslatef(0.0f, 0.0f, 100f);
drawTexturedModalRect(0, 0, VIEW_LEFT, HEADER_HEIGHT, VIEW_WIDTH, InterfaceWirelessSection.TITLE_HEIGHT);
fontRendererObj.drawString(section.name, 2, 2, fontColor);
title = 0;
GL11.glEnable(GL11.GL_DEPTH_TEST);
} else {
/* Normal title draw */
drawTexturedModalRect(0, viewY, VIEW_LEFT, HEADER_HEIGHT, VIEW_WIDTH, IfaceSection.TITLE_HEIGHT);
drawTexturedModalRect(
0,
viewY,
VIEW_LEFT,
HEADER_HEIGHT,
VIEW_WIDTH,
InterfaceWirelessSection.TITLE_HEIGHT);
fontRendererObj.drawString(section.name, 2, viewY + 2, fontColor);
title = 0;
}
GL11.glTranslatef(0.0f, 0.0f, -50f);
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
GL11.glTranslatef(0.0f, 0.0f, -(ITEM_STACK_OVERLAY_Z + ITEM_STACK_Z + STEP_Z));
Iterator<IfaceEntry> visible = section.getVisible();
while (visible.hasNext()) {
if (viewY < viewHeight) {
renderY += drawEntry(
visible.next(),
viewY + IfaceSection.TITLE_HEIGHT + renderY,
title,
relMouseX,
relMouseY);
} else {
IfaceEntry entry = visible.next();
entry.dispY = -9999;
entry.optionsButton.yPosition = -1;
}
}
return IfaceSection.TITLE_HEIGHT + renderY;
return InterfaceWirelessSection.TITLE_HEIGHT + renderY;
}
/**
@@ -459,7 +482,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
*
* @param viewY the gui coordinate z
*/
private int drawEntry(IfaceEntry entry, int viewY, int titleBottom, int relMouseX, int relMouseY) {
private int drawEntry(InerfaceWirelessEntry entry, int viewY, int titleBottom, int relMouseX, int relMouseY) {
bindTexture(BACKGROUND);
Tessellator.instance.startDrawingQuads();
int relY = 0;
@@ -502,7 +525,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
}
toRender.drawButton(mc, relMouseX, relMouseY);
if (toRender.getMouseIn()
&& relMouseY >= Math.max(IfaceSection.TITLE_HEIGHT, entry.optionsButton.yPosition)) {
&& relMouseY >= Math.max(InterfaceWirelessSection.TITLE_HEIGHT, entry.optionsButton.yPosition)) {
// draw a tooltip
GL11.glTranslatef(0f, 0f, TOOLTIP_Z);
GL11.glDisable(GL11.GL_SCISSOR_TEST);
@@ -531,30 +554,30 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
ItemStack stack = inv.getStackInSlot(slotIdx);
boolean tooltip = relMouseX > colLeft - 1 && relMouseX < colRight - 1
&& relMouseY >= Math.max(viewY + rowYTop, IfaceSection.TITLE_HEIGHT)
&& relMouseY >= Math.max(viewY + rowYTop, InterfaceWirelessSection.TITLE_HEIGHT)
&& relMouseY < Math.min(viewY + rowYBot, viewHeight);
if (stack != null) {
final ItemEncodedPattern iep = (ItemEncodedPattern) stack.getItem();
final ItemStack toRender = iep.getOutput(stack);
GL11.glPushMatrix();
GL11.glTranslatef(colLeft, viewY + rowYTop + 1, ITEMSTACK_Z);
GL11.glTranslatef(colLeft, viewY + rowYTop + 1, ITEM_STACK_Z);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
translatedRenderItem.zLevel = 3.0f - 50.0f;
translatedRenderItem.zLevel = ITEM_STACK_Z - MAGIC_RENDER_ITEM_Z;
translatedRenderItem
.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), toRender, 0, 0);
GL11.glTranslatef(0.0f, 0.0f, ITEMSTACK_OVERLAY_Z - ITEMSTACK_Z);
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z - ITEM_STACK_Z);
aeRenderItem.setAeStack(AEItemStack.create(toRender));
aeRenderItem.renderItemOverlayIntoGUI(fontRendererObj, mc.getTextureManager(), toRender, 0, 0);
aeRenderItem.zLevel = 0.0f;
RenderHelper.disableStandardItemLighting();
if (!tooltip) {
if (entry.brokenRecipes[slotIdx]) {
GL11.glTranslatef(0.0f, 0.0f, SLOT_Z - ITEMSTACK_OVERLAY_Z);
GL11.glTranslatef(0.0f, 0.0f, SLOT_Z - ITEM_STACK_OVERLAY_Z);
drawRect(0, 0, 16, 16, GuiColors.ItemSlotOverlayInvalid.getColor());
} else if (entry.filteredRecipes[slotIdx]) {
GL11.glTranslatef(0.0f, 0.0f, ITEMSTACK_OVERLAY_Z);
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z);
drawRect(0, 0, 16, 16, GuiColors.ItemSlotOverlayUnpowered.getColor());
}
} else {
@@ -563,7 +586,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
GL11.glPopMatrix();
} else if (entry.filteredRecipes[slotIdx]) {
GL11.glPushMatrix();
GL11.glTranslatef(colLeft, viewY + rowYTop + 1, ITEMSTACK_OVERLAY_Z);
GL11.glTranslatef(colLeft, viewY + rowYTop + 1, ITEM_STACK_OVERLAY_Z);
drawRect(0, 0, 16, 16, GuiColors.ItemSlotOverlayUnpowered.getColor());
GL11.glPopMatrix();
}
@@ -757,32 +780,38 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
return false;
}
public void postUpdate(List<PacketIfaceTermUpdate.PacketEntry> updates, int statusFlags) {
if ((statusFlags & PacketIfaceTermUpdate.CLEAR_ALL_BIT) == PacketIfaceTermUpdate.CLEAR_ALL_BIT) {
public void postUpdate(List<PacketInterfaceTerminalUpdate.PacketEntry> updates, int statusFlags) {
if ((statusFlags & PacketInterfaceTerminalUpdate.CLEAR_ALL_BIT)
== PacketInterfaceTerminalUpdate.CLEAR_ALL_BIT) {
/* Should clear all client entries. */
this.masterList.list.clear();
}
/* Should indicate disconnected, so the terminal turns dark. */
this.online = (statusFlags & PacketIfaceTermUpdate.DISCONNECT_BIT) != PacketIfaceTermUpdate.DISCONNECT_BIT;
this.online = (statusFlags & PacketInterfaceTerminalUpdate.DISCONNECT_BIT)
!= PacketInterfaceTerminalUpdate.DISCONNECT_BIT;
for (PacketIfaceTermUpdate.PacketEntry cmd : updates) {
for (PacketInterfaceTerminalUpdate.PacketEntry cmd : updates) {
parsePacketCmd(cmd);
}
this.masterList.markDirty();
}
private void parsePacketCmd(PacketIfaceTermUpdate.PacketEntry cmd) {
private void parsePacketCmd(PacketInterfaceTerminalUpdate.PacketEntry cmd) {
long id = cmd.entryId;
if (cmd instanceof PacketIfaceTermUpdate.PacketAdd addCmd) {
IfaceEntry entry = new IfaceEntry(id, addCmd.name, addCmd.rows, addCmd.rowSize, addCmd.online)
.setLocation(addCmd.x, addCmd.y, addCmd.z, addCmd.dim, addCmd.side)
.setIcons(addCmd.selfRep, addCmd.dispRep).setItems(addCmd.items);
if (cmd instanceof PacketInterfaceTerminalUpdate.PacketAdd addCmd) {
InerfaceWirelessEntry entry = new InerfaceWirelessEntry(
id,
addCmd.name,
addCmd.rows,
addCmd.rowSize,
addCmd.online).setLocation(addCmd.x, addCmd.y, addCmd.z, addCmd.dim, addCmd.side)
.setIcons(addCmd.selfRep, addCmd.dispRep).setItems(addCmd.items);
masterList.addEntry(entry);
} else if (cmd instanceof PacketIfaceTermUpdate.PacketRemove) {
} else if (cmd instanceof PacketInterfaceTerminalUpdate.PacketRemove) {
masterList.removeEntry(id);
} else if (cmd instanceof PacketIfaceTermUpdate.PacketOverwrite owCmd) {
IfaceEntry entry = masterList.list.get(id);
} else if (cmd instanceof PacketInterfaceTerminalUpdate.PacketOverwrite owCmd) {
InerfaceWirelessEntry entry = masterList.list.get(id);
if (entry == null) {
return;
@@ -800,8 +829,8 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
}
}
masterList.isDirty = true;
} else if (cmd instanceof PacketIfaceTermUpdate.PacketRename renameCmd) {
IfaceEntry entry = masterList.list.get(id);
} else if (cmd instanceof PacketInterfaceTerminalUpdate.PacketRename renameCmd) {
InerfaceWirelessEntry entry = masterList.list.get(id);
if (entry != null) {
if (StatCollector.canTranslate(renameCmd.newName)) {
@@ -894,16 +923,16 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
/**
* Tracks the list of entries.
*/
private class IfaceList {
private class InterfaceWirelessList {
private final Map<Long, IfaceEntry> list = new HashMap<>();
private final Map<String, IfaceSection> sections = new TreeMap<>();
private final List<IfaceSection> visibleSections = new ArrayList<>();
private final Map<Long, InerfaceWirelessEntry> list = new HashMap<>();
private final Map<String, InterfaceWirelessSection> sections = new TreeMap<>();
private final List<InterfaceWirelessSection> visibleSections = new ArrayList<>();
private boolean isDirty;
private int height;
private IfaceEntry hoveredEntry;
private InerfaceWirelessEntry hoveredEntry;
IfaceList() {
InterfaceWirelessList() {
this.isDirty = true;
}
@@ -914,7 +943,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
height = 0;
visibleSections.clear();
for (IfaceSection section : sections.values()) {
for (InterfaceWirelessSection section : sections.values()) {
String query = GuiInterfaceWireless.this.searchFieldNames.getText();
if (!query.isEmpty() && !section.name.toLowerCase().contains(query.toLowerCase())) {
continue;
@@ -966,7 +995,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
} else {
int y = 0;
for (IfaceSection section : sections) {
for (InterfaceWirelessSection section : sections) {
if (y > viewY) {
result = true;
scrollbar.setCurrentScroll(y);
@@ -978,11 +1007,11 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
return result;
}
public void addEntry(IfaceEntry entry) {
IfaceSection section = sections.get(entry.dispName);
public void addEntry(InerfaceWirelessEntry entry) {
InterfaceWirelessSection section = sections.get(entry.dispName);
if (section == null) {
section = new IfaceSection(entry.dispName);
section = new InterfaceWirelessSection(entry.dispName);
sections.put(entry.dispName, section);
}
section.addEntry(entry);
@@ -991,14 +1020,14 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
}
public void removeEntry(long id) {
IfaceEntry entry = list.remove(id);
InerfaceWirelessEntry entry = list.remove(id);
if (entry != null) {
entry.section.removeEntry(entry);
}
}
public List<IfaceSection> getVisibleSections() {
public List<InterfaceWirelessSection> getVisibleSections() {
if (isDirty) {
update();
}
@@ -1016,7 +1045,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
if (relMouseX < 0 || relMouseX >= VIEW_WIDTH || relMouseY < 0 || relMouseY >= viewHeight) {
return false;
}
for (IfaceSection section : getVisibleSections()) {
for (InterfaceWirelessSection section : getVisibleSections()) {
if (section.mouseClicked(relMouseX, relMouseY, btn)) {
return true;
}
@@ -1028,13 +1057,13 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
/**
* A section holds all the interface entries with the same name.
*/
private class IfaceSection {
private class InterfaceWirelessSection {
public static final int TITLE_HEIGHT = 12;
String name;
List<IfaceEntry> entries = new ArrayList<>();
Set<IfaceEntry> visibleEntries = new TreeSet<>(Comparator.comparing(e -> {
List<InerfaceWirelessEntry> entries = new ArrayList<>();
Set<InerfaceWirelessEntry> visibleEntries = new TreeSet<>(Comparator.comparing(e -> {
if (e.dispRep != null) {
return e.dispRep.getDisplayName() + e.id;
} else {
@@ -1045,7 +1074,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
private boolean isDirty = true;
boolean visible = false;
IfaceSection(String name) {
InterfaceWirelessSection(String name) {
this.name = name;
}
@@ -1065,7 +1094,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
height = 0;
} else {
height = TITLE_HEIGHT;
for (IfaceEntry entry : visibleEntries) {
for (InerfaceWirelessEntry entry : visibleEntries) {
height += entry.guiHeight;
}
}
@@ -1077,7 +1106,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
String input = GuiInterfaceWireless.this.searchFieldInputs.getText().toLowerCase();
String output = GuiInterfaceWireless.this.searchFieldOutputs.getText().toLowerCase();
for (IfaceEntry entry : entries) {
for (InerfaceWirelessEntry entry : entries) {
var moleAss = AEApi.instance().definitions().blocks().molecularAssembler().maybeStack(1);
entry.dispY = -9999;
if (onlyMolecularAssemblers
@@ -1116,19 +1145,19 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
}
}
public void addEntry(IfaceEntry entry) {
public void addEntry(InerfaceWirelessEntry entry) {
this.entries.add(entry);
entry.section = this;
this.isDirty = true;
}
public void removeEntry(IfaceEntry entry) {
public void removeEntry(InerfaceWirelessEntry entry) {
this.entries.remove(entry);
entry.section = null;
this.isDirty = true;
}
public Iterator<IfaceEntry> getVisible() {
public Iterator<InerfaceWirelessEntry> getVisible() {
if (isDirty) {
update();
}
@@ -1136,7 +1165,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
}
public boolean mouseClicked(int relMouseX, int relMouseY, int btn) {
Iterator<IfaceEntry> it = getVisible();
Iterator<InerfaceWirelessEntry> it = getVisible();
boolean ret = false;
while (it.hasNext() && !ret) {
@@ -1150,7 +1179,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
/**
* This class keeps track of an entry and its widgets.
*/
private class IfaceEntry {
private class InerfaceWirelessEntry {
String dispName;
AppEngInternalInventory inv;
@@ -1161,7 +1190,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
ItemStack selfRep;
/** Nullable - icon that represents the interface's "target" */
ItemStack dispRep;
IfaceSection section;
InterfaceWirelessSection section;
long id;
int x, y, z, dim, side;
int rows, rowSize;
@@ -1175,7 +1204,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
boolean[] filteredRecipes;
private int hoveredSlotIdx = -1;
IfaceEntry(long id, String name, int rows, int rowSize, boolean online) {
InerfaceWirelessEntry(long id, String name, int rows, int rowSize, boolean online) {
this.id = id;
if (StatCollector.canTranslate(name)) {
this.dispName = StatCollector.translateToLocal(name);
@@ -1200,7 +1229,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
this.filteredRecipes = new boolean[rows * rowSize];
}
IfaceEntry setLocation(int x, int y, int z, int dim, int side) {
InerfaceWirelessEntry setLocation(int x, int y, int z, int dim, int side) {
this.x = x;
this.y = y;
this.z = z;
@@ -1210,7 +1239,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
return this;
}
IfaceEntry setIcons(ItemStack selfRep, ItemStack dispRep) {
InerfaceWirelessEntry setIcons(ItemStack selfRep, ItemStack dispRep) {
// Kotlin would make this pretty easy :(
this.selfRep = selfRep;
this.dispRep = dispRep;
@@ -1230,7 +1259,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
this.guiHeight = 18 * rows + 4;
}
IfaceEntry setItems(NBTTagList items) {
InerfaceWirelessEntry setItems(NBTTagList items) {
assert items.tagCount() == inv.getSizeInventory();
for (int i = 0; i < items.tagCount(); ++i) {
@@ -1270,7 +1299,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
return false;
}
if (mouseX >= optionsButton.xPosition && mouseX < 2 + optionsButton.width
&& mouseY > Math.max(optionsButton.yPosition, IfaceSection.TITLE_HEIGHT)
&& mouseY > Math.max(optionsButton.yPosition, InterfaceWirelessSection.TITLE_HEIGHT)
&& mouseY <= Math.min(optionsButton.yPosition + optionsButton.height, viewHeight)) {
optionsButton.func_146113_a(mc.getSoundHandler());
DimensionalCoord blockPos = new DimensionalCoord(x, y, z, dim);
@@ -1311,7 +1340,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
int offsetY = mouseY - dispY;
int offsetX = mouseX - (VIEW_WIDTH - rowSize * 18) - 1;
if (offsetX >= 0 && offsetX < (rowSize * 18)
&& mouseY > Math.max(dispY, IfaceSection.TITLE_HEIGHT)
&& mouseY > Math.max(dispY, InterfaceWirelessSection.TITLE_HEIGHT)
&& offsetY < Math.min(viewHeight - dispY, guiHeight)) {
final int col = offsetX / 18;
final int row = offsetY / 18;
@@ -47,6 +47,9 @@ import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotFake;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.features.AEFeature;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketNEIDragClick;
import codechicken.nei.VisiblityData;
@@ -130,6 +133,12 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
}
for (IAEItemStack is : list) {
NBTTagCompound data = is.getItemStack().getTagCompound();
if (data == null) {
if (AEConfig.instance.isFeatureEnabled(AEFeature.PacketLogging)) {
AELog.info("Received empty configuration: ", is);
}
continue;
}
long batch = data.getLong(TLMTags.Batch.tagName);
long quantity = data.getLong(TLMTags.Quantity.tagName);
int idx = data.getInteger(TLMTags.Index.tagName);
@@ -225,6 +234,7 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
fake.setStackSize(0);
}
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
aeRenderItem.setAeStack(fake);
aeRenderItem.renderItemOverlayIntoGUI(
fontRendererObj,
mc.getTextureManager(),
@@ -344,18 +354,20 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
@Override
public boolean handleDragNDrop(GuiContainer gui, int mouseX, int mouseY, ItemStack draggedStack, int button) {
for (SlotFluidConvertingFake slot : this.cont.getRequestSlots()) {
if (getSlotArea(slot).contains(mouseX, mouseY)) {
if (draggedStack != null) {
draggedStack.stackSize = 0;
}
for (int i = 0; i < this.cont.getRequestSlots().length; i++) {
SlotFluidConvertingFake slot = this.cont.getRequestSlots()[i];
if (getSlotArea(slot).contains(mouseX, mouseY) && draggedStack != null) {
ItemStack itemStack = createLevelValues(draggedStack.copy());
itemStack.getTagCompound().setInteger(TLMTags.Index.tagName, i);
slot.putStack(itemStack);
NetworkHandler.instance.sendToServer(new PacketNEIDragClick(itemStack, slot.getSlotIndex()));
this.updateAmount(slot.getSlotIndex(), itemStack.stackSize);
return true;
}
}
if (draggedStack != null) {
draggedStack.stackSize = 0;
}
return false;
}
@@ -62,6 +62,7 @@ import appeng.api.config.YesNo;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.WorldCoord;
import appeng.client.gui.IGuiTooltipHandler;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiScrollbar;
import appeng.client.gui.widgets.GuiTabButton;
@@ -80,10 +81,11 @@ import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.util.Platform;
import appeng.util.ReadableNumberConverter;
import appeng.util.item.AEItemStack;
import cpw.mods.fml.common.Loader;
public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextField {
public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextField, IGuiTooltipHandler {
public static final int HEADER_HEIGHT = 52;
public static final int INV_HEIGHT = 98;
@@ -113,11 +115,13 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
// private GuiFCImgButton modeSwitchEdit;
private final LevelTerminalList masterList = new LevelTerminalList();
private final List<String> extraOptionsText = new ArrayList<>(2);
private static final float ITEM_STACK_Z = 1.0f;
private static final float ITEM_STACK_Z = 100.0f;
private static final float SLOT_Z = 0.5f;
private static final float ITEM_STACK_OVERLAY_Z = 20.0f;
private static final float SLOT_HOVER_Z = 31.0f;
private static final float TOOLTIP_Z = 200.0f;
private static final float ITEM_STACK_OVERLAY_Z = 200.0f;
private static final float SLOT_HOVER_Z = 310.0f;
private static final float TOOLTIP_Z = 410.0f;
private static final float STEP_Z = 10.0f;
private static final float MAGIC_RENDER_ITEM_Z = 50.0f;
public GuiLevelTerminal(InventoryPlayer inventoryPlayer, Container container) {
super(inventoryPlayer, container);
@@ -439,32 +443,14 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
/*
* Render title
*/
GL11.glTranslatef(0.0f, 0.0f, 50f);
mc.getTextureManager().bindTexture(TEX_BG);
if (sectionBottom > 0 && sectionBottom < LevelTerminalSection.TITLE_HEIGHT) {
/* Transition draw */
drawTexturedModalRect(
0,
0,
VIEW_LEFT,
HEADER_HEIGHT + LevelTerminalSection.TITLE_HEIGHT - sectionBottom,
VIEW_WIDTH,
sectionBottom);
fontRendererObj
.drawString(section.name, 2, sectionBottom - LevelTerminalSection.TITLE_HEIGHT + 2, fontColor);
title = sectionBottom;
} else if (viewY < 0) {
/* Hidden title draw */
drawTexturedModalRect(0, 0, VIEW_LEFT, HEADER_HEIGHT, VIEW_WIDTH, LevelTerminalSection.TITLE_HEIGHT);
fontRendererObj.drawString(section.name, 2, 2, fontColor);
title = 0;
} else {
/* Normal title draw */
drawTexturedModalRect(0, viewY, VIEW_LEFT, HEADER_HEIGHT, VIEW_WIDTH, LevelTerminalSection.TITLE_HEIGHT);
fontRendererObj.drawString(section.name, 2, viewY + 2, fontColor);
title = 0;
}
GL11.glTranslatef(0.0f, 0.0f, -50f);
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
Iterator<LevelTerminalEntry> visible = section.getVisible();
@@ -484,6 +470,36 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
entry.configButton.yPosition = -1;
}
}
/*
* Render title
*/
mc.getTextureManager().bindTexture(TEX_BG);
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z + ITEM_STACK_Z + STEP_Z);
if (sectionBottom > 0 && sectionBottom < LevelTerminalSection.TITLE_HEIGHT) {
/* Transition draw */
drawTexturedModalRect(
0,
0,
VIEW_LEFT,
HEADER_HEIGHT + LevelTerminalSection.TITLE_HEIGHT - sectionBottom,
VIEW_WIDTH,
sectionBottom);
fontRendererObj
.drawString(section.name, 2, sectionBottom - LevelTerminalSection.TITLE_HEIGHT + 2, fontColor);
} else if (viewY < 0) {
/* Hidden title draw */
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glTranslatef(0.0f, 0.0f, 100f);
drawTexturedModalRect(0, 0, VIEW_LEFT, HEADER_HEIGHT, VIEW_WIDTH, LevelTerminalSection.TITLE_HEIGHT);
fontRendererObj.drawString(section.name, 2, 2, fontColor);
GL11.glEnable(GL11.GL_DEPTH_TEST);
} else {
/* Normal title draw */
drawTexturedModalRect(0, viewY, VIEW_LEFT, HEADER_HEIGHT, VIEW_WIDTH, LevelTerminalSection.TITLE_HEIGHT);
fontRendererObj.drawString(section.name, 2, viewY + 2, fontColor);
}
GL11.glTranslatef(0.0f, 0.0f, -(ITEM_STACK_OVERLAY_Z + ITEM_STACK_Z + STEP_Z));
return LevelTerminalSection.TITLE_HEIGHT + renderY;
}
@@ -568,6 +584,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
&& relMouseY < Math.min(viewY + rowYBot, viewHeight);
if (stack != null) {
AEItemStack aeItemStack = AEItemStack.create(stack);
NBTTagCompound data = stack.getTagCompound();
ItemStack itemStack = data.hasKey(TLMTags.Stack.tagName)
? ItemStack.loadItemStackFromNBT(data.getCompoundTag(TLMTags.Stack.tagName))
@@ -581,18 +598,13 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
GL11.glTranslatef(colLeft, viewY + rowYTop + 1, ITEM_STACK_Z);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
aeRenderItem.setAeStack(null);
aeRenderItem.zLevel = 3.0f - 50.0f;
itemStack.stackSize = 1;
aeItemStack.setStackSize(quantity);
aeRenderItem.setAeStack(aeItemStack);
aeRenderItem.zLevel = ITEM_STACK_Z - MAGIC_RENDER_ITEM_Z;
aeRenderItem.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), itemStack, 0, 0);
aeRenderItem.zLevel = 0.0f;
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z - ITEM_STACK_Z);
itemStack.stackSize = (int) quantity;
aeRenderItem.renderItemOverlayIntoGUI(fontRendererObj, mc.getTextureManager(), itemStack, 0, 0);
if (batch > 0) {
itemStack.stackSize = (int) batch;
aeRenderItem
.renderItemOverlayIntoGUI(fontRendererObj, mc.getTextureManager(), itemStack, 0, -11);
}
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z - ITEM_STACK_Z);
int color = switch (state) {
case Idle -> FCGuiColors.StateIdle.getColor();
case Craft -> FCGuiColors.StateCraft.getColor();
@@ -603,6 +615,11 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
int offset = 0;
int size = 4;
drawRect(offset, offset, offset + size, offset + size, color);
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z - ITEM_STACK_Z);
this.drawReadableAmount(fontRendererObj, quantity, 16.0f, 12f, 16777215);
if (batch > 0) {
this.drawReadableAmount(fontRendererObj, batch, 16.0f, 1f, 16777215);
}
RenderHelper.disableStandardItemLighting();
/*
@@ -640,6 +657,45 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
return relY + 1;
}
public void drawReadableAmount(final FontRenderer fontRenderer, long amount, float x, float y, int color) {
final float scaleFactor = AEConfig.instance.useTerminalUseLargeFont() ? 0.85f : 0.5f;
final float inverseScaleFactor = 1.0f / scaleFactor;
final int offset = AEConfig.instance.useTerminalUseLargeFont() ? 0 : -1;
final boolean unicodeFlag = fontRenderer.getUnicodeFlag();
final String stackSize = this.getToBeRenderedStackSize(amount);
fontRenderer.setUnicodeFlag(false);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glPushMatrix();
GL11.glScaled(scaleFactor, scaleFactor, scaleFactor);
final int X = (int) (((float) x + offset - fontRenderer.getStringWidth(stackSize) * scaleFactor)
* inverseScaleFactor);
final int Y = (int) (((float) y + offset * scaleFactor) * inverseScaleFactor);
fontRenderer.drawString(stackSize, X + 1, Y, 0);
fontRenderer.drawString(stackSize, X - 1, Y, 0);
fontRenderer.drawString(stackSize, X, Y + 1, 0);
fontRenderer.drawString(stackSize, X, Y - 1, 0);
fontRenderer.drawString(stackSize, X, Y, color);
GL11.glPopMatrix();
GL11.glEnable(GL11.GL_LIGHTING);
fontRenderer.setUnicodeFlag(unicodeFlag);
}
private String getToBeRenderedStackSize(final long originalSize) {
if (AEConfig.instance.useTerminalUseLargeFont()) {
return ReadableNumberConverter.INSTANCE.toSlimReadableForm(originalSize);
} else {
return ReadableNumberConverter.INSTANCE.toWideReadableForm(originalSize);
}
}
@SuppressWarnings("unchecked")
@Override
public void drawHoveringText(List textLines, int x, int y, FontRenderer font) {
@@ -9,6 +9,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import com.glodblock.github.common.item.ItemBaseWirelessTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
import com.glodblock.github.common.parts.PartLevelTerminal;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
@@ -35,6 +36,9 @@ public class ContainerFluidCraftConfirm extends ContainerCraftConfirm {
if (ah instanceof PartFluidPatternTerminalEx) {
originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
}
if (ah instanceof PartLevelTerminal) {
originalGui = GuiType.LEVEL_TERMINAL;
}
if (ah instanceof IWirelessTerminal) {
ItemStack terminal = ((IWirelessTerminal) ah).getItemStack();
if (terminal.getItem() instanceof ItemBaseWirelessTerminal) {
@@ -105,10 +105,13 @@ public class ContainerLevelMaintainer extends AEBaseContainer {
return null;
}
for (SlotFluidConvertingFake slot : this.getRequestSlots()) {
for (int i = 0; i < this.getRequestSlots().length; i++) {
SlotFluidConvertingFake slot = this.getRequestSlots()[i];
if (!slot.getHasStack()) {
ItemStack itemStack = ((Slot) this.inventorySlots.get(idx)).getStack();
slot.putConvertedStack(createLevelValues(itemStack.copy()));
ItemStack configuration = createLevelValues(itemStack.copy());
configuration.getTagCompound().setInteger(TLMTags.Index.tagName, i);
slot.putConvertedStack(configuration);
break;
}
}
@@ -132,14 +135,17 @@ public class ContainerLevelMaintainer extends AEBaseContainer {
data.setTag(TLMTags.Stack.tagName, itemStackTag);
}
if (!data.hasKey(TLMTags.Quantity.tagName)) {
data.setLong(TLMTags.Quantity.tagName, itemStack.stackSize);
data.setLong(TLMTags.Quantity.tagName, itemStack.stackSize > 0 ? itemStack.stackSize : 1);
}
if (!data.hasKey(TLMTags.Batch.tagName)) {
data.setLong(TLMTags.Batch.tagName, 0);
data.setLong(TLMTags.Batch.tagName, 1);
}
if (!data.hasKey(TLMTags.Enable.tagName)) {
data.setBoolean(TLMTags.Enable.tagName, false);
}
if (data.hasKey(TLMTags.Index.tagName)) {
data.removeTag(TLMTags.Index.tagName);
}
data.setInteger(TLMTags.State.tagName, State.None.ordinal());
itemStack.setTagCompound(data);
@@ -46,7 +46,7 @@ public class ContainerLevelTerminal extends FCBaseContainer {
*/
private int nextId = 0;
private final Map<ILevelViewable, ContainerLevelTerminal.InvTracker> tracked = new HashMap<>();
private final Map<IGridHost, ContainerLevelTerminal.InvTracker> tracked = new HashMap<>();
private final Map<Long, ContainerLevelTerminal.InvTracker> trackedById = new HashMap<>();
private IGrid grid;
@@ -246,21 +246,22 @@ public class ContainerLevelTerminal extends FCBaseContainer {
private SPacketLevelTerminalUpdate updateList() {
SPacketLevelTerminalUpdate update = null;
var supported = LevelTerminalRegistry.instance().getSupportedClasses();
Set<ILevelViewable> visited = new HashSet<>();
Set<IGridHost> visited = new HashSet<>();
for (Class<? extends ILevelViewable> clz : supported) {
boolean isAdopted = LevelTerminalRegistry.instance().isAdopted(clz);
Class<? extends IGridHost> machineClass = isAdopted ? LevelTerminalRegistry.instance().getAdopted(clz)
: clz;
for (IGridNode gridNode : grid.getMachines(machineClass)) {
final IGridHost gridHost = gridNode.getMachine();
final ILevelViewable machine = isAdopted
? LevelTerminalRegistry.instance().getAdapter(clz).adapt(gridNode.getMachine())
: (ILevelViewable) gridNode.getMachine();
? LevelTerminalRegistry.instance().getAdapter(clz).adapt(gridHost)
: (ILevelViewable) gridHost;
/* First check if we are already tracking this node */
if (tracked.containsKey(machine)) {
if (tracked.containsKey(gridHost)) {
/* Check for updates */
ContainerLevelTerminal.InvTracker knownTracker = tracked.get(machine);
ContainerLevelTerminal.InvTracker knownTracker = tracked.get(gridHost);
/* Name changed? */
String name = machine.getCustomName();
@@ -310,15 +311,15 @@ public class ContainerLevelTerminal extends FCBaseContainer {
.setLocation(entry.x, entry.y, entry.z, entry.dim, entry.side.ordinal())
.setItems(entry.rows, entry.rowSize, entry.inventoryNbt)
.setViewItemStack(machine.getSelfItemStack(), machine.getDisplayItemStack());
tracked.put(machine, entry);
tracked.put(gridHost, entry);
trackedById.put(entry.id, entry);
}
visited.add(machine);
visited.add(gridHost);
}
}
/* Now find any entries that we need to remove */
Iterator<Map.Entry<ILevelViewable, ContainerLevelTerminal.InvTracker>> it = tracked.entrySet().iterator();
Iterator<Map.Entry<IGridHost, ContainerLevelTerminal.InvTracker>> it = tracked.entrySet().iterator();
while (it.hasNext()) {
var entry = it.next();
if (visited.contains(entry.getKey())) {
@@ -607,7 +607,9 @@ public class TileLevelMaintainer extends AENetworkTile
public IAEItemStack getCraftItem(int idx) {
IAEItemStack is = requestStacks.getStack(idx);
if (is == null) return null;
if (is.getItemStack() == null) return null;
ItemStack qis = loadItemStackFromTag(is.getItemStack());
if (qis == null) return null;
IAEItemStack qais = AEItemStack.create(qis);
qais.setStackSize(getBatchSize(idx));
@@ -12,12 +12,17 @@ import com.glodblock.github.api.registries.ILevelViewable;
import com.glodblock.github.api.registries.ILevelViewableAdapter;
import com.glodblock.github.common.tile.TileLevelMaintainer.State;
import com.glodblock.github.common.tile.TileLevelMaintainer.TLMTags;
import com.glodblock.github.inventory.AeItemStackHandler;
import com.glodblock.github.inventory.AeStackInventoryImpl;
import appeng.api.networking.IGridHost;
import appeng.api.networking.IGridNode;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.AECableType;
import appeng.api.util.DimensionalCoord;
import appeng.parts.automation.PartLevelEmitter;
import appeng.util.item.AEItemStack;
public class PartLevelEmitterAdapter implements ILevelViewable, ILevelViewableAdapter {
@@ -30,20 +35,21 @@ public class PartLevelEmitterAdapter implements ILevelViewable, ILevelViewableAd
public ILevelViewable adapt(IGridHost gridHost) {
if (gridHost instanceof PartLevelEmitter levelEmitter) this.delegate = levelEmitter;
return this;
};
}
@NotNull
static public IInventory getPatchedInventory(IInventory inventory, long quantity, State state) {
ItemStack itemStack = inventory.getStackInSlot(SLOT_IN).copy();
ItemStack itemStack = inventory.getStackInSlot(SLOT_IN);
if (itemStack == null) return inventory;
NBTTagCompound data = !itemStack.hasTagCompound() ? new NBTTagCompound() : itemStack.getTagCompound();
if (!data.hasKey(TLMTags.Quantity.tagName) || data.getLong(TLMTags.Quantity.tagName) != quantity)
data.setLong(TLMTags.Quantity.tagName, quantity);
if (!data.hasKey(TLMTags.State.tagName) || data.getInteger(TLMTags.State.tagName) != state.ordinal())
data.setInteger(TLMTags.State.tagName, state.ordinal());
data.setLong(TLMTags.Quantity.tagName, quantity);
data.setInteger(TLMTags.State.tagName, state.ordinal());
itemStack.setTagCompound(data);
inventory.setInventorySlotContents(SLOT_IN, itemStack);
return inventory;
AeStackInventoryImpl<IAEItemStack> inv = new AeStackInventoryImpl<>(StorageChannel.ITEMS, 1);
inv.setStack(SLOT_IN, AEItemStack.create(itemStack));
return new AeItemStackHandler(inv);
}
@Override
@@ -1,13 +1,15 @@
package com.glodblock.github.nei;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import com.glodblock.github.client.gui.GuiFluidMonitor;
import com.glodblock.github.client.gui.GuiItemMonitor;
import com.glodblock.github.client.gui.GuiLevelMaintainer;
import codechicken.nei.api.INEIGuiAdapter;
public class NEIGuiHandler extends INEIGuiAdapter {
public class AE2FC_NEIGuiHandler extends INEIGuiAdapter {
@Override
public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) {
@@ -18,4 +20,12 @@ public class NEIGuiHandler extends INEIGuiAdapter {
}
return false;
}
@Override
public boolean handleDragNDrop(GuiContainer gui, int mouseX, int mouseY, ItemStack draggedStack, int button) {
if (gui instanceof GuiLevelMaintainer guiLevelMaintainer) {
return guiLevelMaintainer.handleDragNDrop(gui, mouseX, mouseY, draggedStack, button);
}
return super.handleDragNDrop(gui, mouseX, mouseY, draggedStack, button);
}
}
@@ -17,7 +17,7 @@ public class NEI_FC_Config implements IConfigureNEI {
@Override
public void loadConfig() {
API.registerNEIGuiHandler(new NEIGuiHandler());
API.registerNEIGuiHandler(new AE2FC_NEIGuiHandler());
API.addSearchProvider(new NEIItemFilter());
API.registerStackStringifyHandler(new FCStackStringifyHandler());
@@ -2,7 +2,9 @@ package com.glodblock.github.network;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
@@ -13,10 +15,13 @@ import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.common.util.ForgeDirection;
import com.glodblock.github.client.gui.GuiLevelTerminal;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.features.AEFeature;
import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
@@ -45,9 +50,9 @@ public class SPacketLevelTerminalUpdate implements IMessage {
int numEntries = buf.readInt();
for (int i = 0; i < numEntries; ++i) {
PacketType type = PacketType.values()[buf.readByte()];
try {
PacketType type = PacketType.values()[buf.readByte()];
switch (type) {
case ADD -> this.commands.add(new PacketAdd(buf));
case REMOVE -> this.commands.add(new PacketRemove(buf));
@@ -56,14 +61,46 @@ public class SPacketLevelTerminalUpdate implements IMessage {
default -> throw new IOException("Unknown packet type received of index " + type);
}
} catch (Exception e) {
if (AEConfig.instance.isFeatureEnabled(AEFeature.PacketLogging)) {
AELog.info(
"Corrupted packet commands: (" + i
+ ") of ("
+ numEntries
+ ") -> "
+ this.commands.size()
+ " : "
+ this.commands.stream().map(packetEntry -> packetEntry.getClass().getSimpleName())
.collect(Collectors.groupingBy(String::new, Collectors.counting())));
if (AEConfig.instance.isFeatureEnabled(AEFeature.DebugLogging)) {
AELog.info(" <- Parsed content: " + this.commands);
}
}
AELog.debug(e);
return;
}
}
if (AEConfig.instance.isFeatureEnabled(AEFeature.PacketLogging)) {
AELog.info(
" <- Received commands " + this.commands.size()
+ " : "
+ this.commands.stream().map(packetEntry -> packetEntry.getClass().getSimpleName())
.collect(Collectors.groupingBy(String::new, Collectors.counting())));
}
}
public void toBytes(ByteBuf buf) {
try {
if (AEConfig.instance.isFeatureEnabled(AEFeature.PacketLogging)) {
AELog.info(
" <- Sent commands " + this.commands.size()
+ " : "
+ this.commands.stream().map(packetEntry -> packetEntry.getClass().getSimpleName())
.collect(Collectors.groupingBy(String::new, Collectors.counting())));
if (AEConfig.instance.isFeatureEnabled(AEFeature.DebugLogging)) {
AELog.info(" -> Sent commands: " + this.commands);
}
}
buf.writeByte(statusFlags);
buf.writeInt(commands.size());
for (PacketEntry entry : commands) {
@@ -232,7 +269,7 @@ public class SPacketLevelTerminalUpdate implements IMessage {
buf.writeInt(y);
buf.writeInt(z);
buf.writeInt(dim);
buf.writeInt(side);
buf.writeByte(side);
buf.writeInt(rows);
buf.writeInt(rowSize);
@@ -265,12 +302,34 @@ public class SPacketLevelTerminalUpdate implements IMessage {
this.y = buf.readInt();
this.z = buf.readInt();
this.dim = buf.readInt();
this.side = buf.readInt();
this.side = buf.readByte();
this.rows = buf.readInt();
this.rowSize = buf.readInt();
int payloadSize = buf.readInt();
try (ByteBufInputStream stream = new ByteBufInputStream(buf, payloadSize)) {
NBTTagCompound payload = CompressedStreamTools.readCompressed(stream);
int available = stream.available();
if (available > 0) {
byte[] left = new byte[available];
int read = stream.read(left);
if (AEConfig.instance.isFeatureEnabled(AEFeature.PacketLogging)) {
AELog.info(
"Unread bytes detected (" + read
+ "): "
+ Arrays.toString(left)
+ " at "
+ dim
+ "#("
+ x
+ ":"
+ y
+ ":"
+ z
+ ")@"
+ ForgeDirection.getOrientation(side));
}
}
if (payload.hasKey("self", NBT.TAG_COMPOUND)) {
this.selfItemStack = ItemStack.loadItemStackFromNBT(payload.getCompoundTag("self"));
}
@@ -282,6 +341,38 @@ public class SPacketLevelTerminalUpdate implements IMessage {
this.items = payload.getTagList("data", NBT.TAG_COMPOUND);
}
}
@Override
public String toString() {
return "PacketAdd{" + "name='"
+ name
+ '\''
+ ", x="
+ x
+ ", y="
+ y
+ ", z="
+ z
+ ", dim="
+ dim
+ ", side="
+ side
+ ", rows="
+ rows
+ ", rowSize="
+ rowSize
+ ", online="
+ online
+ ", selfItemStack="
+ selfItemStack
+ ", displayItemStack="
+ displayItemStack
+ ", items="
+ items
+ ", entryId="
+ entryId
+ '}';
}
}
public static class PacketRemove extends PacketEntry {
@@ -302,6 +393,11 @@ public class SPacketLevelTerminalUpdate implements IMessage {
@Override
protected void read(ByteBuf buf) {}
@Override
public String toString() {
return "PacketRemove{" + "entryId=" + entryId + '}';
}
}
/**
@@ -376,12 +472,19 @@ public class SPacketLevelTerminalUpdate implements IMessage {
buf.writeInt(validIndex);
}
}
try (ByteBufOutputStream stream = new ByteBufOutputStream(buf)) {
ByteBuf tempBuf = Unpooled.directBuffer(256);
try {
try (ByteBufOutputStream stream = new ByteBufOutputStream(tempBuf)) {
NBTTagCompound wrapper = new NBTTagCompound();
NBTTagCompound wrapper = new NBTTagCompound();
wrapper.setTag("data", items);
CompressedStreamTools.writeCompressed(wrapper, stream);
wrapper.setTag("data", items);
CompressedStreamTools.writeCompressed(wrapper, stream);
}
buf.writeInt(tempBuf.readableBytes());
buf.writeBytes(tempBuf);
} finally {
tempBuf.release();
}
} else {
buf.writeByte(flags);
@@ -411,12 +514,39 @@ public class SPacketLevelTerminalUpdate implements IMessage {
this.validIndices[i] = buf.readInt();
}
}
try (ByteBufInputStream stream = new ByteBufInputStream(buf)) {
int payloadSize = buf.readInt();
try (ByteBufInputStream stream = new ByteBufInputStream(buf, payloadSize)) {
this.items = CompressedStreamTools.readCompressed(stream).getTagList("data", NBT.TAG_COMPOUND);
int available = stream.available();
if (available > 0) {
byte[] left = new byte[available];
int read = stream.read(left);
if (AEConfig.instance.isFeatureEnabled(AEFeature.PacketLogging)) {
AELog.info("Unread bytes detected (" + read + "): " + Arrays.toString(left));
}
}
}
}
}
@Override
public String toString() {
return "PacketOverwrite{" + "onlineValid="
+ onlineValid
+ ", online="
+ online
+ ", itemsValid="
+ itemsValid
+ ", allItemUpdate="
+ allItemUpdate
+ ", validIndices="
+ Arrays.toString(validIndices)
+ ", items="
+ items
+ ", entryId="
+ entryId
+ '}';
}
}
/**
@@ -446,5 +576,10 @@ public class SPacketLevelTerminalUpdate implements IMessage {
protected void read(ByteBuf buf) {
newName = ByteBufUtils.readUTF8String(buf);
}
@Override
public String toString() {
return "PacketRename{" + "newName='" + newName + '\'' + ", entryId=" + entryId + '}';
}
}
}
@@ -65,9 +65,9 @@ public class CommonProxy {
Upgrades.CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_EXPORT_BUS), 1);
}
AEApi.instance().registries().externalStorage().addExternalStorageInterface(new AEFluidInterfaceHandler());
AEApi.instance().registries().ifaceTerm().register(PartFluidP2PInterface.class);
AEApi.instance().registries().ifaceTerm().register(PartFluidInterface.class);
AEApi.instance().registries().ifaceTerm().register(TileFluidInterface.class);
AEApi.instance().registries().interfaceTerminal().register(PartFluidP2PInterface.class);
AEApi.instance().registries().interfaceTerminal().register(PartFluidInterface.class);
AEApi.instance().registries().interfaceTerminal().register(TileFluidInterface.class);
}
public void registerRenderers() {}
@@ -94,7 +94,7 @@ ae2fc.tooltip.level_maintainer.link_desc=The system is currently crafting the re
ae2fc.tooltip.level_maintainer.export=§5Exporting§r
ae2fc.tooltip.level_maintainer.export_desc=The Requester is trying to export the crafting results to the system. If the Requester has this status for a long time, there is no available space for the export.
ae2fc.tooltip.level_maintainer.error=§4Errored§r
ae2fc.tooltip.level_maintainer.error_desc=The Requester is trying to schedule crafting job but it fails. Possible reasons no receipt found or insufficient resources to craft.
ae2fc.tooltip.level_maintainer.error_desc=The Requester is trying to schedule a crafting job but is failing. Possible reasons include a missing recipe or insufficient resources.
ae2fc.tooltip.level_maintainer.batch_size=§6Crafting Batch Size§r
ae2fc.tooltip.level_maintainer.batch_size.hint=When craft requests are emitted, the Requester will use the batch size for the request. Using larger batches will increase the speed of stocking up items but will require more crafting storage.
ae2fc.tooltip.level_maintainer.request_size=§6Amount to Maintain§r