1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-14 04:00:30 +00:00

Do not allow transferring into removed blocks

See #893.
This commit is contained in:
Jonathan Coates 2021-11-28 12:26:39 +00:00
parent 4f11549112
commit 306e06a79a
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
2 changed files with 6 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral;
import dan200.computercraft.shared.peripheral.generic.data.FluidData;
import net.minecraft.fluid.Fluid;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.common.util.LazyOptional;
@ -155,6 +156,8 @@ public class FluidMethods implements GenericSource
@Nullable
private static IFluidHandler extractHandler( @Nullable Object object )
{
if( (object instanceof TileEntity) && ((TileEntity) object).isRemoved() ) return null;
if( object instanceof ICapabilityProvider )
{
LazyOptional<IFluidHandler> cap = ((ICapabilityProvider) object).getCapability( CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY );

View File

@ -14,6 +14,7 @@ import dan200.computercraft.api.peripheral.IPeripheral;
import dan200.computercraft.shared.peripheral.generic.data.ItemData;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.common.util.LazyOptional;
@ -257,6 +258,8 @@ public class InventoryMethods implements GenericSource
@Nullable
private static IItemHandler extractHandler( @Nullable Object object )
{
if( (object instanceof TileEntity) && ((TileEntity) object).isRemoved() ) return null;
if( object instanceof ICapabilityProvider )
{
LazyOptional<IItemHandler> cap = ((ICapabilityProvider) object).getCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY );