Class ProgrammableControllerBlockEntity

java.lang.Object
net.minecraftforge.common.capabilities.CapabilityProvider<net.minecraft.world.level.block.entity.BlockEntity>
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
  • Field Details

    • BLACKLISTED_WIDGETS

      public static final Set<net.minecraft.resources.ResourceLocation> BLACKLISTED_WIDGETS
    • isIdle

      public boolean isIdle
    • heldItem

      public net.minecraft.world.item.ItemStack heldItem
    • shouldChargeHeldItem

      public boolean shouldChargeHeldItem
    • label

      public String label
    • ownerNameClient

      public String ownerNameClient
  • Constructor Details

    • ProgrammableControllerBlockEntity

      public ProgrammableControllerBlockEntity(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
  • Method Details

    • onSemiblockEvent

      public void onSemiblockEvent(SemiblockEvent event)
    • tickCommonPre

      public void tickCommonPre()
      Description copied from class: AbstractTickingBlockEntity
      Called on both server and client, before anything else
      Overrides:
      tickCommonPre in class AbstractAirHandlingBlockEntity
    • tickClient

      public void tickClient()
      Overrides:
      tickClient in class AbstractTickingBlockEntity
    • tickServer

      public void tickServer()
      Overrides:
      tickServer in class AbstractTickingBlockEntity
    • onVariableChanged

      public void onVariableChanged(String varname, boolean isCoordinate)
      Specified by:
      onVariableChanged in interface IDroneBase
    • setRemoved

      public void setRemoved()
      Overrides:
      setRemoved in class AbstractAirHandlingBlockEntity
    • getOwnerUUID

      public UUID getOwnerUUID()
      Description copied from interface: IDrone
      Get 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:
      getOwnerUUID in interface IDrone
      Returns:
      the owner's UUID
    • getDeployPos

      public net.minecraft.core.BlockPos getDeployPos()
      Description copied from interface: IDrone
      Get 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:
      getDeployPos in interface IDrone
      Returns:
      the deployment pos
    • handleGUIButtonPress

      public void handleGUIButtonPress(String tag, boolean shiftHeld, net.minecraft.server.level.ServerPlayer player)
      Specified by:
      handleGUIButtonPress in interface IGUIButtonSensitive
      Overrides:
      handleGUIButtonPress in class AbstractPneumaticCraftBlockEntity
    • getPrimaryInventory

      public net.minecraftforge.items.IItemHandler getPrimaryInventory()
      Specified by:
      getPrimaryInventory in class AbstractPneumaticCraftBlockEntity
    • setOwner

      public void setOwner(net.minecraft.world.entity.player.Player ownerID)
    • getSideConfigurators

      public List<SideConfigurator<?>> getSideConfigurators()
      Description copied from interface: ISideConfigurable
      Get a collection of all the side configurators this BE has
      Specified by:
      getSideConfigurators in interface ISideConfigurable
      Returns:
      the BE's side configurators
    • byIndex

      public net.minecraft.core.Direction byIndex()
      Description copied from interface: ISideConfigurable
      Return the (absolute) direction that this BE is facing. Required to determine how to map absolute to relative faces of the block.
      Specified by:
      byIndex in interface ISideConfigurable
      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:
      createMenu in interface net.minecraft.world.inventory.MenuConstructor
    • onUpgradesChanged

      public void onUpgradesChanged()
      Description copied from class: AbstractPneumaticCraftBlockEntity
      Called 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:
      onUpgradesChanged in interface IUpgradeHolder
      Overrides:
      onUpgradesChanged in class AbstractAirHandlingBlockEntity
    • load

      public void load(net.minecraft.nbt.CompoundTag tag)
      Overrides:
      load in class AbstractAirHandlingBlockEntity
    • saveAdditional

      public void saveAdditional(net.minecraft.nbt.CompoundTag tag)
      Overrides:
      saveAdditional in class AbstractAirHandlingBlockEntity
    • getInventoryCap

      protected net.minecraftforge.common.util.LazyOptional<net.minecraftforge.items.IItemHandler> getInventoryCap(net.minecraft.core.Direction side)
      Overrides:
      getInventoryCap in class AbstractPneumaticCraftBlockEntity
    • getFluidCap

      @NotNull public @NotNull net.minecraftforge.common.util.LazyOptional<net.minecraftforge.fluids.capability.IFluidHandler> getFluidCap(net.minecraft.core.Direction side)
      Overrides:
      getFluidCap in class AbstractPneumaticCraftBlockEntity
    • getEnergyCap

      @NotNull protected @NotNull net.minecraftforge.common.util.LazyOptional<net.minecraftforge.energy.IEnergyStorage> getEnergyCap(net.minecraft.core.Direction side)
      Overrides:
      getEnergyCap in class AbstractPneumaticCraftBlockEntity
    • onLoad

      public void onLoad()
      Specified by:
      onLoad in interface net.minecraftforge.common.extensions.IForgeBlockEntity
      Overrides:
      onLoad in class AbstractAirHandlingBlockEntity
    • getMinWorkingPressure

      public float getMinWorkingPressure()
      Description copied from interface: IMinWorkingPressure
      Get 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:
      getMinWorkingPressure in interface IMinWorkingPressure
      Returns:
      the minimum pressure at which this machine can operate
    • getRenderBoundingBox

      public net.minecraft.world.phys.AABB getRenderBoundingBox()
      Specified by:
      getRenderBoundingBox in interface net.minecraftforge.common.extensions.IForgeBlockEntity
    • world

      public net.minecraft.world.level.Level world()
      Description copied from interface: IDrone
      Get the drone's world.
      Specified by:
      world in interface IDrone
      Returns:
      a world
    • getFluidTank

      public net.minecraftforge.fluids.IFluidTank getFluidTank()
      Description copied from interface: IDrone
      Get the drone's fluid tank. Note that this is also accessible via the CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY capability, which should be used in preference.
      Specified by:
      getFluidTank in interface IDrone
      Returns:
      a fluid tank
    • getInv

      public net.minecraftforge.items.IItemHandlerModifiable getInv()
      Description copied from interface: IDrone
      Get the drone's inventory. Note that this is also accessible via the CapabilityItemHandler.ITEM_HANDLER_CAPABILITY capability, which should be used in preference.
      Specified by:
      getInv in interface IDrone
      Returns:
      an inventory
    • getDronePos

      public net.minecraft.world.phys.Vec3 getDronePos()
      Description copied from interface: IDrone
      Get the drone's exact position.
      Specified by:
      getDronePos in interface IDrone
      Returns:
      the entity position
    • getTargetPos

      public net.minecraft.core.BlockPos getTargetPos()
    • getControllerPos

      public net.minecraft.core.BlockPos getControllerPos()
      Description copied from interface: IDrone
      Get the position of the drone's controller. For actual drone entities, this will always be BlockPos.ZERO. If the drone is actually a Programmable Controller, it will be the controller's block position.
      Specified by:
      getControllerPos in interface IDrone
    • getPathNavigator

      public IPathNavigator getPathNavigator()
      Description copied from interface: IDrone
      Get the drone's path navigator object.
      Specified by:
      getPathNavigator in interface IDrone
      Returns:
      the path navigator
    • sendWireframeToClient

      public void sendWireframeToClient(net.minecraft.core.BlockPos pos)
      Description copied from interface: IDrone
      Send 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:
      sendWireframeToClient in interface IDrone
      Parameters:
      pos - a block position
    • getFakePlayer

      public DroneFakePlayer getFakePlayer()
      Description copied from interface: IDrone
      Get the fake player object for the drone. This will always return null if called client-side.
      Specified by:
      getFakePlayer in interface IDrone
      Returns:
      a fake player
    • isBlockValidPathfindBlock

      public boolean isBlockValidPathfindBlock(net.minecraft.core.BlockPos pos)
      Description copied from interface: IDrone
      Is 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:
      isBlockValidPathfindBlock in interface IDrone
      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: IDrone
      Cause 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.
      Specified by:
      dropItem in interface IDrone
      Parameters:
      stack - the item stack to drop
    • getContentsToDrop

      public void getContentsToDrop(net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> drops)
      Description copied from class: AbstractPneumaticCraftBlockEntity
      Collect 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:
      getContentsToDrop in class AbstractPneumaticCraftBlockEntity
      Parameters:
      drops - list in which to collect dropped items
    • setDugBlock

      public void setDugBlock(net.minecraft.core.BlockPos pos)
      Description copied from interface: IDrone
      Mark the given block as being dug.
      Specified by:
      setDugBlock in interface IDrone
      Parameters:
      pos - a block position
    • getDugPosition

      public net.minecraft.core.BlockPos getDugPosition()
    • getProgWidgets

      public List<IProgWidget> getProgWidgets()
      Specified by:
      getProgWidgets in interface IDroneBase
    • setActiveProgram

      public void setActiveProgram(IProgWidget widget)
      Specified by:
      setActiveProgram in interface IDroneBase
    • isProgramApplicable

      public boolean isProgramApplicable(ProgWidgetType<?> widgetType)
      Specified by:
      isProgramApplicable in interface IDroneBase
    • getTargetAI

      public net.minecraft.world.entity.ai.goal.GoalSelector getTargetAI()
      Description copied from interface: IDrone
      Get the drone's current collection of tasks.
      Specified by:
      getTargetAI in interface IDrone
      Returns:
      a vanilla GoalSelector object
    • setEmittingRedstone

      public void setEmittingRedstone(net.minecraft.core.Direction orientation, int emittingRedstone)
      Description copied from interface: IDrone
      Make the drone emit redstone in the given direction from its current position.
      Specified by:
      setEmittingRedstone in interface IDrone
      Parameters:
      orientation - the direction to emit
      emittingRedstone - the redstone level
    • getEmittingRedstone

      public int getEmittingRedstone(net.minecraft.core.Direction direction)
      Specified by:
      getEmittingRedstone in interface IDrone
    • setName

      public void setName(net.minecraft.network.chat.Component name)
      Description copied from interface: IDrone
      Set the drone's custom name.
      Specified by:
      setName in interface IDrone
      Parameters:
      name - a custom name
    • setCarryingEntity

      public void setCarryingEntity(net.minecraft.world.entity.Entity entity)
      Description copied from interface: IDrone
      Make 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:
      setCarryingEntity in interface IDrone
      Parameters:
      entity - an entity to pick up
    • getCarryingEntities

      public List<net.minecraft.world.entity.Entity> getCarryingEntities()
      Description copied from interface: IDrone
      Get 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:
      getCarryingEntities in interface IDrone
      Returns:
      a list of entities
    • isAIOverridden

      public boolean isAIOverridden()
      Description copied from interface: IDrone
      Has the drone's normal tasks been overridden by special circumstances? E.g. drone hacked, or heading to a charging station.
      Specified by:
      isAIOverridden in interface IDrone
      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: IDrone
      Called when a drone is picking up an item.
      Specified by:
      onItemPickupEvent in interface IDrone
      Parameters:
      curPickingUpEntity - the item entity
      stackSize - the size of the itemstack in the item entity
    • getOwner

      public net.minecraft.world.entity.player.Player getOwner()
      Description copied from interface: IDrone
      Retrieve 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.
      Specified by:
      getOwner in interface IDrone
      Returns:
      the owning player; will be null if the owner is offline or the drone was not player-deployed
    • overload

      public void overload(String msgKey, Object... params)
      Specified by:
      overload in interface IDroneBase
    • getAIManager

      public DroneAIManager getAIManager()
      Specified by:
      getAIManager in interface IDroneBase
    • updateLabel

      public void updateLabel()
      Description copied from interface: IDroneBase
      Sets the label that was jumped to last, with a hierarchy in case of External Programs.
      Specified by:
      updateLabel in interface IDroneBase
    • getLogisticsManager

      public LogisticsManager getLogisticsManager()
      Specified by:
      getLogisticsManager in interface IDroneBase
    • setLogisticsManager

      public void setLogisticsManager(LogisticsManager logisticsManager)
      Specified by:
      setLogisticsManager in interface IDroneBase
    • playSound

      public void playSound(net.minecraft.sounds.SoundEvent soundEvent, net.minecraft.sounds.SoundSource category, float volume, float pitch)
      Specified by:
      playSound in interface IDroneBase
    • addAirToDrone

      public void addAirToDrone(int air)
      Specified by:
      addAirToDrone in interface IDroneBase
    • canMoveIntoFluid

      public boolean canMoveIntoFluid(net.minecraft.world.level.material.Fluid fluid)
      Specified by:
      canMoveIntoFluid in interface IDroneBase
    • getDroneItemHandler

      public DroneItemHandler getDroneItemHandler()
      Specified by:
      getDroneItemHandler in interface IDroneBase
    • getDronePressure

      public float getDronePressure()
      Specified by:
      getDronePressure in interface IDroneBase
    • getActiveWidgetIndex

      public int getActiveWidgetIndex()
      Specified by:
      getActiveWidgetIndex in interface IDroneBase
    • getDebugger

      public DroneDebugger getDebugger()
      Specified by:
      getDebugger in interface IDroneBase
    • getLabel

      public String getLabel()
      Specified by:
      getLabel in interface IDroneBase
    • getDroneName

      public net.minecraft.network.chat.Component getDroneName()
      Specified by:
      getDroneName in interface IDroneBase
    • storeTrackerData

      public void storeTrackerData(net.minecraft.world.item.ItemStack stack)
      Specified by:
      storeTrackerData in interface IDroneBase
    • isDroneStillValid

      public boolean isDroneStillValid()
      Specified by:
      isDroneStillValid in interface IDroneBase
    • chunkloadSelf

      public boolean chunkloadSelf()
    • chunkloadWorkingChunk

      public boolean chunkloadWorkingChunk()
    • chunkloadWorkingChunk3x3

      public boolean chunkloadWorkingChunk3x3()