|
1 |
| -//package li.cil.oc.common.tileentity.traits.power |
2 |
| -// |
3 |
| -//import net.minecraftforge.fml.common.Optional |
4 |
| -//import li.cil.oc.Settings |
5 |
| -//import li.cil.oc.common.asm.Injectable |
6 |
| -//import li.cil.oc.integration.Mods |
7 |
| -//import net.minecraft.util.EnumFacing |
8 |
| -// |
9 |
| -//@Injectable.Interface(value = "cofh.api.energy.IEnergyHandler", modid = Mods.IDs.CoFHEnergy) |
10 |
| -//trait RedstoneFlux extends Common { |
11 |
| -// @Optional.Method(modid = Mods.IDs.CoFHEnergy) |
12 |
| -// def canConnectEnergy(from: EnumFacing) = Mods.CoFHEnergy.isAvailable && canConnectPower(from) |
13 |
| -// |
14 |
| -// @Optional.Method(modid = Mods.IDs.CoFHEnergy) |
15 |
| -// def receiveEnergy(from: EnumFacing, maxReceive: Int, simulate: Boolean) = |
16 |
| -// if (!Mods.CoFHEnergy.isAvailable) 0 |
17 |
| -// else (tryChangeBuffer(from, maxReceive * Settings.get.ratioRedstoneFlux, !simulate) / Settings.get.ratioRedstoneFlux).toInt |
18 |
| -// |
19 |
| -// @Optional.Method(modid = Mods.IDs.CoFHEnergy) |
20 |
| -// def getEnergyStored(from: EnumFacing) = (globalBuffer(from) / Settings.get.ratioRedstoneFlux).toInt |
21 |
| -// |
22 |
| -// @Optional.Method(modid = Mods.IDs.CoFHEnergy) |
23 |
| -// def getMaxEnergyStored(from: EnumFacing) = (globalBufferSize(from) / Settings.get.ratioRedstoneFlux).toInt |
24 |
| -// |
25 |
| -// @Optional.Method(modid = Mods.IDs.CoFHEnergy) |
26 |
| -// def extractEnergy(from: EnumFacing, maxExtract: Int, simulate: Boolean) = 0 |
27 |
| -//} |
| 1 | +package li.cil.oc.common.tileentity.traits.power |
| 2 | + |
| 3 | +import li.cil.oc.Settings |
| 4 | +import li.cil.oc.common.asm.Injectable |
| 5 | +import li.cil.oc.integration.Mods |
| 6 | +import net.minecraft.util.EnumFacing |
| 7 | +import net.minecraftforge.fml.common.Optional |
| 8 | + |
| 9 | +@Injectable.Interface(value = "cofh.api.energy.IEnergyReceiver", modid = Mods.IDs.CoFHEnergy) |
| 10 | +trait RedstoneFlux extends Common { |
| 11 | + @Optional.Method(modid = Mods.IDs.CoFHEnergy) |
| 12 | + def canConnectEnergy(from: EnumFacing) = Mods.CoFHEnergy.isAvailable && canConnectPower(from) |
| 13 | + |
| 14 | + @Optional.Method(modid = Mods.IDs.CoFHEnergy) |
| 15 | + def receiveEnergy(from: EnumFacing, maxReceive: Int, simulate: Boolean) = |
| 16 | + if (!Mods.CoFHEnergy.isAvailable) 0 |
| 17 | + else (tryChangeBuffer(from, maxReceive * Settings.get.ratioRedstoneFlux, !simulate) / Settings.get.ratioRedstoneFlux).toInt |
| 18 | + |
| 19 | + @Optional.Method(modid = Mods.IDs.CoFHEnergy) |
| 20 | + def getEnergyStored(from: EnumFacing) = (globalBuffer(from) / Settings.get.ratioRedstoneFlux).toInt |
| 21 | + |
| 22 | + @Optional.Method(modid = Mods.IDs.CoFHEnergy) |
| 23 | + def getMaxEnergyStored(from: EnumFacing) = (globalBufferSize(from) / Settings.get.ratioRedstoneFlux).toInt |
| 24 | +} |
0 commit comments