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 BlockPresenceSensor implements IBlockAndCoordinatePollSensor{ @Override public String getSensorPath(){ return "blockTracker_gpsTool/Block/Presence"; } @Override public int getPollFrequency(){ return 2; } @Override public boolean needsTextBox(){ return false; } @Override public List<String> getDescription(){ List<String> text = new ArrayList<String>(); text.add(EnumChatFormatting.BLACK + "Emits a redstone signal if there's a block (no air) at the location stored in the GPS Tool. In case of multiple locations, if any of the locations contains a block a redstone signal will be emitted."); return text; } @Override public int getRedstoneValue(World world, int x, int y, int z, int sensorRange, String textBoxText, Set<ChunkPosition> positions){ for(ChunkPosition pos : positions) { if(!world.isAirBlock(pos.chunkPosX, pos.chunkPosY, pos.chunkPosZ)) return 15; } return 0; } @Override @SideOnly(Side.CLIENT) public void drawAdditionalInfo(FontRenderer fontRenderer){} @Override public Rectangle needsSlot(){ return null; } }