Skip to content

Commit b1328a9

Browse files
committed
Fix Strict Heaters, Config Renaming, Bump Gradle
Fixed bug with strict heaters not working with a glass roof Renamed machine to heater for consistency Bump gradle
1 parent 42451cc commit b1328a9

5 files changed

Lines changed: 17 additions & 10 deletions

File tree

‎build.gradle‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ buildscript {
1010
apply plugin: 'net.minecraftforge.gradle.forge'
1111

1212

13-
version = "1.12.2-0.3.4"
13+
version = "1.12.2-0.3.5"
1414
group = "com.charles445.simpledifficulty" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
1515
archivesBaseName = "SimpleDifficulty"
1616

‎src/main/java/com/charles445/simpledifficulty/api/config/ClientOptions.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public enum ClientOptions implements IConfigOption
1212
/*Integer*/ TEMPERATURE_READOUT ("temperatureReadout"),
1313
/*Boolean*/ CLASSICHUD_TEMPERATURE ("classicHUDTemperature"),
1414
/*Boolean*/ CLASSICHUD_THIRST ("classicHUDThirst"),
15-
/*Boolean*/ MACHINE_PARTICLES ("machineParticles");
15+
/*Boolean*/ HEATER_PARTICLES ("heaterParticles");
1616

1717
String name;
1818

‎src/main/java/com/charles445/simpledifficulty/block/BlockTemperature.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ private void createRandomParticle(World world, BlockPos pos, Random rand)
187187

188188
//DebugUtil.messageAll(" "+(int)(100d*(x_a+x_r))+ " " + (int)(100d*(z_a+z_r)));
189189

190-
if(ModConfig.client.machineParticles)
190+
if(ModConfig.client.heaterParticles)
191191
SimpleDifficulty.proxy.spawnClientParticle(world, temperature>=0.0f?"HEATER":"CHILLER", x_a + x_r + pos.getX(), 0.775d + pos.getY(), z_a + z_r + pos.getZ(), 0.0d, 0.05d, 0.0d);
192192

193193
//world.spawnParticle(EnumParticleTypes.END_ROD, x_a + x_r + pos.getX(), 0.775d + pos.getY(), z_a + z_r + pos.getZ(), 0.0d, 0.05d, 0.0d);

‎src/main/java/com/charles445/simpledifficulty/config/ModConfig.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,8 @@ public static class ConfigClientConfig
398398
public boolean classicHUDThirst = false;
399399

400400
@Config.Comment("Enables chiller and heater particles")
401-
@Config.Name("MachineParticles")
402-
public boolean machineParticles = true;
401+
@Config.Name("HeaterParticles")
402+
public boolean heaterParticles = true;
403403

404404
public class ConfigClientThermometer
405405
{
@@ -476,7 +476,7 @@ public static void sendLocalClientConfigToAPI()
476476
ClientConfig.instance.put(ClientOptions.TEMPERATURE_READOUT, client.temperatureReadout);
477477
ClientConfig.instance.put(ClientOptions.CLASSICHUD_TEMPERATURE, client.classicHUDTemperature);
478478
ClientConfig.instance.put(ClientOptions.CLASSICHUD_THIRST, client.classicHUDThirst);
479-
ClientConfig.instance.put(ClientOptions.MACHINE_PARTICLES, client.machineParticles);
479+
ClientConfig.instance.put(ClientOptions.HEATER_PARTICLES, client.heaterParticles);
480480
}
481481

482482
public static void sendLocalServerConfigToAPI()

‎src/main/java/com/charles445/simpledifficulty/tileentity/TileEntityTemperature.java‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ private float handleStrict(BlockPos targetPos, float distanceTemp)
7878
int zinc = curZ<destZ?1:-1;
7979

8080
//But first check both the start and the destination
81-
if(canSeeSky(new BlockPos(curX,curY,curZ)) || canSeeSky(new BlockPos(destX,destY,destZ)))
81+
if(isUnprotected(new BlockPos(curX,curY,curZ)) || isUnprotected(new BlockPos(destX,destY,destZ)))
8282
return 0.0f;
8383

8484
while(curX != destX || curZ != destZ || curY != destY)
@@ -92,7 +92,7 @@ private float handleStrict(BlockPos targetPos, float distanceTemp)
9292
if(curZ != destZ)
9393
curZ += zinc;
9494

95-
if(canSeeSky(new BlockPos(curX,curY,curZ)))
95+
if(isUnprotected(new BlockPos(curX,curY,curZ)))
9696
return 0.0f;
9797
}
9898

@@ -101,13 +101,20 @@ private float handleStrict(BlockPos targetPos, float distanceTemp)
101101
return distanceTemp;
102102
}
103103

104-
private boolean canSeeSky(BlockPos pos)
104+
private boolean isUnprotected(BlockPos pos)
105105
{
106106
if(!WorldUtil.isChunkLoaded(this.world, pos))
107107
return true;
108108

109109
Chunk chunk = this.world.getChunkProvider().provideChunk(pos.getX() >> 4, pos.getZ() >> 4);
110-
return chunk.canSeeSky(pos);
110+
111+
if(!chunk.canSeeSky(pos))
112+
return false;
113+
114+
if (chunk.getPrecipitationHeight(pos).getY() > pos.getY())
115+
return false;
116+
117+
return true;
111118
}
112119

113120
private double sq(double d)

0 commit comments

Comments
 (0)