Interface IPollSensorSetting
- All Superinterfaces:
IBaseSensor,ISensorSetting
- All Known Implementing Classes:
ConstantSensor,EntityInRangeSensor,PlayerHealthSensor,TwitchStreamerSensor,WorldDayLightSensor,WorldGlobalVariableAnalogSensor,WorldGlobalVariableSensor,WorldPlayersInServerSensor,WorldRainingSensor,WorldTicktimeSensor,WorldTimeSensor,WorldWeatherForecaster
-
Method Summary
Modifier and TypeMethodDescriptionintgetPollFrequency(net.minecraft.world.level.block.entity.BlockEntity te) The value returned here is the interval between every check in ticks (i.e.intgetRedstoneValue(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, int sensorRange, String textBoxText) Called regularly by the Universal Sensor block entity to calculate the output redstone value 0-15 of this sensor.default voidsetPlayerContext(UUID playerID) Called immediately beforegetRedstoneValue(Level, BlockPos, int, String)to set up the player context, if necessary.Methods inherited from interface me.desht.pneumaticcraft.api.universal_sensor.IBaseSensor
getAdditionalInfo, getDescription, getHelpPromptText, getHelpText, getRequiredUpgrades, getSensorPath, getTextboxIntRange, getTextBoxOptions, isEntityFilter, needsTextBox, strictComboBoxMethods inherited from interface me.desht.pneumaticcraft.api.universal_sensor.ISensorSetting
getAirUsage, needsGPSTool, notifyTextChange
-
Method Details
-
getPollFrequency
int getPollFrequency(net.minecraft.world.level.block.entity.BlockEntity te) The value returned here is the interval between every check in ticks (i.e. how frequentlygetRedstoneValue(Level, BlockPos, int, String)should be called. Consider increasing the interval when that method is resource-intensive.- Parameters:
te- universal sensor- Returns:
- the interval in ticks between polling operations
-
getRedstoneValue
int getRedstoneValue(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, int sensorRange, String textBoxText) Called regularly by the Universal Sensor block entity to calculate the output redstone value 0-15 of this sensor. When this sensor is digital, just return 0 or 15.- Parameters:
level- the worldpos- the blockpos to testsensorRange- range of the sensor, based on the number of Range Upgrades inserted in the Universal Sensor.textBoxText- any text typed in the textfield of the Universal Sensor GUI.- Returns:
- level of the redstone signal that the Universal Sensor block should emit
-
setPlayerContext
Called immediately beforegetRedstoneValue(Level, BlockPos, int, String)to set up the player context, if necessary. If this sensor doesn't care about player context, there's no need to override this.- Parameters:
playerID- unique ID for the player who placed down the calling Universal Sensor
-