Class ConfiguredTemperatureEffect<C>

java.lang.Object
com.github.thedeathlycow.thermoo.api.temperature.effects.ConfiguredTemperatureEffect<C>
Type Parameters:
C - The config type

public class ConfiguredTemperatureEffect<C> extends Object
Represents a configured instance of a TemperatureEffect type. See the wiki page for details on how to implement this in a datapack.

A configured temperature effect is more like an instance of a temperature effect, and this is the class that is directly instantiated from a temperature effect JSON file in a datapack.

See Also:
  • Method Details

    • fromJson

      public static <C> ConfiguredTemperatureEffect<C> fromJson(TemperatureEffect<C> type, com.google.gson.JsonElement configJson, com.google.gson.JsonDeserializationContext context, @Nullable @Nullable net.minecraft.loot.condition.LootCondition predicate, @Nullable @Nullable net.minecraft.entity.EntityType<?> entityType, net.minecraft.predicate.NumberRange.FloatRange temperatureScaleRange) throws com.google.gson.JsonSyntaxException
      Constructs a new ConfiguredTemperatureEffect of a specified type and config JSON object
      Type Parameters:
      C - The type of the effect type config
      Parameters:
      type - The temperature effect type
      configJson - The config of the effect
      context - The JSON deserialization context
      predicate - If not null, then only applies the effect to entities for which this predicate is TRUE.
      entityType - If not null, then only applies this effect to entities of the specific type. This is more performant than using predicates if you want to apply an effect only to one specific type.
      temperatureScaleRange - The temperature scale at which this should be applied to an entity. This is more performant than using predicates if you want to apply an effect only within a particular temperature range
      Returns:
      Returns a new ConfiguredTemperatureEffect based on the JSON representation given by configJson
      Throws:
      com.google.gson.JsonParseException - Thrown if configJson is not a valid representation of the config type C
      com.google.gson.JsonSyntaxException
    • applyIfPossible

      public void applyIfPossible(net.minecraft.entity.LivingEntity victim)
      Tests and applies this effect to a living entity if possible
      Parameters:
      victim - The living entity to possibly apply the effect to
    • getEntityType

      @Nullable public @Nullable net.minecraft.entity.EntityType<?> getEntityType()