Class ProgrammableControllerBlockEntity
java.lang.Object
net.minecraftforge.common.capabilities.CapabilityProvider<net.minecraft.world.level.block.entity.BlockEntity>
net.minecraft.world.level.block.entity.BlockEntity
me.desht.pneumaticcraft.common.block.entity.AbstractPneumaticCraftBlockEntity
me.desht.pneumaticcraft.common.block.entity.AbstractTickingBlockEntity
me.desht.pneumaticcraft.common.block.entity.AbstractAirHandlingBlockEntity
me.desht.pneumaticcraft.common.block.entity.ProgrammableControllerBlockEntity
- All Implemented Interfaces:
IDrone,IGUIButtonSensitive,ILuaMethodProvider,IMinWorkingPressure,ISideConfigurable,IDroneBase,IDescSynced,IUpgradeHolder,net.minecraft.world.inventory.MenuConstructor,net.minecraft.world.MenuProvider,net.minecraft.world.Nameable,net.minecraftforge.common.capabilities.ICapabilityProvider,net.minecraftforge.common.capabilities.ICapabilityProviderImpl<net.minecraft.world.level.block.entity.BlockEntity>,net.minecraftforge.common.capabilities.ICapabilitySerializable<net.minecraft.nbt.CompoundTag>,net.minecraftforge.common.extensions.IForgeBlockEntity,net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
public class ProgrammableControllerBlockEntity
extends AbstractAirHandlingBlockEntity
implements IMinWorkingPressure, IDroneBase, ISideConfigurable, net.minecraft.world.MenuProvider
-
Nested Class Summary
Nested classes/interfaces inherited from class me.desht.pneumaticcraft.common.block.entity.AbstractPneumaticCraftBlockEntity
AbstractPneumaticCraftBlockEntity.UpgradeHandlerNested classes/interfaces inherited from class net.minecraftforge.common.capabilities.CapabilityProvider
net.minecraftforge.common.capabilities.CapabilityProvider.AsField<B extends net.minecraftforge.common.capabilities.ICapabilityProviderImpl<B>> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Set<net.minecraft.resources.ResourceLocation>net.minecraft.world.item.ItemStackbooleanbooleanFields inherited from class me.desht.pneumaticcraft.common.block.entity.AbstractAirHandlingBlockEntity
airHandlerFields inherited from class net.minecraft.world.level.block.entity.BlockEntity
level, remove, worldPositionFields inherited from interface net.minecraftforge.common.extensions.IForgeBlockEntity
INFINITE_EXTENT_AABB -
Constructor Summary
ConstructorsConstructorDescriptionProgrammableControllerBlockEntity(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAirToDrone(int air) net.minecraft.core.DirectionbyIndex()Return the (absolute) direction that this BE is facing.booleancanMoveIntoFluid(net.minecraft.world.level.material.Fluid fluid) booleanbooleanbooleannet.minecraft.world.inventory.AbstractContainerMenucreateMenu(int i, net.minecraft.world.entity.player.Inventory playerInventory, net.minecraft.world.entity.player.Player playerEntity) voiddropItem(net.minecraft.world.item.ItemStack stack) Cause the drone to drop the given item at its position.intList<net.minecraft.world.entity.Entity>Get the list of entities currently carried by this drone.voidgetContentsToDrop(net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> drops) Collect all items which should be dropped when this BE is broken.net.minecraft.core.BlockPosGet the position of the drone's controller.net.minecraft.core.BlockPosGet the blockpos at which this drone was deployed (by player or dispenser).net.minecraft.network.chat.Componentnet.minecraft.world.phys.Vec3Get the drone's exact position.floatnet.minecraft.core.BlockPosintgetEmittingRedstone(net.minecraft.core.Direction direction) protected @NotNull net.minecraftforge.common.util.LazyOptional<net.minecraftforge.energy.IEnergyStorage>getEnergyCap(net.minecraft.core.Direction side) Get the fake player object for the drone.@NotNull net.minecraftforge.common.util.LazyOptional<net.minecraftforge.fluids.capability.IFluidHandler>getFluidCap(net.minecraft.core.Direction side) net.minecraftforge.fluids.IFluidTankGet the drone's fluid tank.net.minecraftforge.items.IItemHandlerModifiablegetInv()Get the drone's inventory.protected net.minecraftforge.common.util.LazyOptional<net.minecraftforge.items.IItemHandler>getInventoryCap(net.minecraft.core.Direction side) getLabel()floatGet the minimum pressure at which this machine can operate.net.minecraft.world.entity.player.PlayergetOwner()Retrieve the owning player of this drone; i.e.Get the UUID of the drone's owner.Get the drone's path navigator object.net.minecraftforge.items.IItemHandlernet.minecraft.world.phys.AABBList<SideConfigurator<?>>Get a collection of all the side configurators this BE hasnet.minecraft.world.entity.ai.goal.GoalSelectorGet the drone's current collection of tasks.net.minecraft.core.BlockPosvoidhandleGUIButtonPress(String tag, boolean shiftHeld, net.minecraft.server.level.ServerPlayer player) booleanHas the drone's normal tasks been overridden by special circumstances? E.g.booleanisBlockValidPathfindBlock(net.minecraft.core.BlockPos pos) Is the given position valid for pathfinding purposes? i.e.booleanbooleanisProgramApplicable(ProgWidgetType<?> widgetType) voidload(net.minecraft.nbt.CompoundTag tag) voidonItemPickupEvent(net.minecraft.world.entity.item.ItemEntity curPickingUpEntity, int stackSize) Called when a drone is picking up an item.voidonLoad()voidonSemiblockEvent(SemiblockEvent event) voidCalled when a machine's upgrades have changed in any way.voidonVariableChanged(String varname, boolean isCoordinate) voidvoidplaySound(net.minecraft.sounds.SoundEvent soundEvent, net.minecraft.sounds.SoundSource category, float volume, float pitch) voidsaveAdditional(net.minecraft.nbt.CompoundTag tag) voidsendWireframeToClient(net.minecraft.core.BlockPos pos) Send a position to the client to be rendered by the Pneumatic Helmet with Entity Tracker.voidsetActiveProgram(IProgWidget widget) voidsetCarryingEntity(net.minecraft.world.entity.Entity entity) Make the drone pick up the given entity.voidsetDugBlock(net.minecraft.core.BlockPos pos) Mark the given block as being dug.voidsetEmittingRedstone(net.minecraft.core.Direction orientation, int emittingRedstone) Make the drone emit redstone in the given direction from its current position.voidsetLogisticsManager(LogisticsManager logisticsManager) voidsetName(net.minecraft.network.chat.Component name) Set the drone's custom name.voidsetOwner(net.minecraft.world.entity.player.Player ownerID) voidvoidstoreTrackerData(net.minecraft.world.item.ItemStack stack) voidvoidCalled on both server and client, before anything elsevoidvoidSets the label that was jumped to last, with a hierarchy in case of External Programs.net.minecraft.world.level.Levelworld()Get the drone's world.Methods inherited from class me.desht.pneumaticcraft.common.block.entity.AbstractAirHandlingBlockEntity
addAir, addLuaMethods, canConnectPneumatic, getCapability, getCriticalPressure, getDangerPressure, getDefaultVolume, getPressure, handleUpdateTag, hasNoConnectedAirHandlers, initializeHullAirHandlerClient, initializeHullAirHandlers, invalidateCaps, onBlockRotated, onNeighborBlockUpdate, readFromPacket, reviveCaps, writeToPacketMethods inherited from class me.desht.pneumaticcraft.common.block.entity.AbstractTickingBlockEntity
tickCommonPostMethods inherited from class me.desht.pneumaticcraft.common.block.entity.AbstractPneumaticCraftBlockEntity
countPlayersUsing, getCachedNeighbor, getCurrentRecipeIdSynced, getCustomName, getDescriptionFields, getDisplayName, getHeatCap, getLuaMethodRegistry, getModelData, getName, getPeripheralType, getPosition, getRotation, getSpeedMultiplierFromUpgrades, getSpeedUsageMultiplierFromUpgrades, getUpdateTag, getUpgradeCache, getUpgradeHandler, getUpgrades, isGuiUseableByPlayer, nonNullLevel, onDescUpdate, onGuiUpdate, onNeighborTileUpdate, requestModelDataUpdate, sendDescriptionPacket, serializeExtraItemData, setChanged, setCustomName, setPreserveStateOnBreak, shouldPreserveStateOnBreak, shouldRerenderChunkOnDescUpdate, shouldSyncField, updateNeighboursMethods inherited from class net.minecraft.world.level.block.entity.BlockEntity
addEntityType, clearRemoved, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getPersistentData, getPosFromTag, getType, getUpdatePacket, hasLevel, isRemoved, loadStatic, onChunkUnloaded, onlyOpCanSetNbt, saveToItem, saveWithFullMetadata, saveWithId, saveWithoutMetadata, setBlockState, setChanged, setLevel, triggerEventMethods inherited from class net.minecraftforge.common.capabilities.CapabilityProvider
areCapsCompatible, areCapsCompatible, deserializeCaps, gatherCapabilities, gatherCapabilities, gatherCapabilities, getCapabilities, serializeCapsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraftforge.common.capabilities.ICapabilityProvider
getCapability, getCapabilityMethods inherited from interface me.desht.pneumaticcraft.api.drone.IDrone
getUpgradesMethods inherited from interface me.desht.pneumaticcraft.common.drone.IDroneBase
getActiveAIManager, getActiveWidget, resetAttackCountMethods inherited from interface net.minecraftforge.common.extensions.IForgeBlockEntity
deserializeNBT, hasCustomOutlineRendering, onDataPacket, serializeNBTMethods inherited from interface me.desht.pneumaticcraft.common.block.entity.ISideConfigurable
isValidMethods inherited from interface net.minecraft.world.MenuProvider
getDisplayNameMethods inherited from interface net.minecraft.world.Nameable
hasCustomName
-
Field Details
-
BLACKLISTED_WIDGETS
-
isIdle
public boolean isIdle -
heldItem
public net.minecraft.world.item.ItemStack heldItem -
shouldChargeHeldItem
public boolean shouldChargeHeldItem -
label
-
ownerNameClient
-
-
Constructor Details
-
ProgrammableControllerBlockEntity
public ProgrammableControllerBlockEntity(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
-
-
Method Details
-
onSemiblockEvent
-
tickCommonPre
public void tickCommonPre()Description copied from class:AbstractTickingBlockEntityCalled on both server and client, before anything else- Overrides:
tickCommonPrein classAbstractAirHandlingBlockEntity
-
tickClient
public void tickClient()- Overrides:
tickClientin classAbstractTickingBlockEntity
-
tickServer
public void tickServer()- Overrides:
tickServerin classAbstractTickingBlockEntity
-
onVariableChanged
- Specified by:
onVariableChangedin interfaceIDroneBase
-
setRemoved
public void setRemoved()- Overrides:
setRemovedin classAbstractAirHandlingBlockEntity
-
getOwnerUUID
Description copied from interface:IDroneGet the UUID of the drone's owner. This will be non-null even if the owning player is offline. A drone deployed by a Dispenser has an arbitrary owner UUID that was assigned to it when it was spawned.- Specified by:
getOwnerUUIDin interfaceIDrone- Returns:
- the owner's UUID
-
getDeployPos
public net.minecraft.core.BlockPos getDeployPos()Description copied from interface:IDroneGet the blockpos at which this drone was deployed (by player or dispenser). For the Programmable Controller, this will simply return the controller's block position.- Specified by:
getDeployPosin interfaceIDrone- Returns:
- the deployment pos
-
handleGUIButtonPress
public void handleGUIButtonPress(String tag, boolean shiftHeld, net.minecraft.server.level.ServerPlayer player) - Specified by:
handleGUIButtonPressin interfaceIGUIButtonSensitive- Overrides:
handleGUIButtonPressin classAbstractPneumaticCraftBlockEntity
-
getPrimaryInventory
public net.minecraftforge.items.IItemHandler getPrimaryInventory()- Specified by:
getPrimaryInventoryin classAbstractPneumaticCraftBlockEntity
-
setOwner
public void setOwner(net.minecraft.world.entity.player.Player ownerID) -
getSideConfigurators
Description copied from interface:ISideConfigurableGet a collection of all the side configurators this BE has- Specified by:
getSideConfiguratorsin interfaceISideConfigurable- Returns:
- the BE's side configurators
-
byIndex
public net.minecraft.core.Direction byIndex()Description copied from interface:ISideConfigurableReturn the (absolute) direction that this BE is facing. Required to determine how to map absolute to relative faces of the block.- Specified by:
byIndexin interfaceISideConfigurable- Returns:
- the BE facing direction
-
createMenu
@Nullable public net.minecraft.world.inventory.AbstractContainerMenu createMenu(int i, net.minecraft.world.entity.player.Inventory playerInventory, net.minecraft.world.entity.player.Player playerEntity) - Specified by:
createMenuin interfacenet.minecraft.world.inventory.MenuConstructor
-
onUpgradesChanged
public void onUpgradesChanged()Description copied from class:AbstractPneumaticCraftBlockEntityCalled when a machine's upgrades have changed in any way. This is also called from readNBT() when saved upgrades are deserialized, so it is not guaranteed that the world field is non-null - beware. If you override this, remember to call the super method!- Specified by:
onUpgradesChangedin interfaceIUpgradeHolder- Overrides:
onUpgradesChangedin classAbstractAirHandlingBlockEntity
-
load
public void load(net.minecraft.nbt.CompoundTag tag) - Overrides:
loadin classAbstractAirHandlingBlockEntity
-
saveAdditional
public void saveAdditional(net.minecraft.nbt.CompoundTag tag) - Overrides:
saveAdditionalin classAbstractAirHandlingBlockEntity
-
getInventoryCap
protected net.minecraftforge.common.util.LazyOptional<net.minecraftforge.items.IItemHandler> getInventoryCap(net.minecraft.core.Direction side) - Overrides:
getInventoryCapin classAbstractPneumaticCraftBlockEntity
-
getFluidCap
@NotNull public @NotNull net.minecraftforge.common.util.LazyOptional<net.minecraftforge.fluids.capability.IFluidHandler> getFluidCap(net.minecraft.core.Direction side) - Overrides:
getFluidCapin classAbstractPneumaticCraftBlockEntity
-
getEnergyCap
@NotNull protected @NotNull net.minecraftforge.common.util.LazyOptional<net.minecraftforge.energy.IEnergyStorage> getEnergyCap(net.minecraft.core.Direction side) - Overrides:
getEnergyCapin classAbstractPneumaticCraftBlockEntity
-
onLoad
public void onLoad()- Specified by:
onLoadin interfacenet.minecraftforge.common.extensions.IForgeBlockEntity- Overrides:
onLoadin classAbstractAirHandlingBlockEntity
-
getMinWorkingPressure
public float getMinWorkingPressure()Description copied from interface:IMinWorkingPressureGet the minimum pressure at which this machine can operate. Used for GUI display purposes (drawing the yellow region of the pressure gauge, but can also be checked elsewhere.- Specified by:
getMinWorkingPressurein interfaceIMinWorkingPressure- Returns:
- the minimum pressure at which this machine can operate
-
getRenderBoundingBox
public net.minecraft.world.phys.AABB getRenderBoundingBox()- Specified by:
getRenderBoundingBoxin interfacenet.minecraftforge.common.extensions.IForgeBlockEntity
-
world
public net.minecraft.world.level.Level world()Description copied from interface:IDroneGet the drone's world. -
getFluidTank
public net.minecraftforge.fluids.IFluidTank getFluidTank()Description copied from interface:IDroneGet the drone's fluid tank. Note that this is also accessible via theForgeCapabilities.FLUID_HANDLERcapability, which should be used in preference.- Specified by:
getFluidTankin interfaceIDrone- Returns:
- a fluid tank
-
getInv
public net.minecraftforge.items.IItemHandlerModifiable getInv()Description copied from interface:IDroneGet the drone's inventory. Note that this is also accessible via theForgeCapabilities.ITEM_HANDLERcapability, which should be used in preference. -
getDronePos
public net.minecraft.world.phys.Vec3 getDronePos()Description copied from interface:IDroneGet the drone's exact position.- Specified by:
getDronePosin interfaceIDrone- Returns:
- the entity position
-
getTargetPos
public net.minecraft.core.BlockPos getTargetPos() -
getControllerPos
public net.minecraft.core.BlockPos getControllerPos()Description copied from interface:IDroneGet the position of the drone's controller. For actual drone entities, this will always beBlockPos.ZERO. If the drone is actually a Programmable Controller, it will be the controller's block position.- Specified by:
getControllerPosin interfaceIDrone
-
sendWireframeToClient
public void sendWireframeToClient(net.minecraft.core.BlockPos pos) Description copied from interface:IDroneSend a position to the client to be rendered by the Pneumatic Helmet with Entity Tracker. This is used to highlight blacklisted block positions.- Specified by:
sendWireframeToClientin interfaceIDrone- Parameters:
pos- a block position
-
getFakePlayer
Description copied from interface:IDroneGet the fake player object for the drone. This will always return null if called client-side.- Specified by:
getFakePlayerin interfaceIDrone- Returns:
- a fake player
-
isBlockValidPathfindBlock
public boolean isBlockValidPathfindBlock(net.minecraft.core.BlockPos pos) Description copied from interface:IDroneIs the given position valid for pathfinding purposes? i.e. may the drone move through or to it?Custom pathfinding functionality may be added via
IDroneRegistry.addPathfindableBlock(Block, IPathfindHandler).- Specified by:
isBlockValidPathfindBlockin interfaceIDrone- Parameters:
pos- a block position- Returns:
- true if the position is valid, false otherwise
-
dropItem
public void dropItem(net.minecraft.world.item.ItemStack stack) Description copied from interface:IDroneCause the drone to drop the given item at its position. The specified item does not need to be in the drone's inventory, nor will it be removed from the drone's inventory if present. -
getContentsToDrop
public void getContentsToDrop(net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> drops) Description copied from class:AbstractPneumaticCraftBlockEntityCollect all items which should be dropped when this BE is broken. Override and extend this in subclassing BE's which have extra inventories to be dropped.- Overrides:
getContentsToDropin classAbstractPneumaticCraftBlockEntity- Parameters:
drops- list in which to collect dropped items
-
setDugBlock
public void setDugBlock(net.minecraft.core.BlockPos pos) Description copied from interface:IDroneMark the given block as being dug.- Specified by:
setDugBlockin interfaceIDrone- Parameters:
pos- a block position
-
getDugPosition
public net.minecraft.core.BlockPos getDugPosition() -
getProgWidgets
- Specified by:
getProgWidgetsin interfaceIDroneBase
-
setActiveProgram
- Specified by:
setActiveProgramin interfaceIDroneBase
-
isProgramApplicable
- Specified by:
isProgramApplicablein interfaceIDroneBase
-
getTargetAI
public net.minecraft.world.entity.ai.goal.GoalSelector getTargetAI()Description copied from interface:IDroneGet the drone's current collection of tasks.- Specified by:
getTargetAIin interfaceIDrone- Returns:
- a vanilla GoalSelector object
-
setEmittingRedstone
public void setEmittingRedstone(net.minecraft.core.Direction orientation, int emittingRedstone) Description copied from interface:IDroneMake the drone emit redstone in the given direction from its current position.- Specified by:
setEmittingRedstonein interfaceIDrone- Parameters:
orientation- the direction to emitemittingRedstone- the redstone level
-
getEmittingRedstone
public int getEmittingRedstone(net.minecraft.core.Direction direction) -
setName
public void setName(net.minecraft.network.chat.Component name) Description copied from interface:IDroneSet the drone's custom name. -
setCarryingEntity
public void setCarryingEntity(net.minecraft.world.entity.Entity entity) Description copied from interface:IDroneMake the drone pick up the given entity. The given entity will be set as a rider of the drone, but it will not have any control over the drone (in fact, its AI is disabled while being carried).- Specified by:
setCarryingEntityin interfaceIDrone- Parameters:
entity- an entity to pick up
-
getCarryingEntities
Description copied from interface:IDroneGet the list of entities currently carried by this drone. Note: although this method returns a list, drones currently support only a single carried entity.- Specified by:
getCarryingEntitiesin interfaceIDrone- Returns:
- a list of entities
-
isAIOverridden
public boolean isAIOverridden()Description copied from interface:IDroneHas the drone's normal tasks been overridden by special circumstances? E.g. drone hacked, or heading to a charging station.- Specified by:
isAIOverriddenin interfaceIDrone- Returns:
- true if the drone's normal AI has been overridden
-
onItemPickupEvent
public void onItemPickupEvent(net.minecraft.world.entity.item.ItemEntity curPickingUpEntity, int stackSize) Description copied from interface:IDroneCalled when a drone is picking up an item.- Specified by:
onItemPickupEventin interfaceIDrone- Parameters:
curPickingUpEntity- the item entitystackSize- the size of the itemstack in the item entity
-
getOwner
public net.minecraft.world.entity.player.Player getOwner()Description copied from interface:IDroneRetrieve the owning player of this drone; i.e. the player who deployed the drone. A drone deployed by a Dispenser does not have a valid player owner. -
overload
- Specified by:
overloadin interfaceIDroneBase
-
getAIManager
- Specified by:
getAIManagerin interfaceIDroneBase
-
updateLabel
public void updateLabel()Description copied from interface:IDroneBaseSets the label that was jumped to last, with a hierarchy in case of External Programs.- Specified by:
updateLabelin interfaceIDroneBase
-
getLogisticsManager
- Specified by:
getLogisticsManagerin interfaceIDroneBase
-
setLogisticsManager
- Specified by:
setLogisticsManagerin interfaceIDroneBase
-
playSound
public void playSound(net.minecraft.sounds.SoundEvent soundEvent, net.minecraft.sounds.SoundSource category, float volume, float pitch) - Specified by:
playSoundin interfaceIDroneBase
-
addAirToDrone
public void addAirToDrone(int air) - Specified by:
addAirToDronein interfaceIDroneBase
-
canMoveIntoFluid
public boolean canMoveIntoFluid(net.minecraft.world.level.material.Fluid fluid) - Specified by:
canMoveIntoFluidin interfaceIDroneBase
-
getDroneItemHandler
- Specified by:
getDroneItemHandlerin interfaceIDroneBase
-
getDronePressure
public float getDronePressure()- Specified by:
getDronePressurein interfaceIDroneBase
-
getActiveWidgetIndex
public int getActiveWidgetIndex()- Specified by:
getActiveWidgetIndexin interfaceIDroneBase
-
getDebugger
- Specified by:
getDebuggerin interfaceIDroneBase
-
getLabel
- Specified by:
getLabelin interfaceIDroneBase
-
getDroneName
public net.minecraft.network.chat.Component getDroneName()- Specified by:
getDroneNamein interfaceIDroneBase
-
storeTrackerData
public void storeTrackerData(net.minecraft.world.item.ItemStack stack) - Specified by:
storeTrackerDatain interfaceIDroneBase
-
isDroneStillValid
public boolean isDroneStillValid()- Specified by:
isDroneStillValidin interfaceIDroneBase
-
chunkloadSelf
public boolean chunkloadSelf() -
chunkloadWorkingChunk
public boolean chunkloadWorkingChunk() -
chunkloadWorkingChunk3x3
public boolean chunkloadWorkingChunk3x3()
-