-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ie: fix furnace progress inverted
- Loading branch information
Showing
3 changed files
with
54 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...mmersive-engineering/src/main/java/lol/bai/megane/module/ie/provider/ProcessProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package lol.bai.megane.module.ie.provider; | ||
|
||
import blusunrize.immersiveengineering.api.multiblocks.blocks.logic.IMultiblockBE; | ||
import blusunrize.immersiveengineering.api.multiblocks.blocks.logic.IMultiblockState; | ||
import blusunrize.immersiveengineering.common.blocks.multiblocks.process.ProcessContext; | ||
import mcp.mobius.waila.api.IDataProvider; | ||
import mcp.mobius.waila.api.IDataWriter; | ||
import mcp.mobius.waila.api.IPluginConfig; | ||
import mcp.mobius.waila.api.IServerAccessor; | ||
import mcp.mobius.waila.api.data.FluidData; | ||
import mcp.mobius.waila.api.data.ItemData; | ||
import mcp.mobius.waila.api.forge.ForgeFluidData; | ||
import net.minecraftforge.fluids.IFluidTank; | ||
|
||
public class ProcessProvider<S extends IMultiblockState & ProcessContext<?>> implements IDataProvider<IMultiblockBE<S>> { | ||
|
||
@Override | ||
public void appendData(IDataWriter data, IServerAccessor<IMultiblockBE<S>> accessor, IPluginConfig config) { | ||
var state = accessor.getTarget().getHelper().getState(); | ||
if (state == null) return; | ||
|
||
data.add(ItemData.class, res -> { | ||
var inventory = state.getInventory(); | ||
if (inventory.getSlots() == 0) return; | ||
|
||
res.add(ItemData.of(config) | ||
.getter(inventory::getStackInSlot, inventory.getSlots())); | ||
}); | ||
|
||
data.add(FluidData.class, res -> { | ||
var tanks = state.getInternalTanks(); | ||
if (tanks.length == 0) return; | ||
|
||
var fluidData = ForgeFluidData.of(tanks.length); | ||
for (IFluidTank tank : tanks) { | ||
fluidData.add(tank.getFluid(), tank.getCapacity()); | ||
} | ||
res.add(fluidData); | ||
}); | ||
} | ||
|
||
} |