use of org.spongepowered.api.data.property.block.SkyLuminanceProperty in project SpongeCommon by SpongePowered.
the class SkyLuminancePropertyStore method getFor.
@Override
public Optional<SkyLuminanceProperty> getFor(Location<World> location) {
final net.minecraft.world.World world = (net.minecraft.world.World) location.getExtent();
final float light = world.getLightFor(EnumSkyBlock.SKY, VecHelper.toBlockPos(location));
return Optional.of(new SkyLuminanceProperty(light));
}
use of org.spongepowered.api.data.property.block.SkyLuminanceProperty in project SpongeCommon by SpongePowered.
the class SkyLuminancePropertyStore method getFor.
@Override
public Optional<SkyLuminanceProperty> getFor(PropertyHolder propertyHolder) {
if (propertyHolder instanceof Location && ((Location<?>) propertyHolder).getExtent() instanceof Chunk) {
final Chunk chunk = (Chunk) ((Location<?>) propertyHolder).getExtent();
final float light = chunk.getLightFor(EnumSkyBlock.SKY, VecHelper.toBlockPos((Location<?>) propertyHolder));
return Optional.of(new SkyLuminanceProperty(light));
}
return super.getFor(propertyHolder);
}
Aggregations