Class EnvironmentalAffinity
java.lang.Object
etithespirit.orimod.api.environment.EnvironmentalAffinity
- Direct Known Subclasses:
AffinityWithFX
,PurposelyBrokenEnv
This class stores data about a biome's environmental affinity.
You can create instances for your mod as needed.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal net.minecraft.resources.ResourceLocation
The ID of the biome that this affinity object applies to.final NumberRange
An object describing the efficiency of Light-based devices.final double
A double representing the constant efficiency of Light-based devices. -
Constructor Summary
ConstructorsConstructorDescriptionEnvironmentalAffinity
(net.minecraft.resources.ResourceLocation biome, double efficiencyPercentage) Create a new affinity object for the given biome using the given flux and static efficiency percentage.EnvironmentalAffinity
(net.minecraft.resources.ResourceLocation biome, NumberRange efficiencyPercentage) Create a new affinity object for the given biome using the given flux and static efficiency percentage. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Returns the next randomized efficiency multiplier for all light tech in the area.abstract void
onPlayerTick
(net.minecraft.world.entity.player.Player player) This method executes every forge Player tick (post phase, both sides) where the player is in the biome associated with this affinity.abstract void
onWorldTick
(net.minecraft.world.level.Level world) This method executes every forge World tick (post phase, both sides).static void
sendPlayerTickToAll
(net.minecraft.world.entity.player.Player player) Sends a tick to all instances ofEnvironmentalAffinity
for the given player.static void
sendWorldTickToAll
(net.minecraft.world.level.Level world) Sends a tick to all instances ofEnvironmentalAffinity
in the given level.
-
Field Details
-
biome
public final net.minecraft.resources.ResourceLocation biomeThe ID of the biome that this affinity object applies to. -
efficiency
An object describing the efficiency of Light-based devices. This should return a value centered around 1 (where 1 means "no change"). It allows randomized interactions. This will be null ifefficiencySingular
is in use instead. -
efficiencySingular
public final double efficiencySingularA double representing the constant efficiency of Light-based devices. This can be used if there is no randomization per tick, in order to save computational power when ticking Light tech. This will beDouble.NaN
if this value is not in use.
-
-
Constructor Details
-
EnvironmentalAffinity
public EnvironmentalAffinity(net.minecraft.resources.ResourceLocation biome, NumberRange efficiencyPercentage) Create a new affinity object for the given biome using the given flux and static efficiency percentage.- Parameters:
biome
- The biome that this exists for.efficiencyPercentage
- The efficiency boost (or reduction) for all devices as a range of possible values. Note: If this is an immutable number range and it is singular (min == max), thenefficiencySingular
will be set to that value andefficiency
will be null.
-
EnvironmentalAffinity
public EnvironmentalAffinity(net.minecraft.resources.ResourceLocation biome, double efficiencyPercentage) Create a new affinity object for the given biome using the given flux and static efficiency percentage.- Parameters:
biome
- The biome that this exists for.efficiencyPercentage
- The efficiency boost (or reduction) for all devices as a singular value.
-
-
Method Details
-
onPlayerTick
public abstract void onPlayerTick(net.minecraft.world.entity.player.Player player) This method executes every forge Player tick (post phase, both sides) where the player is in the biome associated with this affinity.- Parameters:
player
- The player to tick for.
-
onWorldTick
public abstract void onWorldTick(net.minecraft.world.level.Level world) This method executes every forge World tick (post phase, both sides).- Parameters:
world
- The level to tick in.
-
getNextEfficiencyMultiplier
public double getNextEfficiencyMultiplier()Returns the next randomized efficiency multiplier for all light tech in the area.- Returns:
- The next randomized efficiency multiplier for all light tech in the area.
-
sendPlayerTickToAll
public static void sendPlayerTickToAll(net.minecraft.world.entity.player.Player player) Sends a tick to all instances ofEnvironmentalAffinity
for the given player.- Parameters:
player
- The player to apply to.
-
sendWorldTickToAll
public static void sendWorldTickToAll(net.minecraft.world.level.Level world) Sends a tick to all instances ofEnvironmentalAffinity
in the given level.- Parameters:
world
- The level to send in.
-