package pneumaticCraft.common.sensor.pollSensors; import java.util.ArrayList; import java.util.List; import java.util.Set; import net.minecraft.client.gui.FontRenderer; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.ChunkPosition; import net.minecraft.world.World; import org.lwjgl.util.Rectangle; import pneumaticCraft.api.universalSensor.IBlockAndCoordinatePollSensor; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockLightLevelSensor implements IBlockAndCoordinatePollSensor{ @Override public String getSensorPath(){ return "blockTracker_gpsTool/Block/Light Level"; } @Override public int getPollFrequency(){ return 5; } @Override public boolean needsTextBox(){ return false; } @Override public List<String> getDescription(){ List<String> text = new ArrayList<String>(); text.add(EnumChatFormatting.BLACK + "Emits a redstone of which the strength is equal to the light level at the location stored in the GPS Tool. In case of multiple locations, the location with the highest light value is used."); return text; } @Override public int getRedstoneValue(World world, int x, int y, int z, int sensorRange, String textBoxText, Set<ChunkPosition> positions){ int lightValue = 0; for(ChunkPosition pos : positions) { lightValue = Math.max(lightValue, world.getBlockLightValue(pos.chunkPosX, pos.chunkPosY, pos.chunkPosZ)); } return lightValue; } @Override @SideOnly(Side.CLIENT) public void drawAdditionalInfo(FontRenderer fontRenderer){} @Override public Rectangle needsSlot(){ return null; } }