1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-02-09 07:30:04 +00:00

Fix TurtleTool using the wrong stack

When "placing" the item (e.g. hoeing soil), we were using the tool item,
rather than the passed stack. This was introduced in
9a914e75c4a4e122c16aac5d010059d28b475b5e, so never made it into a
release.
This commit is contained in:
Jonathan Coates 2025-01-14 10:22:01 +00:00
parent a2b9490d5c
commit ed631b05e7
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06

View File

@ -333,7 +333,7 @@ public class TurtleTool extends AbstractTurtleUpgrade {
* @return Whether the tool was successfully used.
* @see PlatformHelper#hasToolUsage(ItemStack)
*/
private boolean useTool(ServerLevel level, ITurtleAccess turtle, TurtlePlayer turtlePlayer, ItemStack stack, Direction direction) {
private static boolean useTool(ServerLevel level, ITurtleAccess turtle, TurtlePlayer turtlePlayer, ItemStack stack, Direction direction) {
var position = turtle.getPosition().relative(direction);
// Allow digging one extra block below the turtle, as you can't till dirt/flatten grass if there's a block
// above.
@ -348,7 +348,7 @@ public class TurtleTool extends AbstractTurtleUpgrade {
if (result instanceof PlatformHelper.UseOnResult.Handled handled) {
return handled.result().consumesAction();
} else {
return ((PlatformHelper.UseOnResult.Continue) result).item() && item.useOn(new UseOnContext(turtlePlayer.player(), InteractionHand.MAIN_HAND, hit)).consumesAction();
return ((PlatformHelper.UseOnResult.Continue) result).item() && stack.useOn(new UseOnContext(turtlePlayer.player(), InteractionHand.MAIN_HAND, hit)).consumesAction();
}
}