Skip to content

Commit

Permalink
[#660] Fixed blank nbt when using some inventory manager functions
Browse files Browse the repository at this point in the history
  • Loading branch information
SirEndii committed Oct 6, 2024
1 parent 2f3ee32 commit 647fd5b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,12 @@ public final int getFreeSlot() throws LuaException {

@LuaFunction(mainThread = true)
public final Map<String, Object> getItemInHand() throws LuaException {
return LuaConverter.stackToObject(getOwnerPlayer().getMainHandItem());
return LuaConverter.stackToObject(getOwnerPlayer().getMainHandItem().copy());
}

@LuaFunction(mainThread = true)
public final Map<String, Object> getItemInOffHand() throws LuaException {
return LuaConverter.stackToObject(getOwnerPlayer().getOffhandItem());
return LuaConverter.stackToObject(getOwnerPlayer().getOffhandItem().copy());
}

private Player getOwnerPlayer() throws LuaException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,8 @@ public final MethodResult getItem(IArguments arguments) throws LuaException {
if (parsedFilter.isEmpty())
return MethodResult.of(null, "EMPTY_FILTER");

Pair<Long, AEItemKey> item = AppEngApi.findAEStackFromFilter(monitor, getCraftingService(), parsedFilter)
if (item.getRight().isEmpty())
Pair<Long, AEItemKey> item = AppEngApi.findAEStackFromFilter(monitor, getCraftingService(), parsedFilter);
if (item.getRight() == null && item.getLeft() == 0)
return MethodResult.of(null, "NOT_FOUND");
return MethodResult.of(AppEngApi.getObjectFromStack(item, getCraftingService()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public final MethodResult getItem(IArguments arguments) throws LuaException {
if (filter.rightPresent())
return MethodResult.of(null, filter.getRight());

ItemStack item = RefinedStorage.findStackFromFilter(getNetwork(), getNetwork().getCraftingManager(), filter.getLeft())
ItemStack item = RefinedStorage.findStackFromFilter(getNetwork(), getNetwork().getCraftingManager(), filter.getLeft());
if (item.isEmpty())
return MethodResult.of(null, "NOT_FOUND");
return MethodResult.of(RefinedStorage.getObjectFromStack(item, getNetwork()));
Expand Down

0 comments on commit 647fd5b

Please sign in to comment.