Interface TemperatureChange
- All Known Implementing Classes:
TemperatureChangeImpl
@NonExtendable
public interface TemperatureChange
The context of a specific temperature change.
-
Method Summary
Modifier and TypeMethodDescriptionintapplyReduction(net.minecraft.world.entity.LivingEntity target, int temperatureChange) Applies the reduction of the temperature source.@Nullable net.minecraft.world.entity.Entitycause()The entity responsible for the change.static TemperatureChangecreate(net.minecraft.core.Holder<TemperatureSource> source) Creates a simple temperature change context with only a type and no cause or position.static TemperatureChangecreate(net.minecraft.core.Holder<TemperatureSource> source, net.minecraft.world.entity.Entity directCause) Creates a temperature change context with a type and a directCause entity.static TemperatureChangecreate(net.minecraft.core.Holder<TemperatureSource> source, net.minecraft.world.entity.Entity cause, net.minecraft.world.entity.Entity directCause) Creates a temperature change context with a type, a cause entity, and a direct cause entity.static TemperatureChangecreate(net.minecraft.core.Holder<TemperatureSource> source, net.minecraft.world.phys.Vec3 position) Creates a temperature change context with a type and a position, but no cause.@Nullable net.minecraft.world.entity.EntityThe entity directly responsible for the change.default booleanis(net.minecraft.resources.ResourceKey<TemperatureSource> typeKey) default booleanis(net.minecraft.tags.TagKey<TemperatureSource> tag) default booleanisDirect()@Nullable net.minecraft.world.phys.Vec3position()The position of the temperature change source.net.minecraft.core.Holder<TemperatureSource> source()The type of temperature change this is.
-
Method Details
-
source
net.minecraft.core.Holder<TemperatureSource> source()The type of temperature change this is. -
cause
@Nullable @Nullable net.minecraft.world.entity.Entity cause()The entity responsible for the change.- Returns:
- Returns a nullable entity.
-
directCause
@Nullable @Nullable net.minecraft.world.entity.Entity directCause()The entity directly responsible for the change. For example, with a freezing arrow shot by a Chillager, the direct cause would be the arrow entity, and thecause()would be the Chillager. If this is adirectchange, then this will be the same as thecause().- Returns:
- Returns a nullable entity. This entity is
nullif and only ifcause()is null.
-
position
@Nullable @Nullable net.minecraft.world.phys.Vec3 position()The position of the temperature change source. May the same as the position ofdirectCause(), but may also be something else if the direct cause isnull.- Returns:
- Returns a nullable vector 3.
-
applyReduction
int applyReduction(net.minecraft.world.entity.LivingEntity target, int temperatureChange) Applies the reduction of the temperature source.- Parameters:
target- The target of the temperature change.temperatureChange- The original temperature change value.- Returns:
- Returns the adjusted temperature change.
-
create
Creates a simple temperature change context with only a type and no cause or position.- Parameters:
source- The type of the change, may not benull.
-
create
static TemperatureChange create(net.minecraft.core.Holder<TemperatureSource> source, net.minecraft.world.phys.Vec3 position) Creates a temperature change context with a type and a position, but no cause.- Parameters:
source- The type of the change, may not benull.position- The position of the temperature change source, may not benull.
-
create
static TemperatureChange create(net.minecraft.core.Holder<TemperatureSource> source, net.minecraft.world.entity.Entity directCause) Creates a temperature change context with a type and a directCause entity. If thedirectCauseis aTraceableEntityand has a non-null owner, then thecause()will refer to the owner. Otherwise, thedirectCause()andcause()will refer to the same entity. In either case, theposition()will be the directCause's position.- Parameters:
source- The type of the change, may not benull.directCause- The entity directly responsible for the change, may not benull.
-
create
static TemperatureChange create(net.minecraft.core.Holder<TemperatureSource> source, net.minecraft.world.entity.Entity cause, net.minecraft.world.entity.Entity directCause) Creates a temperature change context with a type, a cause entity, and a direct cause entity. Theposition()will be the direct cause's position.- Parameters:
source- The type of the change, may not benull.cause- The entity responsible for the change, may not benull.directCause- The entity directly responsible for the change, may not benull.
-
isDirect
default boolean isDirect()- Returns:
- Returns
trueif thecause()anddirectCause()refer to the same entity.
-
is
- Returns:
- Returns
trueif the source of this change matches thetag.
-
is
- Returns:
- Returns
trueif the source of this change matches thetypeKey.
-