Class ConfiguredTemperatureEffect<C>
java.lang.Object
com.github.thedeathlycow.thermoo.api.temperature.effects.ConfiguredTemperatureEffect<C>
- Type Parameters:
C- The config type
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:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyIfPossible(net.minecraft.entity.LivingEntity victim) Tests and applies this effect to a living entity if possiblestatic <C> ConfiguredTemperatureEffect<C>fromJson(TemperatureEffect<C> type, com.google.gson.JsonElement configJson, com.google.gson.JsonDeserializationContext context, @Nullable net.minecraft.loot.condition.LootCondition predicate, @Nullable net.minecraft.entity.EntityType<?> entityType, net.minecraft.predicate.NumberRange.FloatRange temperatureScaleRange) Constructs a newConfiguredTemperatureEffectof a specified type and config JSON object@Nullable net.minecraft.entity.EntityType<?>
-
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 newConfiguredTemperatureEffectof a specified type and config JSON object- Type Parameters:
C- The type of the effect type config- Parameters:
type- The temperature effect typeconfigJson- The config of the effectcontext- The JSON deserialization contextpredicate- 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
ConfiguredTemperatureEffectbased on the JSON representation given byconfigJson - Throws:
com.google.gson.JsonParseException- Thrown ifconfigJsonis not a valid representation of the config typeCcom.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()
-