Skip to content

Commit

Permalink
fix naming and fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
chochem committed Apr 17, 2023
1 parent 6254c67 commit 677648b
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/main/java/tterrag/wailaplugins/plugins/PluginRailcraft.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ final class WaterTankRateCalculator {

private final float BASE_HUMIDITY_RATE = 10F;

private final float OUTSIDE_RATE = 0.5F;
private final float INSIDE_RATE = 0.5F;
private final float SNOW_RATE = 0.5F;

private final float RAIN_RATE = 3.0F;
Expand All @@ -70,7 +70,7 @@ final class WaterTankRateCalculator {

private float humidityRate;

private float outsideRate;
private float insideRate;

private float snowingOrRainingRate;

Expand All @@ -87,23 +87,23 @@ public static float convertRateToLitersPerSecond(float rate) {

public WaterTankRateCalculator init() {
humidityRate = calculateHumidityRate();
outsideRate = calculateOutsideRate();
insideRate = calculateInsideRate();
snowingOrRainingRate = calculateSnowingOrRainingRate();

rate = Math.max(MathHelper.floor_float(humidityRate * outsideRate * snowingOrRainingRate), ONE);
rate = Math.max(MathHelper.floor_float(humidityRate * insideRate * snowingOrRainingRate), ONE);
return this;
}

private float calculateHumidityRate() {
return BASE_HUMIDITY_RATE * world.getBiomeGenForCoords(x, z).rainfall;
}

private float calculateOutsideRate() {
private float calculateInsideRate() {
IntStream streamX = IntStream.rangeClosed(x - 1, x + 1);
return streamX.anyMatch(eachX -> {
IntStream streamZ = IntStream.rangeClosed(z - 1, z + 1);
return streamZ.anyMatch(eachZ -> !world.canBlockSeeTheSky(eachX, y + 3, eachZ));
}) ? OUTSIDE_RATE : ONE;
return streamZ.anyMatch(eachZ -> world.canBlockSeeTheSky(eachX, y + 3, eachZ));
}) ? ONE : INSIDE_RATE;
}

private float calculateSnowingOrRainingRate() {
Expand All @@ -119,8 +119,8 @@ public float getHumidityRate() {
return humidityRate;
}

public float getOutsideRate() {
return outsideRate;
public float getInsideRate() {
return insideRate;
}

public float getSnowingOrRainingRate() {
Expand All @@ -135,8 +135,8 @@ public boolean getIsRaining() {
return snowingOrRainingRate == RAIN_RATE;
}

public boolean getIsOutside() {
return outsideRate == OUTSIDE_RATE;
public boolean getIsInside() {
return insideRate == INSIDE_RATE;
}

}
Expand Down Expand Up @@ -216,8 +216,8 @@ protected void getBody(ItemStack stack, List<String> currenttip, IWailaDataAcces
currenttip.add(lang.localize("snowingRate", snowingOrRainingRate));
}

if (waterTankRateCalculator.getIsOutside()) {
currenttip.add(lang.localize("cantSeeTheSkyRate", waterTankRateCalculator.getOutsideRate()));
if (waterTankRateCalculator.getIsInside()) {
currenttip.add(lang.localize("cantSeeTheSkyRate", waterTankRateCalculator.getInsideRate()));
}
}

Expand Down

0 comments on commit 677648b

Please sign in to comment.