Interface IPocketAccess
- All Superinterfaces:
PocketComputer
Access to a pocket computer for pocket upgrades.
-
Method Summary
Modifier and TypeMethodDescriptionintgetLight()Get the colour of this pocket computer's light as a RGB number.@Nullable UpgradeData<IPocketUpgrade> Get the currently equipped upgrade.net.minecraft.core.component.DataComponentPatchGet the upgrade-specific NBT.voidRemove the current peripheral and create a new one.voidsetLight(int colour) Set the colour of the pocket computer's light to a RGB number.voidsetUpgrade(@Nullable UpgradeData<IPocketUpgrade> upgrade) Set the upgrade for this pocket computer, also updating the item stack.voidsetUpgradeData(net.minecraft.core.component.DataComponentPatch data) Update the upgrade-specific data.Methods inherited from interface PocketComputer
getColour, getEntity, getLevel, getPosition, isActive, setColour
-
Method Details
-
getLight
int getLight()Get the colour of this pocket computer's light as a RGB number.- Returns:
- The colour this light is. This will be a RGB colour between
0x000000and0xFFFFFFor -1 if it has no colour. - See Also:
-
setLight
void setLight(int colour) Set the colour of the pocket computer's light to a RGB number.- Parameters:
colour- The colour this modem's light will be changed to. This should be a RGB colour between0x000000and0xFFFFFFor -1 to reset to the default colour.- See Also:
-
getUpgrade
@Nullable UpgradeData<IPocketUpgrade> getUpgrade()Get the currently equipped upgrade.- Returns:
- The currently equipped upgrade.
- See Also:
-
setUpgrade
Set the upgrade for this pocket computer, also updating the item stack.This method can only be called from the main server thread, when this computer is is active.
- Parameters:
upgrade- The new upgrade to set it to, may benull.- See Also:
-
getUpgradeData
net.minecraft.core.component.DataComponentPatch getUpgradeData()Get the upgrade-specific NBT.This is persisted between computer reboots and chunk loads.
- Returns:
- The upgrade's NBT.
- See Also:
-
setUpgradeData
void setUpgradeData(net.minecraft.core.component.DataComponentPatch data) Update the upgrade-specific data.This method can only be called from the main server thread, when this computer is is active.
- Parameters:
data- The new upgrade data.- See Also:
-
invalidatePeripheral
void invalidatePeripheral()Remove the current peripheral and create a new one.You may wish to do this if the methods available change, for instance when the owning entity changes.
-