Class WorldGlobalVariableSensor
java.lang.Object
me.desht.pneumaticcraft.common.sensor.pollSensors.WorldGlobalVariableSensor
- All Implemented Interfaces:
IBaseSensor,IPollSensorSetting,ISensorSetting
- Direct Known Subclasses:
WorldGlobalVariableAnalogSensor
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidgetAdditionalInfo(List<net.minecraft.network.chat.Component> info) Return some descriptive text to be displayed above the optional textboxintgetPollFrequency(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.Return the upgrades required by this sensor.Return the button path the player has to follow in which this setting is stored.getTextBoxOptions(net.minecraft.world.entity.player.Player player) If a textbox is to be displayed (seeIBaseSensor.needsTextBox()), this can be used to return a list of possible values.booleanShould this sensor's GUI display a text box for extra information to be entered?voidsetPlayerContext(UUID playerID) Called immediately beforeIPollSensorSetting.getRedstoneValue(Level, BlockPos, int, String)to set up the player context, if necessary.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface me.desht.pneumaticcraft.api.universal_sensor.IBaseSensor
getDescription, getHelpPromptText, getHelpText, getTextboxIntRange, strictComboBoxMethods inherited from interface me.desht.pneumaticcraft.api.universal_sensor.ISensorSetting
getAirUsage, needsGPSTool, notifyTextChange
-
Field Details
-
playerID
-
-
Constructor Details
-
WorldGlobalVariableSensor
public WorldGlobalVariableSensor()
-
-
Method Details
-
getSensorPath
Description copied from interface:IBaseSensorReturn the button path the player has to follow in which this setting is stored. For instance, when the sensor should be located in player and is called speed, you should return "player/speed".- Specified by:
getSensorPathin interfaceIBaseSensor- Returns:
- a string path to the sensor
-
getRequiredUpgrades
Description copied from interface:IBaseSensorReturn the upgrades required by this sensor. This will automatically include a GPS Tool for sensors that require a location.- Specified by:
getRequiredUpgradesin interfaceIBaseSensor- Returns:
- a set of upgrades
-
needsTextBox
public boolean needsTextBox()Description copied from interface:IBaseSensorShould this sensor's GUI display a text box for extra information to be entered?- Specified by:
needsTextBoxin interfaceIBaseSensor- Returns:
- true if this sensor needs a text box, false otherwise
-
getPollFrequency
public int getPollFrequency(net.minecraft.world.level.block.entity.BlockEntity te) Description copied from interface:IPollSensorSettingThe value returned here is the interval between every check in ticks (i.e. how frequentlyIPollSensorSetting.getRedstoneValue(Level, BlockPos, int, String)should be called. Consider increasing the interval when that method is resource-intensive.- Specified by:
getPollFrequencyin interfaceIPollSensorSetting- Parameters:
te- universal sensor- Returns:
- the interval in ticks between polling operations
-
getRedstoneValue
public int getRedstoneValue(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, int sensorRange, String textBoxText) Description copied from interface:IPollSensorSettingCalled 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.- Specified by:
getRedstoneValuein interfaceIPollSensorSetting- 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
-
getAdditionalInfo
Description copied from interface:IBaseSensorReturn some descriptive text to be displayed above the optional textbox- Specified by:
getAdditionalInfoin interfaceIBaseSensor- Parameters:
info- a text component list to be appended to
-
setPlayerContext
Description copied from interface:IPollSensorSettingCalled immediately beforeIPollSensorSetting.getRedstoneValue(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.- Specified by:
setPlayerContextin interfaceIPollSensorSetting- Parameters:
playerID- unique ID for the player who placed down the calling Universal Sensor
-
getTextBoxOptions
Description copied from interface:IBaseSensorIf a textbox is to be displayed (seeIBaseSensor.needsTextBox()), this can be used to return a list of possible values. If this returns a non-null result, the textbox will become a combo box with a drop-down for the values returned.- Specified by:
getTextBoxOptionsin interfaceIBaseSensor- Parameters:
player- the client player- Returns:
- a list of possible values, or null if the textbox should be purely free-form
-