2015-10-10 02:58:07 +02:00
|
|
|
/*
|
2016-05-16 22:52:27 +02:00
|
|
|
* This file ("TileEntityPhantomItemface.java") is part of the Actually Additions mod for Minecraft.
|
2015-10-10 02:58:07 +02:00
|
|
|
* It is created and owned by Ellpeck and distributed
|
|
|
|
* under the Actually Additions License to be found at
|
2016-05-16 22:52:27 +02:00
|
|
|
* http://ellpeck.de/actaddlicense
|
2015-10-10 02:58:07 +02:00
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2017-01-01 16:23:26 +01:00
|
|
|
* © 2015-2017 Ellpeck
|
2015-10-10 02:58:07 +02:00
|
|
|
*/
|
|
|
|
|
2016-01-05 04:47:35 +01:00
|
|
|
package de.ellpeck.actuallyadditions.mod.tile;
|
2015-10-10 02:58:07 +02:00
|
|
|
|
2016-01-05 04:47:35 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.blocks.BlockPhantom;
|
2015-10-10 02:58:07 +02:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
2016-01-08 08:10:55 +01:00
|
|
|
import net.minecraft.util.EnumFacing;
|
2016-12-28 03:12:17 +01:00
|
|
|
import net.minecraftforge.common.capabilities.Capability;
|
2016-11-09 21:36:18 +01:00
|
|
|
import net.minecraftforge.items.CapabilityItemHandler;
|
2015-10-10 02:58:07 +02:00
|
|
|
|
|
|
|
public class TileEntityPhantomItemface extends TileEntityPhantomface{
|
|
|
|
|
|
|
|
public TileEntityPhantomItemface(){
|
|
|
|
super("phantomface");
|
|
|
|
this.type = BlockPhantom.Type.FACE;
|
|
|
|
}
|
|
|
|
|
2016-02-01 20:32:49 +01:00
|
|
|
@Override
|
2018-06-23 01:39:30 +02:00
|
|
|
public boolean canInsert(int i, ItemStack stack, boolean automation){
|
|
|
|
return !automation || this.isBoundThingInRange();
|
2016-02-01 20:32:49 +01:00
|
|
|
}
|
|
|
|
|
2016-02-01 17:49:55 +01:00
|
|
|
@Override
|
|
|
|
public boolean isBoundThingInRange(){
|
2016-11-09 21:36:18 +01:00
|
|
|
if(super.isBoundThingInRange()){
|
2016-12-04 00:10:52 +01:00
|
|
|
TileEntity tile = this.world.getTileEntity(this.getBoundPosition());
|
|
|
|
if(tile != null){
|
|
|
|
for(EnumFacing facing : EnumFacing.values()){
|
|
|
|
if(tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing)){
|
|
|
|
return true;
|
2016-11-09 21:36:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
2016-02-01 17:49:55 +01:00
|
|
|
}
|
|
|
|
|
2016-12-28 03:12:17 +01:00
|
|
|
@Override
|
|
|
|
protected boolean isCapabilitySupported(Capability<?> capability){
|
|
|
|
return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY;
|
|
|
|
}
|
|
|
|
|
2016-02-01 17:49:55 +01:00
|
|
|
@Override
|
2018-06-23 01:39:30 +02:00
|
|
|
public boolean canExtract(int slot, ItemStack stack, boolean automation){
|
|
|
|
return !automation || this.isBoundThingInRange();
|
2016-02-01 17:49:55 +01:00
|
|
|
}
|
2015-10-10 02:58:07 +02:00
|
|
|
}
|