diff --git a/src/main/java/noppes/npcs/client/gui/global/GuiAbilityDirectory.java b/src/main/java/noppes/npcs/client/gui/global/GuiAbilityDirectory.java index 7599bb18e..d9c82f45a 100644 --- a/src/main/java/noppes/npcs/client/gui/global/GuiAbilityDirectory.java +++ b/src/main/java/noppes/npcs/client/gui/global/GuiAbilityDirectory.java @@ -847,9 +847,11 @@ public class GuiAbilityDirectory extends GuiDirectoryCategorized GL11.glTranslatef(0.0F, entity.yOffset, 1F); RenderManager.instance.playerViewY = 180F; + ClientEventHandler.renderingEntityInGUI = true; try { RenderManager.instance.renderEntityWithPosYaw(entity, 0.0, 0.0, 0.0, 0.0F, 1.0F); } catch (Exception ignored) {} + ClientEventHandler.renderingEntityInGUI = false; entity.prevRenderYawOffset = entity.renderYawOffset = f2; entity.prevRotationYaw = entity.rotationYaw = f3; diff --git a/src/main/java/noppes/npcs/client/gui/global/GuiAnimationDirectory.java b/src/main/java/noppes/npcs/client/gui/global/GuiAnimationDirectory.java index e62c2dc81..6a5aeb478 100644 --- a/src/main/java/noppes/npcs/client/gui/global/GuiAnimationDirectory.java +++ b/src/main/java/noppes/npcs/client/gui/global/GuiAnimationDirectory.java @@ -35,6 +35,7 @@ import noppes.npcs.controllers.data.AnimationData; import noppes.npcs.controllers.data.Category; import noppes.npcs.controllers.data.Frame; import noppes.npcs.controllers.data.FramePart; +import noppes.npcs.client.ClientEventHandler; import noppes.npcs.entity.EntityCustomNpc; import noppes.npcs.entity.EntityNPCInterface; import org.lwjgl.opengl.GL11; @@ -478,10 +479,12 @@ public class GuiAnimationDirectory extends GuiDirectoryCategorized { GL11.glTranslatef(0.0F, entity.yOffset, 1F); RenderManager.instance.playerViewY = 180F; + ClientEventHandler.renderingEntityInGUI = true; try { RenderManager.instance.renderEntityWithPosYaw(entity, 0.0, 0.0, 0.0, 0.0F, 1.0F); } catch (Exception ignored) { } + ClientEventHandler.renderingEntityInGUI = false; entity.prevRenderYawOffset = entity.renderYawOffset = f2; entity.prevRotationYaw = entity.rotationYaw = f3; @@ -493,6 +496,8 @@ public class GuiAnimationDirectory extends GuiDirectoryCategorized { OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); + GL11.glDisable(GL11.GL_COLOR_MATERIAL); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); GL11.glPopMatrix(); } diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiDirectoryCategorized.java b/src/main/java/noppes/npcs/client/gui/util/GuiDirectoryCategorized.java index 38c508756..04717d8ed 100644 --- a/src/main/java/noppes/npcs/client/gui/util/GuiDirectoryCategorized.java +++ b/src/main/java/noppes/npcs/client/gui/util/GuiDirectoryCategorized.java @@ -63,6 +63,10 @@ public abstract class GuiDirectoryCategorized extends GuiDirectory // ========== New Item Category ========== protected int pendingNewItemCatId = -1; + // ========== Pending Move Destination ========== + private int pendingMoveDestCatId = -1; + private String pendingMoveDestName = ""; + // ========== Category Data Loaded ========== private boolean itemDataLoaded = false; @@ -231,16 +235,16 @@ public abstract class GuiDirectoryCategorized extends GuiDirectory catScroll.setSelected(prevCatName); catScroll.scrollY = Math.max(0, Math.min(savedCatScrollY, catScroll.maxScrollY)); - // Phase 1: categories are locked (RED labels, not clickable) + // Phase 1: categories locked (not clickable) if (movePhase == 1) { catScroll.setSelectable(false); - for (String name : navNames) { - catScroll.colors.put(name, 0xFF5555); - } } - // Phase 2: ensure scroll is clickable for destination selection + // Phase 2: color nav items orange (selectable) or red (current/source category) if (movePhase == 2) { catScroll.setSelectable(true); + for (String name : navNames) { + catScroll.colors.put(name, name.equals(prevCatName) ? 0xFF5555 : 0xFFAA00); + } } addScroll(catScroll); @@ -606,12 +610,14 @@ public abstract class GuiDirectoryCategorized extends GuiDirectory String selected = catScroll.getSelected(); if (selected == null) return; - // Move phase 2: destination selected + // Move phase 2: destination selected — show confirmation if (movePhase == 2) { if (!selected.equals(prevCatName)) { Integer destCatId = catData.get(selected); if (destCatId != null) { - executeMoveItems(destCatId); + pendingMoveDestCatId = destCatId; + pendingMoveDestName = selected; + setSubGui(new SubGuiCategoryMoveConfirm(moveSelection.size(), selected)); } } return; @@ -772,6 +778,16 @@ public abstract class GuiDirectoryCategorized extends GuiDirectory } } } + if (subgui instanceof SubGuiCategoryMoveConfirm) { + SubGuiCategoryMoveConfirm confirm = (SubGuiCategoryMoveConfirm) subgui; + if (confirm.confirmed && !moveSelection.isEmpty() && pendingMoveDestCatId >= 0) { + executeMoveItems(pendingMoveDestCatId); + } else { + // Cancelled — stay in phase 2 + } + pendingMoveDestCatId = -1; + pendingMoveDestName = ""; + } onSubGuiClosed(subgui); } diff --git a/src/main/java/noppes/npcs/client/gui/util/SubGuiCategoryMoveConfirm.java b/src/main/java/noppes/npcs/client/gui/util/SubGuiCategoryMoveConfirm.java new file mode 100644 index 000000000..d4b7e79ea --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/SubGuiCategoryMoveConfirm.java @@ -0,0 +1,48 @@ +package noppes.npcs.client.gui.util; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.util.StatCollector; + +public class SubGuiCategoryMoveConfirm extends SubGuiInterface { + public boolean confirmed = false; + + private final int count; + public final String destCategoryName; + + public SubGuiCategoryMoveConfirm(int count, String destCategoryName) { + this.count = count; + this.destCategoryName = destCategoryName; + xSize = 220; + ySize = 90; + closeOnEsc = true; + } + + @Override + public void initGui() { + super.initGui(); + + String line1 = String.format(StatCollector.translateToLocal("gui.move.confirmLine"), count); + addLabel(new GuiNpcLabel(0, line1, guiLeft + 10, guiTop + 10, 0xFFFFFF)); + + String dest = StatCollector.translateToLocal("gui.category") + ": \"" + destCategoryName + "\""; + addLabel(new GuiNpcLabel(1, " " + dest, guiLeft + 10, guiTop + 25, 0xFFFFFF)); + + addButton(new GuiNpcButton(0, guiLeft + 10, guiTop + 55, 95, 20, "gui.yes")); + addButton(new GuiNpcButton(1, guiLeft + 115, guiTop + 55, 95, 20, "gui.cancel")); + } + + @Override + protected void actionPerformed(GuiButton guibutton) { + if (guibutton.id == 0) { + confirmed = true; + close(); + } + if (guibutton.id == 1) { + close(); + } + } + + @Override + public void save() { + } +} diff --git a/src/main/resources/assets/customnpcs/lang/en_US.lang b/src/main/resources/assets/customnpcs/lang/en_US.lang index d94408caa..13fa4fc07 100644 --- a/src/main/resources/assets/customnpcs/lang/en_US.lang +++ b/src/main/resources/assets/customnpcs/lang/en_US.lang @@ -2470,3 +2470,5 @@ animation.mirror=Mirror gui.builtin.tag=(Built-in) ability.damage=Damage ability.allowed=Allowed +gui.move.confirmLine=Move %d item(s) to: +gui.category=Category