Skip to content

MixinPLayerEntity

Garkatron edited this page Jul 18, 2024 · 1 revision

Mixin Class MixinPlayerEntity

Fields

  • observers

    • Type: List<PlayerTemperatureObserver>
    • Description: List of observers registered to monitor player temperature changes.
  • temperature_state

    • Type: PlayerTemperatureState
    • Description: Current state of the player's temperature (NORMAL, OVERHEATING, FREEZING).
  • current_temperature

    • Type: BigDecimal
    • Description: Current temperature of the player, stored as a BigDecimal for precision.
  • temperatureManager

    • Type: TemperatureManager
    • Description: Instance of TemperatureManager responsible for managing player temperature.

Methods

  1. stanley_lib$getPlayerTemperature()

    • Description: Retrieves the current temperature of the player.
    • Returns: double - Current player temperature.
    • Interface: IStanleyPlayerEntity
  2. stanley_lib$setPlayerTemperature(double temperature)

    • Description: Sets the player's temperature to a specified value.
    • Parameters:
      • temperature (double) - New temperature value to set.
    • Interface: IStanleyPlayerEntity
  3. stanley_lib$increasePlayerTemperature(double amount)

    • Description: Increases the player's temperature by a specified amount.
    • Parameters:
      • amount (double) - Amount by which to increase the temperature.
    • Interface: IStanleyPlayerEntity
  4. stanley_lib$decreasePlayerTemperature(double amount)

    • Description: Decreases the player's temperature by a specified amount.
    • Parameters:
      • amount (double) - Amount by which to decrease the temperature.
    • Interface: IStanleyPlayerEntity
  5. stanley_lib$isPlayerOverheating()

    • Description: Checks if the player is in an overheating state.
    • Returns: boolean - true if the player is overheating, otherwise false.
    • Interface: IStanleyPlayerEntity
  6. stanley_lib$isPlayerFreezing()

    • Description: Checks if the player is in a freezing state.
    • Returns: boolean - true if the player is freezing, otherwise false.
    • Interface: IStanleyPlayerEntity
  7. stanley_lib$resetPlayerTemperature()

    • Description: Resets the player's temperature to the default value.
    • Interface: IStanleyPlayerEntity
  8. stanley_lib$killByFreezing()

    • Description: Kills the player due to freezing.
    • Interface: IStanleyPlayerEntity
  9. stanley_lib$killByOverheating()

    • Description: Kills the player due to overheating.
    • Interface: IStanleyPlayerEntity
  10. stanley_lib$getBlockUnderPlayer()

    • Description: Retrieves the block directly under the player.
    • Returns: Block - Block under the player.
    • Interface: IPlayerEntity
  11. stanley_lib$hurtByFreezing(int amount)

    • Description: Inflicts damage on the player due to freezing.
    • Parameters:
      • amount (int) - Amount of damage to inflict.
    • Interface: IStanleyPlayerEntity
  12. stanley_lib$hurtByOverheating(int amount)

    • Description: Inflicts damage on the player due to overheating.
    • Parameters:
      • amount (int) - Amount of damage to inflict.
    • Interface: IStanleyPlayerEntity
  13. stanley_lib$registerObserver(PlayerTemperatureObserver observer)

    • Description: Registers a PlayerTemperatureObserver to monitor temperature changes.
    • Parameters:
      • observer (PlayerTemperatureObserver) - Observer to register.
    • Interface: ISubject
  14. stanley_lib$removeObserver(PlayerTemperatureObserver observer)

    • Description: Removes a registered PlayerTemperatureObserver from monitoring.
    • Parameters:
      • observer (PlayerTemperatureObserver) - Observer to remove.
    • Interface: ISubject
  15. stanley_lib$notifyObservers()

    • Description: Notifies all registered observers about a change in temperature.
    • Interface: ISubject
  16. stanley_lib$setTemperatureState(PlayerTemperatureState state)

    • Description: Sets the player's current temperature state.
    • Parameters:
      • state (PlayerTemperatureState) - New temperature state to set.
    • Interface: IStanleyPlayerEntity
  17. stanley_lib$getState()

    • Description: Retrieves the current state of the player's temperature.
    • Returns: PlayerTemperatureState - Current temperature state.
    • Interface: ISubject
  18. stanley_lib$updateTemperature()

    • Description: Updates the player's temperature based on environmental factors and conditions.
    • Interface: IStanleyPlayerEntity
  19. hasLeatherArmor(EntityPlayer player)

    • Description: Checks if the specified player has any pieces of leather armor equipped.
    • Parameters:
      • player (EntityPlayer) - Player entity to check.
    • Returns: boolean[] - Array indicating which armor slots have leather armor equipped.
    • Interface: IPlayerEntity

Mixin Hooks

  • afterConstructor(World world, CallbackInfo ci)

    • Description: Post-constructor hook that may register default observers for temperature monitoring.
  • afterUpdate(CallbackInfo ci)

    • Description: Post-update hook that triggers temperature management if configured.
  • afterPlayerHurt(Entity attacker, int damage, DamageType type, CallbackInfoReturnable<Boolean> cir)

    • Description: Post-damage hook that adjusts player temperature if hit by specific entities (e.g., snowballs, snowmen).

Additional Notes

  • The mixin class integrates temperature management functionalities into EntityPlayer, allowing dynamic adjustment and monitoring of the player's temperature state.

Clone this wiki locally