mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-26 21:09:23 +01:00
Remove additional tesla capabilites as they don't make sense anyways
This commit is contained in:
parent
912f6bace2
commit
a90b980d57
1 changed files with 6 additions and 13 deletions
|
@ -15,12 +15,11 @@ import cofh.api.energy.IEnergyProvider;
|
|||
import cofh.api.energy.IEnergyReceiver;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
||||
import net.darkhax.tesla.api.ITeslaConsumer;
|
||||
import net.darkhax.tesla.api.ITeslaHolder;
|
||||
import net.darkhax.tesla.api.ITeslaProducer;
|
||||
import net.darkhax.tesla.capability.TeslaCapabilities;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -28,17 +27,11 @@ import java.util.Map;
|
|||
public final class TeslaUtil{
|
||||
|
||||
private static final Map<TileEntityBase, TeslaHandler[]> TESLA_MAP = new HashMap<TileEntityBase, TeslaHandler[]>();
|
||||
@CapabilityInject(ITeslaConsumer.class)
|
||||
public static Capability<ITeslaConsumer> teslaConsumer = null;
|
||||
@CapabilityInject(ITeslaProducer.class)
|
||||
public static Capability<ITeslaProducer> teslaProducer = null;
|
||||
@CapabilityInject(ITeslaHolder.class)
|
||||
public static Capability<ITeslaHolder> teslaHolder = null;
|
||||
|
||||
public static <T> T getTeslaCapability(TileEntityBase tile, Capability<T> capability, EnumFacing facing){
|
||||
boolean receive = tile instanceof IEnergyReceiver && capability == teslaConsumer;
|
||||
boolean provide = tile instanceof IEnergyProvider && capability == teslaProducer;
|
||||
boolean hold = tile instanceof IEnergyHandler && capability == teslaHolder;
|
||||
boolean receive = tile instanceof IEnergyReceiver && capability == TeslaCapabilities.CAPABILITY_CONSUMER;
|
||||
boolean provide = tile instanceof IEnergyProvider && capability == TeslaCapabilities.CAPABILITY_PRODUCER;
|
||||
boolean hold = tile instanceof IEnergyHandler && capability == TeslaCapabilities.CAPABILITY_HOLDER;
|
||||
if(receive || provide || hold){
|
||||
return (T)getHandler(tile, facing);
|
||||
}
|
||||
|
@ -53,8 +46,8 @@ public final class TeslaUtil{
|
|||
|
||||
for(int i = 0; i < 2; i++){
|
||||
if(handlerFrom == null && handlerTo == null){
|
||||
handlerFrom = (i == 0 ? tile : otherTile).getCapability(teslaProducer, i == 0 ? side : side.getOpposite());
|
||||
handlerTo = (i == 0 ? otherTile : tile).getCapability(teslaConsumer, i == 0 ? side.getOpposite() : side);
|
||||
handlerFrom = (i == 0 ? tile : otherTile).getCapability(TeslaCapabilities.CAPABILITY_PRODUCER, i == 0 ? side : side.getOpposite());
|
||||
handlerTo = (i == 0 ? otherTile : tile).getCapability(TeslaCapabilities.CAPABILITY_CONSUMER, i == 0 ? side.getOpposite() : side);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue