From f402113f950150236108207cb566bd627f7257d3 Mon Sep 17 00:00:00 2001 From: Isaiah <73615108+lightningik@users.noreply.github.com> Date: Mon, 2 Oct 2023 08:36:59 -0700 Subject: Add separate locked slots for rift and overworld. (#848) * Add separate locked slots for rift and overworld. * Remove unnecessary currentProfile int. * Fix errors from removing currentProfile --------- Co-authored-by: LightningYTlol --- .../notenoughupdates/miscfeatures/SlotLocking.java | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java index b447cf61..c8ac39b2 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java @@ -72,6 +72,7 @@ public class SlotLocking { private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); private static final LockedSlot DEFAULT_LOCKED_SLOT = new LockedSlot(); + private final ResourceLocation LOCK = new ResourceLocation("notenoughupdates:slotlocking/lock.png"); private final ResourceLocation BOUND = new ResourceLocation("notenoughupdates:slotlocking/bound.png"); @@ -82,16 +83,17 @@ public class SlotLocking { public static class LockedSlot { public boolean locked = false; public int boundTo = -1; + } public static class SlotLockData { public LockedSlot[] lockedSlots = new LockedSlot[40]; + public LockedSlot[] riftLockedSlots = new LockedSlot[40]; } public static class SlotLockProfile { - int currentProfile = 0; - public SlotLockData[] slotLockData = new SlotLockData[9]; + public SlotLockData[] slotLockData = new SlotLockData[1]; } public static class SlotLockingConfig { @@ -189,14 +191,17 @@ public class SlotLocking { k -> new SlotLockProfile() ); - if (profile.currentProfile < 0) profile.currentProfile = 0; - if (profile.currentProfile >= 9) profile.currentProfile = 8; - if (profile.slotLockData[profile.currentProfile] == null) { - profile.slotLockData[profile.currentProfile] = new SlotLockData(); + if (profile.slotLockData[0] == null) { + profile.slotLockData[0] = new SlotLockData(); } - return profile.slotLockData[profile.currentProfile].lockedSlots; + + if (!"rift".equals(SBInfo.getInstance().getLocation())) { + return profile.slotLockData[0].lockedSlots; + } else { + return profile.slotLockData[0].riftLockedSlots; + } } private LockedSlot getLockedSlot(LockedSlot[] lockedSlots, int index) { @@ -204,6 +209,7 @@ public class SlotLocking { return DEFAULT_LOCKED_SLOT; } + LockedSlot slot = lockedSlots[index]; if (slot == null) { -- cgit