Skip to content

Commit

Permalink
Adjusted the temperature gauge to use values of 0, 7 and 15 based on …
Browse files Browse the repository at this point in the history
…the chosen mode
  • Loading branch information
Adubbz committed Jan 4, 2024
1 parent 1ca0037 commit 3cb2923
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,14 @@ protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockSt
private static void updateSignalStrength(BlockState state, Level level, BlockPos pos)
{
TemperatureLevel temperatureLevel = TemperatureHelperImpl.getTemperatureAtPosWithoutProximity(level, pos);
int strength = Mth.floor(15F * (float)temperatureLevel.ordinal() / (float)(TemperatureLevel.values().length - 1));
int strength;

if (!state.getValue(INVERTED)) {
strength = 15 - strength;
if (state.getValue(INVERTED)) {
strength = (Mth.clamp(temperatureLevel.ordinal(), 2, 4) - 2) * 8 - 1;
}
else
{
strength = 15 - Mth.clamp(temperatureLevel.ordinal(), 0, 2) * 8;
}

strength = Mth.clamp(strength, 0, 15);
Expand Down

0 comments on commit 3cb2923

Please sign in to comment.