Magic Packet Fixes

This commit is contained in:
Kam committed 2025-03-03 23:03:12 -05:00
1 parent c2fa74c541
commit 4e6d6b7082
13 files changed
+177 -54

No files matched your search

@@ -9,6 +9,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.client.gui.util.GuiDiagram;
import noppes.npcs.client.gui.util.GuiNPCInterface;
import noppes.npcs.constants.EnumDiagramLayout;
import noppes.npcs.controllers.MagicController;
import noppes.npcs.controllers.data.Magic;
import org.lwjgl.opengl.GL11;
@@ -32,7 +33,7 @@ public class GuiMagicMap extends GuiDiagram {
for (Magic magic : MagicController.getInstance().magics.values()) {
magics.add(magic);
}
setLayout(DiagramLayout.CIRCULAR_MANUAL);
setLayout(EnumDiagramLayout.CIRCULAR_MANUAL);
this.setCurvedArrows(true);
this.setCurveAngle(-20);
}
@@ -20,7 +20,6 @@ import noppes.npcs.controllers.data.MagicCycle;
import noppes.npcs.entity.EntityNPCInterface;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.nbt.NBTTagCompound;
import org.lwjgl.input.Mouse;
import static noppes.npcs.client.gui.player.inventory.GuiCNPCInventory.specialIcons;
@@ -330,7 +329,7 @@ public class GuiNpcManageMagic extends GuiNPCInterface2 implements ISubGuiListen
if (scroll.id == 0) { // Left scroll: cycles
String cycleName = scroll.getSelected();
for (MagicCycle cycle : MagicController.getInstance().cycles.values()) {
if (cycle.title.equals(cycleName)) {
if (cycle.name.equals(cycleName)) {
selectedCycle = cycle;
break;
}
@@ -28,7 +28,7 @@ public class SubGuiMagicCycleEdit extends SubGuiInterface implements ITextfieldL
@Override
public void initGui() {
super.initGui();
addLabel(new GuiNpcLabel(0, "Cycle: " + cycle.title, guiLeft + 4, guiTop + 4));
addLabel(new GuiNpcLabel(0, "Cycle: " + cycle.name, guiLeft + 4, guiTop + 4));
// Build list of associations in the cycle (format: "MagicID: X | Index: Y | Priority: Z")
assocList.clear();
@@ -4,6 +4,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import noppes.npcs.constants.EnumDiagramLayout;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@@ -54,17 +55,12 @@ public abstract class GuiDiagram extends Gui {
protected boolean useColorScaling = true; // Scale connection color based on a percentage
// --- Layout Options ---
public enum DiagramLayout {
CIRCULAR, SQUARE, TREE, GENERATED,
CIRCULAR_MANUAL, SQUARE_MANUAL, TREE_MANUAL,
CHART
}
protected DiagramLayout layout = DiagramLayout.CIRCULAR; // Default layout
protected EnumDiagramLayout layout = EnumDiagramLayout.CIRCULAR; // Default layout
/**
* Sets the layout type and invalidates caches.
*/
public void setLayout(DiagramLayout layout) {
public void setLayout(EnumDiagramLayout layout) {
this.layout = layout;
invalidateCache();
}
@@ -160,7 +156,7 @@ public abstract class GuiDiagram extends Gui {
*/
protected Map<Integer, Point> calculatePositions() {
if (cachedPositions != null) return cachedPositions;
if (layout == DiagramLayout.CHART) {
if (layout == EnumDiagramLayout.CHART) {
return new HashMap<>();
}
switch (layout) {
@@ -964,7 +960,7 @@ public abstract class GuiDiagram extends Gui {
boolean allowInput = (parent == null || !parent.hasSubGui());
if (allowInput && isWithin(mouseX, mouseY) && !subGui)
handleMouseScroll(Mouse.getDWheel());
if (layout == DiagramLayout.CHART) {
if (layout == EnumDiagramLayout.CHART) {
drawChartDiagram(mouseX, mouseY, subGui);
return;
}