Skip to content

Commit

Permalink
Fix Strict Heaters, Config Renaming, Bump Gradle
Browse files Browse the repository at this point in the history
Fixed bug with strict heaters not working with a glass roof
Renamed machine to heater for consistency
Bump gradle
  • Loading branch information
Charles445 committed Feb 9, 2021
1 parent 42451cc commit b1328a9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle.forge'


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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public enum ClientOptions implements IConfigOption
/*Integer*/ TEMPERATURE_READOUT ("temperatureReadout"),
/*Boolean*/ CLASSICHUD_TEMPERATURE ("classicHUDTemperature"),
/*Boolean*/ CLASSICHUD_THIRST ("classicHUDThirst"),
/*Boolean*/ MACHINE_PARTICLES ("machineParticles");
/*Boolean*/ HEATER_PARTICLES ("heaterParticles");

String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ private void createRandomParticle(World world, BlockPos pos, Random rand)

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

if(ModConfig.client.machineParticles)
if(ModConfig.client.heaterParticles)
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);

//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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,8 @@ public static class ConfigClientConfig
public boolean classicHUDThirst = false;

@Config.Comment("Enables chiller and heater particles")
@Config.Name("MachineParticles")
public boolean machineParticles = true;
@Config.Name("HeaterParticles")
public boolean heaterParticles = true;

public class ConfigClientThermometer
{
Expand Down Expand Up @@ -476,7 +476,7 @@ public static void sendLocalClientConfigToAPI()
ClientConfig.instance.put(ClientOptions.TEMPERATURE_READOUT, client.temperatureReadout);
ClientConfig.instance.put(ClientOptions.CLASSICHUD_TEMPERATURE, client.classicHUDTemperature);
ClientConfig.instance.put(ClientOptions.CLASSICHUD_THIRST, client.classicHUDThirst);
ClientConfig.instance.put(ClientOptions.MACHINE_PARTICLES, client.machineParticles);
ClientConfig.instance.put(ClientOptions.HEATER_PARTICLES, client.heaterParticles);
}

public static void sendLocalServerConfigToAPI()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private float handleStrict(BlockPos targetPos, float distanceTemp)
int zinc = curZ<destZ?1:-1;

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

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

if(canSeeSky(new BlockPos(curX,curY,curZ)))
if(isUnprotected(new BlockPos(curX,curY,curZ)))
return 0.0f;
}

Expand All @@ -101,13 +101,20 @@ private float handleStrict(BlockPos targetPos, float distanceTemp)
return distanceTemp;
}

private boolean canSeeSky(BlockPos pos)
private boolean isUnprotected(BlockPos pos)
{
if(!WorldUtil.isChunkLoaded(this.world, pos))
return true;

Chunk chunk = this.world.getChunkProvider().provideChunk(pos.getX() >> 4, pos.getZ() >> 4);
return chunk.canSeeSky(pos);

if(!chunk.canSeeSky(pos))
return false;

if (chunk.getPrecipitationHeight(pos).getY() > pos.getY())
return false;

return true;
}

private double sq(double d)
Expand Down

0 comments on commit b1328a9

Please sign in to comment.