提供: Minecraft Modding Wiki
この編集を取り消せます。
下記の差分を確認して、本当に取り消していいか検証してください。よろしければ変更を保存して取り消しを完了してください。
最新版 | 編集中の文章 | ||
122行目: | 122行目: | ||
continue; | continue; | ||
− | |||
− | |||
− | |||
− | |||
− | |||
if (item == null | if (item == null | ||
|| this.isItemStackable(new ItemStack(current.getItem(), 1, current.getItemDamage()), item)) { | || this.isItemStackable(new ItemStack(current.getItem(), 1, current.getItemDamage()), item)) { | ||
135行目: | 130行目: | ||
} | } | ||
− | |||
if (ret != null) { | if (ret != null) { | ||
− | |||
if (sided.getStackInSlot(slot) == null) { | if (sided.getStackInSlot(slot) == null) { | ||
sided.setInventorySlotContents(slot, ret); | sided.setInventorySlotContents(slot, ret); | ||
} else { | } else { | ||
− | |||
sided.getStackInSlot(slot).stackSize++; | sided.getStackInSlot(slot).stackSize++; | ||
} | } | ||
− | |||
− | |||
this.decrStackSize(1, 1); | this.decrStackSize(1, 1); | ||
− | + | sided.markDirty(); | |
− | |||
− | |||
this.markDirty(); | this.markDirty(); | ||
} | } | ||
} else { | } else { | ||
− | |||
ItemStack ret = null; | ItemStack ret = null; | ||
int slot = 0; | int slot = 0; | ||
− | |||
for (int i = 0; i < inv.getSizeInventory(); i++) { | for (int i = 0; i < inv.getSizeInventory(); i++) { | ||
ItemStack item = inv.getStackInSlot(i); | ItemStack item = inv.getStackInSlot(i); | ||
163行目: | 149行目: | ||
continue; | continue; | ||
+ | /* スロットが空であるか、挿入しようとしているアイテムとスタックが重ねられる場合。 | ||
+ | * ここではアイテム挿入処理をせずに、挿入予定のItemStackとスロット番号だけ記憶させています。 | ||
+ | * 単なる作者の趣味なので、必ずしもこのような実装にする必要はないと思われます。 | ||
+ | */ | ||
if (item == null | if (item == null | ||
|| this.isItemStackable(new ItemStack(current.getItem(), 1, current.getItemDamage()), item)) { | || this.isItemStackable(new ItemStack(current.getItem(), 1, current.getItemDamage()), item)) { | ||
171行目: | 161行目: | ||
} | } | ||
+ | /* 挿入可能なアイテムが無事に取得できたならば、挿入処理をします。 */ | ||
if (ret != null) { | if (ret != null) { | ||
if (inv.getStackInSlot(slot) == null) { | if (inv.getStackInSlot(slot) == null) { | ||
+ | /* スロットが空であれば、挿入予定のItemStackがそのままSlotにはいります。 */ | ||
inv.setInventorySlotContents(slot, ret); | inv.setInventorySlotContents(slot, ret); | ||
} else { | } else { | ||
+ | /* 空で無かった場合は、挿入予定の個数分だけ、移送先Slotのスタック数を増加させます。 */ | ||
inv.getStackInSlot(slot).stackSize++; | inv.getStackInSlot(slot).stackSize++; | ||
} | } | ||
+ | /* 最後に、挿入完了したあと、FluidHopper側のアイテムは減少させます。 */ | ||
this.decrStackSize(1, 1); | this.decrStackSize(1, 1); | ||
+ | |||
+ | /* インベントリ内容に変更があったため、変更を更新させる処理を呼びます。 */ | ||
inv.markDirty(); | inv.markDirty(); | ||
this.markDirty(); | this.markDirty(); |