Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
Return ghost item instead of actual item to prevent dropping
Browse files Browse the repository at this point in the history
  • Loading branch information
minecraft7771 committed Sep 3, 2022
1 parent 0a5b94f commit 9eb28fd
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,13 @@ public int getSizeInventory() {

@Override
public ItemStack getStackInSlot(int aIndex) {
return stacks != null && aIndex < stacks.length ? stacks[aIndex] : null;
if (stacks == null || aIndex >= stacks.length) {
return null;
}
// We return a stack with size 0 to prevent dropping when the hatch is broken
ItemStack stackCopy = stacks[aIndex].copy();
stackCopy.stackSize = 0;
return stackCopy;
}

@Override
Expand Down

0 comments on commit 9eb28fd

Please sign in to comment.