package net.minecraft.world.attribute; import net.minecraft.core.BlockPos; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.Vec3; import org.jspecify.annotations.Nullable; public interface EnvironmentAttributeReader { EnvironmentAttributeReader EMPTY = new EnvironmentAttributeReader() { @Override public Value getDimensionValue(final EnvironmentAttribute attribute) { return attribute.defaultValue(); } @Override public Value getValue(final EnvironmentAttribute attribute, final Vec3 pos, @Nullable final SpatialAttributeInterpolator biomeInterpolator) { return attribute.defaultValue(); } }; Value getDimensionValue(EnvironmentAttribute attribute); default Value getValue(final EnvironmentAttribute attribute, final BlockPos pos) { return this.getValue(attribute, Vec3.atCenterOf(pos)); } default Value getValue(final EnvironmentAttribute attribute, final Vec3 pos) { return this.getValue(attribute, pos, null); } Value getValue(EnvironmentAttribute attribute, Vec3 pos, @Nullable SpatialAttributeInterpolator biomeInterpolator); default Value getValue(final LootContext context, final EnvironmentAttribute attribute) { return attribute.isPositional() ? this.getValue(attribute, context.getParameter(LootContextParams.ORIGIN)) : this.getDimensionValue(attribute); } }