2021-09-05 01:40:40 +02:00
|
|
|
package com.jozufozu.flywheel.light;
|
|
|
|
|
2021-09-15 08:45:29 +02:00
|
|
|
import net.minecraft.core.BlockPos;
|
|
|
|
import net.minecraft.world.level.BlockAndTintGetter;
|
|
|
|
import net.minecraft.world.level.LightLayer;
|
2021-09-05 01:40:40 +02:00
|
|
|
|
2021-12-09 09:42:27 +01:00
|
|
|
/**
|
|
|
|
* Wraps a world and minimally lowers the interface.
|
|
|
|
*/
|
2021-09-05 01:40:40 +02:00
|
|
|
public class BasicProvider implements LightProvider {
|
|
|
|
|
2021-09-15 08:45:29 +02:00
|
|
|
private final BlockAndTintGetter reader;
|
2021-12-09 09:42:27 +01:00
|
|
|
private final BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos();
|
2021-09-05 01:40:40 +02:00
|
|
|
|
2021-09-15 08:45:29 +02:00
|
|
|
public BasicProvider(BlockAndTintGetter reader) {
|
2021-09-05 01:40:40 +02:00
|
|
|
this.reader = reader;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-09-15 08:45:29 +02:00
|
|
|
public int getLight(LightLayer type, int x, int y, int z) {
|
2021-09-05 01:40:40 +02:00
|
|
|
return reader.getBrightness(type, pos.set(x, y, z));
|
|
|
|
}
|
|
|
|
}
|