Remove additional tesla capabilites as they don't make sense anyways

This commit is contained in:
Ellpeck 2016-06-18 12:45:47 +02:00
parent 912f6bace2
commit a90b980d57

View file

@ -15,12 +15,11 @@ import cofh.api.energy.IEnergyProvider;
import cofh.api.energy.IEnergyReceiver; import cofh.api.energy.IEnergyReceiver;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import net.darkhax.tesla.api.ITeslaConsumer; import net.darkhax.tesla.api.ITeslaConsumer;
import net.darkhax.tesla.api.ITeslaHolder;
import net.darkhax.tesla.api.ITeslaProducer; import net.darkhax.tesla.api.ITeslaProducer;
import net.darkhax.tesla.capability.TeslaCapabilities;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityInject;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -28,17 +27,11 @@ import java.util.Map;
public final class TeslaUtil{ public final class TeslaUtil{
private static final Map<TileEntityBase, TeslaHandler[]> TESLA_MAP = new HashMap<TileEntityBase, TeslaHandler[]>(); 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){ public static <T> T getTeslaCapability(TileEntityBase tile, Capability<T> capability, EnumFacing facing){
boolean receive = tile instanceof IEnergyReceiver && capability == teslaConsumer; boolean receive = tile instanceof IEnergyReceiver && capability == TeslaCapabilities.CAPABILITY_CONSUMER;
boolean provide = tile instanceof IEnergyProvider && capability == teslaProducer; boolean provide = tile instanceof IEnergyProvider && capability == TeslaCapabilities.CAPABILITY_PRODUCER;
boolean hold = tile instanceof IEnergyHandler && capability == teslaHolder; boolean hold = tile instanceof IEnergyHandler && capability == TeslaCapabilities.CAPABILITY_HOLDER;
if(receive || provide || hold){ if(receive || provide || hold){
return (T)getHandler(tile, facing); return (T)getHandler(tile, facing);
} }
@ -53,8 +46,8 @@ public final class TeslaUtil{
for(int i = 0; i < 2; i++){ for(int i = 0; i < 2; i++){
if(handlerFrom == null && handlerTo == null){ if(handlerFrom == null && handlerTo == null){
handlerFrom = (i == 0 ? tile : otherTile).getCapability(teslaProducer, i == 0 ? side : side.getOpposite()); handlerFrom = (i == 0 ? tile : otherTile).getCapability(TeslaCapabilities.CAPABILITY_PRODUCER, i == 0 ? side : side.getOpposite());
handlerTo = (i == 0 ? otherTile : tile).getCapability(teslaConsumer, i == 0 ? side.getOpposite() : side); handlerTo = (i == 0 ? otherTile : tile).getCapability(TeslaCapabilities.CAPABILITY_CONSUMER, i == 0 ? side.getOpposite() : side);
} }
} }