Class DamageTemperatureEffect

java.lang.Object
com.github.thedeathlycow.thermoo.api.temperature.effects.TemperatureEffect<DamageTemperatureEffect.Config>
com.github.thedeathlycow.thermoo.api.temperature.effects.DamageTemperatureEffect

public class DamageTemperatureEffect extends TemperatureEffect<DamageTemperatureEffect.Config>
Applies damage to LivingEntitys when their temperature scale is within a given range. The amount and interval of the damage pulses can be configured, as well as the damage type. However, the DamageSource applied only stores the type - the direct source entity, attacker, and position are all null.
  • Constructor Details

    • DamageTemperatureEffect

      public DamageTemperatureEffect()
  • Method Details

    • apply

      public void apply(net.minecraft.entity.LivingEntity victim, net.minecraft.server.world.ServerWorld serverWorld, DamageTemperatureEffect.Config config)
      Description copied from class: TemperatureEffect
      Applies the effect to a living entity
      Specified by:
      apply in class TemperatureEffect<DamageTemperatureEffect.Config>
      Parameters:
      victim - The living entity to apply the effect to
      serverWorld - The server world of the victim
      config - The effect config
    • shouldApply

      public boolean shouldApply(net.minecraft.entity.LivingEntity victim, DamageTemperatureEffect.Config config)
      Description copied from class: TemperatureEffect
      Tests if the effect should be applied to a living entity. Note that even if this returns true, the effect is not guaranteed to be applied. This is because all entity must pass the predicate specified by ConfiguredTemperatureEffect.predicate.
      Specified by:
      shouldApply in class TemperatureEffect<DamageTemperatureEffect.Config>
      Parameters:
      victim - The victim to test if the effect should be applied to
      config - The effect config
      Returns:
      Returns if the effect should be applied to the victim
    • configFromJson

      public DamageTemperatureEffect.Config configFromJson(com.google.gson.JsonElement json, com.google.gson.JsonDeserializationContext context) throws com.google.gson.JsonSyntaxException
      Description copied from class: TemperatureEffect
      Deserializes a JSON element into a new config instance that is valid for this effect type
      Specified by:
      configFromJson in class TemperatureEffect<DamageTemperatureEffect.Config>
      Parameters:
      json - The JSON element that represents the config of this effect type
      context - The JSON deserialization context
      Returns:
      Returns a new config instance specified by the JSON element given
      Throws:
      com.google.gson.JsonSyntaxException - Thrown if the given JSON element is not a legal representation of the config for this effect type