From 131f874329f68036d20ee4b31a15675e25a3f905 Mon Sep 17 00:00:00 2001 From: Jikoo Date: Tue, 1 Mar 2016 11:44:38 -0500 Subject: [PATCH] Added offhand slot display and manipulation --- .../v1_9_R1/SpecialPlayerInventory.java | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/com/lishid/openinv/internal/v1_9_R1/SpecialPlayerInventory.java b/src/com/lishid/openinv/internal/v1_9_R1/SpecialPlayerInventory.java index 276b080..3316c58 100644 --- a/src/com/lishid/openinv/internal/v1_9_R1/SpecialPlayerInventory.java +++ b/src/com/lishid/openinv/internal/v1_9_R1/SpecialPlayerInventory.java @@ -130,12 +130,19 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP if (i >= is.length) { i -= is.length; - is = this.extra; + is = this.extraSlots; } else if (is == this.armor) { i = getReversedArmorSlotNum(i); } + if (i >= is.length) { + i -= is.length; + is = this.extra; + } + + // extraSlots is, for now, just an array with length 1. No need for special handling. + return is[i]; } @@ -153,12 +160,17 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP if (i >= is.length) { i -= is.length; - is = this.extra; + is = this.extraSlots; } else if (is == this.armor) { i = getReversedArmorSlotNum(i); } + if (i >= is.length) { + i -= is.length; + is = this.extra; + } + if (is[i] != null) { ItemStack itemstack; @@ -195,12 +207,17 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP if (i >= is.length) { i -= is.length; - is = this.extra; + is = this.extraSlots; } else if (is == this.armor) { i = getReversedArmorSlotNum(i); } + if (i >= is.length) { + i -= is.length; + is = this.extra; + } + if (is[i] != null) { ItemStack itemstack = is[i]; @@ -226,12 +243,17 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP if (i >= is.length) { i -= is.length; - is = this.extra; + is = this.extraSlots; } else if (is == this.armor) { i = getReversedArmorSlotNum(i); } + if (i >= is.length) { + i -= is.length; + is = this.extra; + } + // Effects if (is == this.extra) { owner.getHandle().drop(itemstack, true);