1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-08-29 00:32:18 +00:00

Merge pull request #33 from DrummerMC/mc-1.18.x/fixTurtleSuckCommand

fix TurtleSuckCommand
This commit is contained in:
Merith 2021-12-15 18:31:20 -08:00 committed by GitHub
commit a549400776
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,7 @@ import dan200.computercraft.shared.util.InventoryUtil;
import dan200.computercraft.shared.util.ItemStorage;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.Container;
import net.minecraft.world.entity.EntitySelector;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.ItemStack;
@ -53,10 +54,12 @@ public class TurtleSuckCommand implements ITurtleCommand
BlockPos blockPosition = turtlePosition.relative( direction );
Direction side = direction.getOpposite();
ItemStorage inventory = ItemStorage.wrap( InventoryUtil.getInventory( world, blockPosition, side ) );
Container inventoryContainer = InventoryUtil.getInventory( world, blockPosition, side );
if( inventory != null )
if( inventoryContainer != null )
{
ItemStorage inventory = ItemStorage.wrap( inventoryContainer );
// Take from inventory of thing in front
ItemStack stack = InventoryUtil.takeItems( quantity, inventory );
if( stack.isEmpty() ) return TurtleCommandResult.failure( "No items to take" );