Skip to content

Commit

Permalink
Fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr committed Oct 22, 2024
1 parent 2227941 commit 0ca332a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class CRealism extends ConfigBase {
public final ConfigBool realisticTrains = b(false, "realisticTrains", Comments.realisticTrains);
public final ConfigBool realisticFuelTanks = b(true, "realisticFuelTanks", Comments.realisticFuelTanks);

public final ConfigInt netherExtraFuelUsage = i(0, 0, Integer.MAX_VALUE, Comments.netherExtraFuelUsage);
public final ConfigInt netherExtraFuelUsage = i(1, 1, Integer.MAX_VALUE, Comments.netherExtraFuelUsage);

@Override
public String getName() {
Expand All @@ -36,6 +36,6 @@ private static class Comments {
static String realisticTrains = "Make trains require fuel to run (either from fuel tanks or solid fuels in chests/barrels)";
static String realisticFuelTanks = "Make fuel tanks only accept proper liquid fuels (so water etc can't go into them)";

static String netherExtraFuelUsage = "The number of extra fuel ticks trains in the nether will use, 0 means they will not use extra fuel, 8 means they'll use roughly the same amount as if they were travelling to the same place via the Overworld";
static String netherExtraFuelUsage = "The number of extra fuel ticks trains in the nether will use, 1 means they will not use extra fuel, 8 means they'll use roughly the same amount as if they were travelling to the same place via the Overworld";

This comment has been minimized.

Copy link
@techno-sam

techno-sam Oct 23, 2024

Member

potentially rename this to netherFuelBurnRate, since that more clearly describes what it does

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ public abstract class MixinTrain implements IOccupiedCouplers, IIndexedSchedule,
@Unique private boolean railways$isStrictSignalTrain = false;
@Unique private int railways$controlBlockedTicks = -1;
@Unique private int railways$controlBlockedSign = 0;

@Unique private ThreadLocal<Level> railways$level;

@Override
public boolean railways$isControlBlocked() {
Expand Down Expand Up @@ -286,17 +288,15 @@ private static void readOccupiedCouplers(CompoundTag tag, Map<UUID, TrackGraph>
}

@Inject(method = "tick", at = @At("HEAD"))
private void railways$shareLevel(Level level, CallbackInfo ci, @Share("sharedLevel") LocalRef<Level> sharedLevel) {
sharedLevel.set(level);
private void railways$shareLevel(Level level, CallbackInfo ci) {
railways$level.set(level);
}

@WrapOperation(method = "burnFuel", at = @At(value = "FIELD", target = "Lcom/simibubi/create/content/trains/entity/Train;fuelTicks:I", opcode = Opcodes.PUTFIELD))
private void railways$modifyFuelUsage(Train instance, int value, Operation<Void> original, @Share("sharedLevel") LocalRef<Level> sharedLevel) {
Level level = sharedLevel.get();

private void railways$modifyFuelUsage(Train instance, int value, Operation<Void> original) {
int config = CRConfigs.server().realism.netherExtraFuelUsage.get();
if (config != 0 && level != null && level.dimension() == Level.NETHER)
value -= config;
if (railways$level.get().dimension() == Level.NETHER)
value -= (config - 1);
original.call(instance, value);
}

Expand Down

0 comments on commit 0ca332a

Please sign in to comment.