diff --git a/src/main/java/littleservantmod/client/gui/inventory/GuiServantInventory.java b/src/main/java/littleservantmod/client/gui/inventory/GuiServantInventory.java index ed70161..0262285 100644 --- a/src/main/java/littleservantmod/client/gui/inventory/GuiServantInventory.java +++ b/src/main/java/littleservantmod/client/gui/inventory/GuiServantInventory.java @@ -115,8 +115,8 @@ protected void renderCurrentSlot() { int i = this.guiLeft; int j = this.guiTop; - int i1 = 6 + 18 * (this.servant.inventory.currentItem % 9); - int ij = 74 + 18 * (this.servant.inventory.currentItem / 9); + int i1 = 6 + 18 * (this.servant.inventory.currentIndex[0] % 9); + int ij = 74 + 18 * (this.servant.inventory.currentIndex[0] / 9); this.drawTexturedModalRect(i + i1, j + ij, 176, 0, 20, 20); diff --git a/src/main/java/littleservantmod/entity/EntityLittleServantFakePlayer.java b/src/main/java/littleservantmod/entity/EntityLittleServantFakePlayer.java index cebf60c..801b960 100644 --- a/src/main/java/littleservantmod/entity/EntityLittleServantFakePlayer.java +++ b/src/main/java/littleservantmod/entity/EntityLittleServantFakePlayer.java @@ -55,7 +55,8 @@ public abstract class EntityLittleServantFakePlayer extends EntityLittleServantB public InventoryServant inventory; private IItemHandler inventoryHandler; - protected static final DataParameter CURRENT_ITEN = EntityDataManager.createKey(EntityLittleServantBase.class, DataSerializers.VARINT); + protected static final DataParameter MAIN_HAND_ITEM = EntityDataManager.createKey(EntityLittleServantBase.class, DataSerializers.VARINT); + protected static final DataParameter OFF_HAND_ITEM = EntityDataManager.createKey(EntityLittleServantBase.class, DataSerializers.VARINT); public static final net.minecraft.entity.ai.attributes.IAttribute REACH_DISTANCE = new net.minecraft.entity.ai.attributes.RangedAttribute(null, "generic.reachDistance", 5.0D, 0.0D, 1024.0D).setShouldWatch(true); @@ -77,7 +78,8 @@ protected void entityInit() { if (!world.isRemote) this.player = FakePlayerFactory.getMinecraft((WorldServer) world); this.inventory = new InventoryServant((EntityLittleServant) this, player); this.inventoryHandler = new InvWrapper(this.inventory); - this.dataManager.register(CURRENT_ITEN, 0); + this.dataManager.register(MAIN_HAND_ITEM, this.inventory.currentIndex[0]); + this.dataManager.register(OFF_HAND_ITEM, this.inventory.currentIndex[1]); } @@ -122,12 +124,10 @@ public Iterable getArmorInventoryList() { * */ @Override public ItemStack getItemStackFromSlot(EntityEquipmentSlot slotIn) { - if (slotIn == EntityEquipmentSlot.MAINHAND) { - return this.inventory.getCurrentItem(); - } else if (slotIn == EntityEquipmentSlot.OFFHAND) { - return this.inventory.offHandInventory.get(0); - } else { - return slotIn.getSlotType() == EntityEquipmentSlot.Type.ARMOR ? this.inventory.armorInventory.get(slotIn.getIndex()) : ItemStack.EMPTY; + switch (slotIn.getSlotType()) { + case HAND: return this.inventory.getItemInHand(slotIn.getIndex() == 0 ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND); + case ARMOR: return this.inventory.armorInventory.get(slotIn.getIndex()); + default: return ItemStack.EMPTY; } } @@ -136,15 +136,14 @@ public ItemStack getItemStackFromSlot(EntityEquipmentSlot slotIn) { */ @Override public void setItemStackToSlot(EntityEquipmentSlot slotIn, ItemStack stack) { - if (slotIn == EntityEquipmentSlot.MAINHAND) { - this.playEquipSound(stack); - this.inventory.mainInventory.set(this.inventory.currentItem, stack); - } else if (slotIn == EntityEquipmentSlot.OFFHAND) { - this.playEquipSound(stack); - this.inventory.offHandInventory.set(0, stack); - } else if (slotIn.getSlotType() == EntityEquipmentSlot.Type.ARMOR) { - this.playEquipSound(stack); - this.inventory.armorInventory.set(slotIn.getIndex(), stack); + switch (slotIn.getSlotType()){ + case HAND: + this.playEquipSound(stack); + this.inventory.mainInventory.set(this.inventory.currentIndex[slotIn.getIndex()], stack); + break; + case ARMOR: + this.playEquipSound(stack); + this.inventory.armorInventory.set(slotIn.getIndex(), stack); } } @@ -443,22 +442,32 @@ public CooldownTracker getCooldownTracker() { return this.cooldownTracker; } - public int getCurrentItem() { - return this.dataManager.get(CURRENT_ITEN); + public int[] getItemsInHand(){ + return new int[]{getItemInHand(EnumHand.MAIN_HAND),getItemInHand(EnumHand.OFF_HAND)}; + } + + public int getItemInHand(EnumHand hand) { + return this.dataManager.get(hand == EnumHand.MAIN_HAND ? MAIN_HAND_ITEM : OFF_HAND_ITEM); } - public void setCurrentItem(int currentItem) { - this.inventory.currentItem = currentItem; - this.dataManager.set(CURRENT_ITEN, currentItem); + public void setItemInHand(int index, EnumHand hand) { + this.inventory.currentIndex[hand.ordinal()] = index; + this.dataManager.set(hand == EnumHand.MAIN_HAND ? MAIN_HAND_ITEM : OFF_HAND_ITEM, index); } @Override public void notifyDataManagerChange(DataParameter key) { super.notifyDataManagerChange(key); - if (CURRENT_ITEN.equals(key) && this.world.isRemote) { + if (MAIN_HAND_ITEM.equals(key) && this.world.isRemote) { + + this.inventory.currentIndex[EnumHand.MAIN_HAND.ordinal()] = getItemInHand(EnumHand.MAIN_HAND); + + } + + if (OFF_HAND_ITEM.equals(key) && this.world.isRemote) { - this.inventory.currentItem = getCurrentItem(); + this.inventory.currentIndex[EnumHand.OFF_HAND.ordinal()] = getItemInHand(EnumHand.OFF_HAND); } @@ -469,7 +478,7 @@ public void readEntityFromNBT(NBTTagCompound compound) { super.readEntityFromNBT(compound); NBTTagList nbttaglist = compound.getTagList("Inventory", 10); this.inventory.readFromNBT(nbttaglist); - this.inventory.currentItem = compound.getInteger("SelectedItemSlot"); + this.inventory.currentIndex = compound.getIntArray("InHandIndexes"); } @@ -478,7 +487,8 @@ public void writeEntityToNBT(NBTTagCompound compound) { super.writeEntityToNBT(compound); compound.setTag("Inventory", this.inventory.writeToNBT(new NBTTagList())); // compound.setInteger("SelectedItemSlot", this.inventory.currentItem); - compound.setInteger("SelectedItemSlot", this.getCurrentItem()); + // compound.setInteger("SelectedItemSlot", this.getCurrentItem()); + compound.setIntArray("InHandIndexes", this.getItemsInHand()); } diff --git a/src/main/java/littleservantmod/entity/InventoryServant.java b/src/main/java/littleservantmod/entity/InventoryServant.java index 2fd8c17..5370e62 100644 --- a/src/main/java/littleservantmod/entity/InventoryServant.java +++ b/src/main/java/littleservantmod/entity/InventoryServant.java @@ -1,11 +1,5 @@ package littleservantmod.entity; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - -import javax.annotation.Nullable; - import net.minecraft.block.state.IBlockState; import net.minecraft.client.util.RecipeItemHelper; import net.minecraft.crash.CrashReport; @@ -21,6 +15,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTUtil; +import net.minecraft.util.EnumHand; import net.minecraft.util.NonNullList; import net.minecraft.util.ReportedException; import net.minecraft.util.text.ITextComponent; @@ -30,20 +25,24 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import javax.annotation.Nullable; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; + /** * Servantの持ち物処理 - * @author shift02 * + * @author shift02 */ public class InventoryServant implements IInventory { /** An array of 36 item stacks indicating the main player inventory (including the visible bar). */ - public final NonNullList mainInventory = NonNullList. withSize(16, ItemStack.EMPTY); + public final NonNullList mainInventory = NonNullList.withSize(17, ItemStack.EMPTY); /** An array of 4 item stacks containing the currently worn armor pieces. */ - public final NonNullList armorInventory = NonNullList. withSize(4, ItemStack.EMPTY); - public final NonNullList offHandInventory = NonNullList. withSize(1, ItemStack.EMPTY); + public final NonNullList armorInventory = NonNullList.withSize(4, ItemStack.EMPTY); private final List> allInventories; - /** The index of the currently held item (0-8). */ - public int currentItem; + + public int[] currentIndex = new int[]{0, -1}; /** The player whose inventory this is. */ public EntityLittleServant servant; public EntityPlayer player; @@ -52,24 +51,16 @@ public class InventoryServant implements IInventory { private int timesChanged; public InventoryServant(EntityLittleServant servantIn, EntityPlayer player) { - this.allInventories = Arrays.> asList(this.mainInventory, this.armorInventory, this.offHandInventory); + this.allInventories = Arrays.>asList(this.mainInventory, this.armorInventory); this.itemStack = ItemStack.EMPTY; this.servant = servantIn; this.player = player; } - /** - * Returns the item stack currently held by the player. - */ - public ItemStack getCurrentItem() { - return isHotbar(this.currentItem) ? (ItemStack) this.mainInventory.get(this.currentItem) : ItemStack.EMPTY; - } - - /** - * Get the size of the player hotbar inventory - */ - public static int getHotbarSize() { - return 18; + public ItemStack getItemInHand(EnumHand hand) { + int index = this.currentIndex[hand.ordinal()]; + if (index < 0 || index >= this.mainInventory.size()) return ItemStack.EMPTY; + return this.mainInventory.get(index); } private boolean canMergeStacks(ItemStack stack1, ItemStack stack2) { @@ -96,43 +87,6 @@ public int getFirstEmptyStack() { return -1; } - @SideOnly(Side.CLIENT) - public void setPickedItemStack(ItemStack stack) { - int i = this.getSlotFor(stack); - - if (isHotbar(i)) { - this.currentItem = i; - } else { - if (i == -1) { - this.currentItem = this.getBestHotbarSlot(); - - if (!this.mainInventory.get(this.currentItem).isEmpty()) { - int j = this.getFirstEmptyStack(); - - if (j != -1) { - this.mainInventory.set(j, this.mainInventory.get(this.currentItem)); - } - } - - this.mainInventory.set(this.currentItem, stack); - } else { - this.pickItem(i); - } - } - } - - public void pickItem(int index) { - this.currentItem = this.getBestHotbarSlot(); - ItemStack itemstack = this.mainInventory.get(this.currentItem); - this.mainInventory.set(this.currentItem, this.mainInventory.get(index)); - this.mainInventory.set(index, itemstack); - } - - public static boolean isHotbar(int index) { - //サーヴァントは強いので持ち物全てを道具として使える - return index >= 0 && index < 18;//9; - } - /** * Finds the stack or an equivalent one in the main inventory */ @@ -159,48 +113,6 @@ public int findSlotMatchingUnusedItem(ItemStack p_194014_1_) { return -1; } - public int getBestHotbarSlot() { - for (int i = 0; i < 9; ++i) { - int j = (this.currentItem + i) % 9; - - if (this.mainInventory.get(j).isEmpty()) { - return j; - } - } - - for (int k = 0; k < 9; ++k) { - int l = (this.currentItem + k) % 9; - - if (!this.mainInventory.get(l).isItemEnchanted()) { - return l; - } - } - - return this.currentItem; - } - - /** - * Switch the current item to the next one or the previous one - */ - @SideOnly(Side.CLIENT) - public void changeCurrentItem(int direction) { - if (direction > 0) { - direction = 1; - } - - if (direction < 0) { - direction = -1; - } - - for (this.currentItem -= direction; this.currentItem < 0; this.currentItem += 9) { - ; - } - - while (this.currentItem >= 9) { - this.currentItem -= 9; - } - } - /** * Removes matching items from the inventory. * @param itemIn The item to match, null ignores. @@ -320,10 +232,10 @@ private int addResource(int p_191973_1_, ItemStack p_191973_2_) { * stores an itemstack in the users inventory */ public int storeItemStack(ItemStack itemStackIn) { - if (this.canMergeStacks(this.getStackInSlot(this.currentItem), itemStackIn)) { - return this.currentItem; - } else if (this.canMergeStacks(this.getStackInSlot(40), itemStackIn)) { - return 40; + if (this.canMergeStacks(this.getItemInHand(EnumHand.MAIN_HAND), itemStackIn)) { + return this.currentIndex[EnumHand.MAIN_HAND.ordinal()]; + } else if (this.canMergeStacks(this.getItemInHand(EnumHand.OFF_HAND), itemStackIn)) { + return this.currentIndex[EnumHand.OFF_HAND.ordinal()]; } else { for (int i = 0; i < this.mainInventory.size(); ++i) { if (this.canMergeStacks(this.mainInventory.get(i), itemStackIn)) { @@ -343,7 +255,7 @@ public void decrementAnimations() { for (NonNullList nonnulllist : this.allInventories) { for (int i = 0; i < nonnulllist.size(); ++i) { if (!nonnulllist.get(i).isEmpty()) { - nonnulllist.get(i).updateAnimation(this.servant.world, this.servant, i, this.currentItem == i); + nonnulllist.get(i).updateAnimation(this.servant.world, this.servant, i, this.currentIndex[EnumHand.MAIN_HAND.ordinal()] == i); } } } @@ -525,8 +437,8 @@ public void setInventorySlotContents(int index, ItemStack stack) { public float getDestroySpeed(IBlockState state) { float f = 1.0F; - if (!this.mainInventory.get(this.currentItem).isEmpty()) { - f *= this.mainInventory.get(this.currentItem).getDestroySpeed(state); + if (!this.getItemInHand(EnumHand.MAIN_HAND).isEmpty()) { + f *= this.getItemInHand(EnumHand.MAIN_HAND).getDestroySpeed(state); } return f; @@ -555,15 +467,6 @@ public NBTTagList writeToNBT(NBTTagList nbtTagListIn) { } } - for (int k = 0; k < this.offHandInventory.size(); ++k) { - if (!this.offHandInventory.get(k).isEmpty()) { - NBTTagCompound nbttagcompound2 = new NBTTagCompound(); - nbttagcompound2.setByte("Slot", (byte) (k + 150)); - this.offHandInventory.get(k).writeToNBT(nbttagcompound2); - nbtTagListIn.appendTag(nbttagcompound2); - } - } - return nbtTagListIn; } @@ -573,7 +476,6 @@ public NBTTagList writeToNBT(NBTTagList nbtTagListIn) { public void readFromNBT(NBTTagList nbtTagListIn) { this.mainInventory.clear(); this.armorInventory.clear(); - this.offHandInventory.clear(); for (int i = 0; i < nbtTagListIn.tagCount(); ++i) { NBTTagCompound nbttagcompound = nbtTagListIn.getCompoundTagAt(i); @@ -585,8 +487,8 @@ public void readFromNBT(NBTTagList nbtTagListIn) { this.mainInventory.set(j, itemstack); } else if (j >= 100 && j < this.armorInventory.size() + 100) { this.armorInventory.set(j - 100, itemstack); - } else if (j >= 150 && j < this.offHandInventory.size() + 150) { - this.offHandInventory.set(j - 150, itemstack); + } else if (j == 150) { + this.mainInventory.set(this.mainInventory.size() - 1, itemstack); } } } @@ -597,7 +499,7 @@ public void readFromNBT(NBTTagList nbtTagListIn) { */ @Override public int getSizeInventory() { - return this.mainInventory.size() + this.armorInventory.size() + this.offHandInventory.size(); + return this.mainInventory.size() + this.armorInventory.size(); } @Override @@ -614,12 +516,6 @@ public boolean isEmpty() { } } - for (ItemStack itemstack2 : this.offHandInventory) { - if (!itemstack2.isEmpty()) { - return false; - } - } - return true; } @@ -678,8 +574,8 @@ public boolean canHarvestBlock(IBlockState state) { if (state.getMaterial().isToolNotRequired()) { return true; } else { - ItemStack itemstack = this.getStackInSlot(this.currentItem); - return !itemstack.isEmpty() ? itemstack.canHarvestBlock(state) : false; + ItemStack itemstack = this.getItemInHand(EnumHand.MAIN_HAND); + return !itemstack.isEmpty() && itemstack.canHarvestBlock(state); } } @@ -813,12 +709,12 @@ public boolean isItemValidForSlot(int index, ItemStack stack) { /** * Copy the ItemStack contents from another InventoryPlayer instance */ - public void copyInventory(InventoryPlayer playerInventory) { + public void copyInventory(InventoryServant servantInventory) { for (int i = 0; i < this.getSizeInventory(); ++i) { - this.setInventorySlotContents(i, playerInventory.getStackInSlot(i)); + this.setInventorySlotContents(i, servantInventory.getStackInSlot(i)); } - this.currentItem = playerInventory.currentItem; + this.currentIndex = servantInventory.currentIndex; } @Override @@ -846,9 +742,5 @@ public void fillStackedContents(RecipeItemHelper helper, boolean p_194016_2_) { for (ItemStack itemstack : this.mainInventory) { helper.accountStack(itemstack); } - - if (p_194016_2_) { - helper.accountStack(this.offHandInventory.get(0)); - } } } \ No newline at end of file diff --git a/src/main/java/littleservantmod/entity/ai/EntityAIEquip.java b/src/main/java/littleservantmod/entity/ai/EntityAIEquip.java index 3e71fb7..c6876ef 100644 --- a/src/main/java/littleservantmod/entity/ai/EntityAIEquip.java +++ b/src/main/java/littleservantmod/entity/ai/EntityAIEquip.java @@ -1,12 +1,9 @@ package littleservantmod.entity.ai; +import littleservantmod.entity.EntityLittleServantFakePlayer; import net.minecraft.entity.ai.EntityAIBase; -import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.items.CapabilityItemHandler; -import net.minecraftforge.items.IItemHandlerModifiable; +import net.minecraft.util.EnumHand; import org.apache.commons.lang3.tuple.Pair; import java.util.function.Predicate; @@ -14,40 +11,38 @@ public class EntityAIEquip extends EntityAIBase { - private final IItemHandlerModifiable inventory; - private final IItemHandlerModifiable equipments; - private final EntityEquipmentSlot equipmentSlot; + private final EntityLittleServantFakePlayer servant; + private final int defaultIndex; + private final EnumHand hand; private final Predicate shouldEquip; - public EntityAIEquip(ICapabilityProvider servant, EntityEquipmentSlot equipmentSlot, Predicate shouldEquip) { - - if (!servant.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)) - throw new IllegalArgumentException(); - this.inventory = (IItemHandlerModifiable) servant.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); - this.equipments = (IItemHandlerModifiable) servant.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.VALUES[equipmentSlot.ordinal()]); - this.equipmentSlot = equipmentSlot; + public EntityAIEquip(EntityLittleServantFakePlayer servant, int defaultIndex, EnumHand hand, Predicate shouldEquip) { + this.servant = servant; + this.defaultIndex = defaultIndex; + this.hand = hand; this.shouldEquip = shouldEquip; + } + public EntityAIEquip(EntityLittleServantFakePlayer servant, EnumHand hand, Predicate shouldEquip) { + this(servant, -1, hand, shouldEquip); } @Override public boolean shouldExecute() { - return !this.shouldEquip.test(this.equipments.getStackInSlot(this.equipmentSlot.getIndex())); + return !this.shouldEquip.test(this.servant.inventory.getItemInHand(hand)); } @Override public void updateTask() { - IntStream.range(0, this.inventory.getSlots()) + int index = IntStream.range(0, this.servant.inventory.mainInventory.size()) .parallel() - .mapToObj(i -> Pair.of(i, this.inventory.getStackInSlot(i))) - .filter(p -> this.shouldEquip.test(p.getRight())) + .filter(i -> this.shouldEquip.test(this.servant.inventory.mainInventory.get(i))) .findAny() - .ifPresent(p -> { - this.inventory.setStackInSlot(p.getLeft(), this.equipments.getStackInSlot(this.equipmentSlot.getIndex())); - this.equipments.setStackInSlot(this.equipmentSlot.getIndex(), p.getRight()); - }); + .orElse(defaultIndex); + + this.servant.setItemInHand(index, hand); } diff --git a/src/main/java/littleservantmod/entity/ai/EntityAIEquipShield.java b/src/main/java/littleservantmod/entity/ai/EntityAIEquipShield.java index 53719a5..c94026e 100644 --- a/src/main/java/littleservantmod/entity/ai/EntityAIEquipShield.java +++ b/src/main/java/littleservantmod/entity/ai/EntityAIEquipShield.java @@ -4,6 +4,7 @@ import net.minecraft.init.Items; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumHand; import java.util.function.Predicate; @@ -17,7 +18,7 @@ public class EntityAIEquipShield extends EntityAIEquip { private static final Predicate IS_SHIELD = SHIELD::isItemEqualIgnoreDurability; public EntityAIEquipShield(EntityLittleServant servant) { - super(servant, EntityEquipmentSlot.OFFHAND, IS_SHIELD); + super(servant, EnumHand.OFF_HAND, IS_SHIELD); } } diff --git a/src/main/java/littleservantmod/entity/ai/EntityAIEquipTool.java b/src/main/java/littleservantmod/entity/ai/EntityAIEquipTool.java index f7c4bea..ccee45f 100644 --- a/src/main/java/littleservantmod/entity/ai/EntityAIEquipTool.java +++ b/src/main/java/littleservantmod/entity/ai/EntityAIEquipTool.java @@ -3,12 +3,13 @@ import littleservantmod.entity.EntityLittleServant; import littleservantmod.profession.ProfessionToolManager; import net.minecraft.inventory.EntityEquipmentSlot; +import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; public class EntityAIEquipTool extends EntityAIEquip { public EntityAIEquipTool(EntityLittleServant servant, ResourceLocation type) { - super(servant, EntityEquipmentSlot.MAINHAND, stack -> ProfessionToolManager.getInstance().isTool(type, stack)); + super(servant, 0, EnumHand.MAIN_HAND, stack -> ProfessionToolManager.getInstance().isTool(type, stack)); } } \ No newline at end of file diff --git a/src/main/java/littleservantmod/inventory/ContainerServant.java b/src/main/java/littleservantmod/inventory/ContainerServant.java index cee0d65..4597fd7 100644 --- a/src/main/java/littleservantmod/inventory/ContainerServant.java +++ b/src/main/java/littleservantmod/inventory/ContainerServant.java @@ -27,7 +27,7 @@ public ContainerServant(InventoryPlayer playerInventory, IInventory servantInven super(playerInventory, servantInventoryIn, servantIn); //Main size - int slotIndex = 15; + int slotIndex = 16; //装備 (Servantは小さいので帽子が不要) for (int k = 0; k < 3; ++k) { @@ -73,14 +73,11 @@ public String getSlotTexture() { //サーヴァントのアイテム欄 for (int l = 0; l < 2; ++l) { for (int j1 = 0; j1 < 9; ++j1) { - if (l != 1 || j1 < 7) this.addSlotToContainer(new Slot(servantInventoryIn, j1 + l * 9, 8 + j1 * 18, 84 - 8 + l * 18)); + if (l != 1 || j1 < 8) this.addSlotToContainer(new Slot(servantInventoryIn, j1 + l * 9, 8 + j1 * 18, 84 - 8 + l * 18)); } } //頭の部分 - this.addSlotToContainer(new Slot(servantInventoryIn, 19, 8 + 8 * 18, 84 - 8 + 1 * 18)); - - //オフハンドの部分 - this.addSlotToContainer(new Slot(servantInventoryIn, 20, 8 + 7 * 18, 84 - 8 + 1 * 18)); + this.addSlotToContainer(new Slot(servantInventoryIn, 20, 8 + 8 * 18, 84 - 8 + 1 * 18)); //プレイヤーのアイテム欄 for (int l = 0; l < 3; ++l) {