mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-14 20:20:30 +00:00
parent
4f11549112
commit
306e06a79a
@ -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 );
|
||||
|
@ -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 );
|
||||
|
Loading…
Reference in New Issue
Block a user