2015-10-10 02:58:07 +02:00
|
|
|
/*
|
2016-05-16 22:52:27 +02:00
|
|
|
* This file ("TileEntityPhantomEnergyface.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.tileentity.TileEntity;
|
2016-01-07 18:20:59 +01:00
|
|
|
import net.minecraft.util.EnumFacing;
|
2016-12-28 03:12:17 +01:00
|
|
|
import net.minecraftforge.common.capabilities.Capability;
|
2016-11-26 19:00:02 +01:00
|
|
|
import net.minecraftforge.energy.CapabilityEnergy;
|
2015-10-10 02:58:07 +02:00
|
|
|
|
2019-05-02 09:10:29 +02:00
|
|
|
public class TileEntityPhantomEnergyface extends TileEntityPhantomface implements ISharingEnergyProvider {
|
2015-10-10 02:58:07 +02:00
|
|
|
|
2019-05-02 09:10:29 +02:00
|
|
|
public TileEntityPhantomEnergyface() {
|
2015-10-10 02:58:07 +02:00
|
|
|
super("energyface");
|
|
|
|
this.type = BlockPhantom.Type.ENERGYFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-02 09:10:29 +02:00
|
|
|
public boolean isBoundThingInRange() {
|
|
|
|
if (super.isBoundThingInRange()) {
|
2016-11-26 21:32:27 +01:00
|
|
|
TileEntity tile = this.world.getTileEntity(this.boundPosition);
|
2019-05-02 09:10:29 +02:00
|
|
|
if (tile != null && !(tile instanceof TileEntityLaserRelayEnergy)) {
|
|
|
|
for (EnumFacing facing : EnumFacing.values()) {
|
|
|
|
if (tile.hasCapability(CapabilityEnergy.ENERGY, facing)) { return true; }
|
2016-09-02 08:33:54 +02:00
|
|
|
}
|
|
|
|
}
|
2016-07-24 02:54:07 +02:00
|
|
|
}
|
2016-09-02 08:33:54 +02:00
|
|
|
return false;
|
2015-10-10 02:58:07 +02:00
|
|
|
}
|
|
|
|
|
2016-12-28 03:12:17 +01:00
|
|
|
@Override
|
2019-05-02 09:10:29 +02:00
|
|
|
protected boolean isCapabilitySupported(Capability<?> capability) {
|
2017-12-23 21:20:01 +01:00
|
|
|
return capability == CapabilityEnergy.ENERGY;
|
2016-12-28 03:12:17 +01:00
|
|
|
}
|
|
|
|
|
2016-08-31 20:16:36 +02:00
|
|
|
@Override
|
2019-05-02 09:10:29 +02:00
|
|
|
public int getEnergyToSplitShare() {
|
2016-08-31 20:16:36 +02:00
|
|
|
return Integer.MAX_VALUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-02 09:10:29 +02:00
|
|
|
public boolean doesShareEnergy() {
|
2016-08-31 20:16:36 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-02 09:10:29 +02:00
|
|
|
public EnumFacing[] getEnergyShareSides() {
|
2016-08-31 20:16:36 +02:00
|
|
|
return EnumFacing.values();
|
|
|
|
}
|
2016-12-18 17:28:29 +01:00
|
|
|
|
|
|
|
@Override
|
2019-05-02 09:10:29 +02:00
|
|
|
public boolean canShareTo(TileEntity tile) {
|
2016-12-18 17:28:29 +01:00
|
|
|
return true;
|
|
|
|
}
|
2015-10-10 02:58:07 +02:00
|
|
|
}
|