Repository navigation
TemperatureManager.java
Garkatron edited this page Jul 18, 2024
·
1 revision
Manages the player's temperature based on various environmental factors and updates their temperature state.
-
custom_player-
Type:
IStanleyPlayerEntity - Description: The custom player entity interface that provides temperature management methods.
-
Type:
-
sent_messages-
Type:
boolean[] - Description: Tracks which temperature-related messages have been sent to the player.
-
Type:
-
ticks_remaining-
Type:
int - Description: Counts the ticks remaining before the next temperature update.
-
Type:
-
TemperatureManager(IStanleyPlayerEntity custom_player)-
Parameters:
-
custom_player(IStanleyPlayerEntity): The custom player entity to manage temperature for.
-
- Description: Initializes the manager with the provided custom player and initializes message tracking.
-
Parameters:
-
update()- Description: Updates the player's temperature based on current environmental factors such as weather, biome, and blocks. It adjusts the player's temperature accordingly and sends messages to the player when their temperature reaches critical levels.
-
adjustPlayerTemperature(BigDecimal totalAdjustment)-
Parameters:
-
totalAdjustment(BigDecimal): The total adjustment to apply to the player's temperature.
-
- Description: Adjusts the player's temperature based on the given adjustment value. It increases or decreases the temperature and rounds adjustments to four decimal places.
-
Parameters:
The TemperatureManager class is crucial for managing and updating player temperatures dynamically in response to environmental changes. It leverages various configuration settings (TemperatureConfig) and environmental factors (Weather, Biome, BlockMaterial) to calculate adjustments to the player's temperature. This class ensures that players receive appropriate feedback and consequences for their current temperature state within the game environment.