Class ChargingStationBlockEntity

java.lang.Object
net.minecraftforge.common.capabilities.CapabilityProvider<net.minecraft.world.level.block.entity.BlockEntity>
All Implemented Interfaces:
CamouflageableBlockEntity, IGUIButtonSensitive, ILuaMethodProvider, IRedstoneControl<ChargingStationBlockEntity>, 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 ChargingStationBlockEntity extends AbstractAirHandlingBlockEntity implements IRedstoneControl<ChargingStationBlockEntity>, CamouflageableBlockEntity, net.minecraft.world.MenuProvider
  • Field Details

    • CHARGE_INVENTORY_INDEX

      public static final int CHARGE_INVENTORY_INDEX
      See Also:
    • chargingItemPressure

      public float chargingItemPressure
    • charging

      public boolean charging
    • discharging

      public boolean discharging
    • upgradeOnly

      public boolean upgradeOnly
  • Constructor Details

    • ChargingStationBlockEntity

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

    • getChargingStack

      @Nonnull public net.minecraft.world.item.ItemStack getChargingStack()
    • getChargingStackSynced

      @Nonnull public net.minecraft.world.item.ItemStack getChargingStackSynced()
    • tickServer

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

      public boolean canConnectPneumatic(net.minecraft.core.Direction side)
      Description copied from class: AbstractAirHandlingBlockEntity
      Checks if the given side of this BE can be pneumatically connected to.
      Overrides:
      canConnectPneumatic in class AbstractAirHandlingBlockEntity
      Parameters:
      side - the side to check
      Returns:
      true if connected, false otherwise
    • 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
    • getRenderBoundingBox

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

      public ChargeableItemHandler getChargeableInventory()
    • getInventoryCap

      protected net.minecraftforge.common.util.LazyOptional<net.minecraftforge.items.IItemHandler> getInventoryCap(net.minecraft.core.Direction side)
      Overrides:
      getInventoryCap in class AbstractPneumaticCraftBlockEntity
    • 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
    • serializeExtraItemData

      public void serializeExtraItemData(net.minecraft.nbt.CompoundTag blockEntityTag, boolean preserveState)
      Description copied from class: AbstractPneumaticCraftBlockEntity
      Get any extra data to be serialized onto a dropped item stack. The supplied tag is the "BlockEntityTag" subtag of the item's NBT data, so will be automatically deserialized into the BE (i.e. available to BlockEntity.load(CompoundTag) method) when the itemblock is next placed.
      Overrides:
      serializeExtraItemData in class AbstractPneumaticCraftBlockEntity
      Parameters:
      blockEntityTag - the existing "BlockEntityTag" subtag to add data to
      preserveState - true when dropped with a wrench, false when broken with a pickaxe etc.
    • writeToPacket

      public void writeToPacket(net.minecraft.nbt.CompoundTag tag)
      Description copied from class: AbstractPneumaticCraftBlockEntity
      Encoded into the description packet. Also included in saved data written by BlockEntity.saveAdditional(CompoundTag) Prefer to use @DescSynced where possible - use this either for complex fields not handled by @DescSynced, or for non-ticking tile entities.
      Specified by:
      writeToPacket in interface IDescSynced
      Overrides:
      writeToPacket in class AbstractAirHandlingBlockEntity
      Parameters:
      tag - NBT tag
    • readFromPacket

      public void readFromPacket(net.minecraft.nbt.CompoundTag tag)
      Description copied from class: AbstractPneumaticCraftBlockEntity
      Encoded into the description packet. Also included in saved data read by AbstractPneumaticCraftBlockEntity.load(CompoundTag). Prefer to use @DescSynced where possible - use this either for complex fields not handled by @DescSynced, or for non-ticking tile entities.
      Specified by:
      readFromPacket in interface IDescSynced
      Overrides:
      readFromPacket in class AbstractAirHandlingBlockEntity
      Parameters:
      tag - NBT tag
    • 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
    • getRedstoneController

      public RedstoneController<ChargingStationBlockEntity> getRedstoneController()
      Description copied from interface: IRedstoneControl
      Get the redstone controller object for this BE
      Specified by:
      getRedstoneController in interface IRedstoneControl<ChargingStationBlockEntity>
      Returns:
      the redstone controller
    • shouldRerenderChunkOnDescUpdate

      protected boolean shouldRerenderChunkOnDescUpdate()
      Overrides:
      shouldRerenderChunkOnDescUpdate in class AbstractPneumaticCraftBlockEntity
    • getCamouflage

      public net.minecraft.world.level.block.state.BlockState getCamouflage()
      Description copied from interface: CamouflageableBlockEntity
      Get the camouflage state; the blockstate which will be used to render this block entity's block.
      Specified by:
      getCamouflage in interface CamouflageableBlockEntity
      Returns:
      the camouflage state, or null if the block should not be camouflaged
    • setCamouflage

      public void setCamouflage(net.minecraft.world.level.block.state.BlockState state)
      Description copied from interface: CamouflageableBlockEntity
      Set the camouflage for the block entity. The block entity should sync this state to the client, and do any necessary re-rendering of the block when the synced state changes.
      Specified by:
      setCamouflage in interface CamouflageableBlockEntity
      Parameters:
      state - the camo block state
    • setRemoved

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

      public void clearRemoved()
      Overrides:
      clearRemoved in class net.minecraft.world.level.block.entity.BlockEntity
    • 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