Skip to content

Commit

Permalink
Merge pull request #4 from GTNewHorizons/patch-config-heater
Browse files Browse the repository at this point in the history
Add config option for how fast lava heater can provide HU
  • Loading branch information
Dream-Master authored Dec 30, 2021
2 parents 9aac45f + 5e7b80c commit 50fca02
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/main/java/remoteio/common/RemoteIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public class RemoteIO {

public static LocalizationUpdater localizationUpdater;

public static int heatProvided = 100;

public static Configuration configuration;

@EventHandler
Expand Down Expand Up @@ -79,7 +81,8 @@ public void preInit(FMLPreInitializationEvent event) {
FMLInterModComms.sendMessage("Waila", "register", "remoteio.common.core.compat.WailaProvider.registerProvider");
}

localizationUpdater = new LocalizationUpdater("dmillerw", "RemoteIO", "17", "src/main/resources/assets/remoteio/lang/");
heatProvided = configuration.getInt("heatProvided", "balancing", 1000, 0, Integer.MAX_VALUE, "Max HU provided by Lava heater per tick");
localizationUpdater = new LocalizationUpdater("GTNewHorizons", "RemoteIO", "master", "src/main/resources/assets/remoteio/lang/");
localizationUpdater.initializeThread(configuration);

proxy.preInit(event);
Expand Down
18 changes: 13 additions & 5 deletions src/main/java/remoteio/common/tile/TileMachineHeater.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package remoteio.common.tile;

import cpw.mods.fml.common.Optional;
import remoteio.common.RemoteIO;
import remoteio.common.lib.DependencyInfo;
import remoteio.common.tile.core.TileCore;
import ic2.api.energy.tile.IHeatSource;
Expand All @@ -19,6 +20,7 @@
public class TileMachineHeater extends TileCore implements IHeatSource {

public boolean filled = false;
public int heatUsed = 0;

@Override
public void writeCustomNBT(NBTTagCompound nbt) {
Expand All @@ -32,9 +34,12 @@ public void readCustomNBT(NBTTagCompound nbt) {

@Override
public void updateEntity() {
if (!worldObj.isRemote && worldObj.getTotalWorldTime() % 20 == 0) {
update();
if (filled) push();
if (!worldObj.isRemote) {
heatUsed = 0;
if (worldObj.getTotalWorldTime() % 20 == 0) {
update();
if (filled) push();
}
}
}

Expand Down Expand Up @@ -75,7 +80,10 @@ public int maxrequestHeatTick(ForgeDirection directionFrom) {

@Override
@Optional.Method(modid = DependencyInfo.ModIds.IC2)
public int requestHeat(ForgeDirection directionFrom, int requestheat) {
return filled ? requestheat : 0;
public int requestHeat(ForgeDirection directionFrom, int requestedHeat) {
if (!filled) return 0;
int used = Math.min(RemoteIO.heatProvided - heatUsed, requestedHeat);
heatUsed -= used;
return used;
}
}

0 comments on commit 50fca02

Please sign in to comment.