2016-07-25 02:07:16 +02:00
|
|
|
/*
|
2017-01-01 16:23:26 +01:00
|
|
|
* This file ("TeslaForgeUnitsWrapper.java") is part of the Actually Additions mod for Minecraft.
|
2016-07-25 02:07:16 +02:00
|
|
|
* It is created and owned by Ellpeck and distributed
|
|
|
|
* under the Actually Additions License to be found at
|
|
|
|
* http://ellpeck.de/actaddlicense
|
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2017-01-01 16:23:26 +01:00
|
|
|
* © 2015-2017 Ellpeck
|
2016-07-25 02:07:16 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
package de.ellpeck.actuallyadditions.mod.util.compat;
|
|
|
|
|
|
|
|
import net.darkhax.tesla.api.ITeslaConsumer;
|
|
|
|
import net.darkhax.tesla.api.ITeslaHolder;
|
|
|
|
import net.darkhax.tesla.api.ITeslaProducer;
|
2016-11-26 20:43:50 +01:00
|
|
|
import net.minecraftforge.energy.IEnergyStorage;
|
2016-07-25 02:07:16 +02:00
|
|
|
|
2016-11-26 20:43:50 +01:00
|
|
|
public class TeslaForgeUnitsWrapper implements ITeslaProducer, ITeslaHolder, ITeslaConsumer{
|
2016-07-25 02:07:16 +02:00
|
|
|
|
2016-11-26 20:43:50 +01:00
|
|
|
private final IEnergyStorage storage;
|
2016-07-25 02:07:16 +02:00
|
|
|
|
2016-11-26 20:43:50 +01:00
|
|
|
public TeslaForgeUnitsWrapper(IEnergyStorage storage){
|
|
|
|
this.storage = storage;
|
2016-07-25 02:07:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public long givePower(long power, boolean simulated){
|
2016-11-26 20:43:50 +01:00
|
|
|
return this.storage.receiveEnergy((int)power, simulated);
|
2016-07-25 02:07:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public long getStoredPower(){
|
2016-11-26 20:43:50 +01:00
|
|
|
return this.storage.getEnergyStored();
|
2016-07-25 02:07:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public long getCapacity(){
|
2016-11-26 20:43:50 +01:00
|
|
|
return this.storage.getMaxEnergyStored();
|
2016-07-25 02:07:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public long takePower(long power, boolean simulated){
|
2016-11-26 20:43:50 +01:00
|
|
|
return this.storage.extractEnergy((int)power, simulated);
|
2016-07-25 02:07:16 +02:00
|
|
|
}
|
|
|
|
}
|