Class UniversalMachinePartBlockEntity

java.lang.Object
net.minecraftforge.common.capabilities.CapabilityProvider<net.minecraft.world.level.block.entity.BlockEntity>
net.minecraft.world.level.block.entity.BlockEntity
com.hbm_m.block.entity.machines.UniversalMachinePartBlockEntity
All Implemented Interfaces:
IFluidConnectorMK2, IEnergyConnector, IMultiblockPart, 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 UniversalMachinePartBlockEntity extends net.minecraft.world.level.block.entity.BlockEntity implements IMultiblockPart, IEnergyConnector, IFluidConnectorMK2
  • Nested Class Summary

    Nested 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

    Fields inherited from class net.minecraft.world.level.block.entity.BlockEntity

    level, remove, worldPosition

    Fields inherited from interface net.minecraftforge.common.extensions.IForgeBlockEntity

    INFINITE_EXTENT_AABB
  • Constructor Summary

    Constructors
    Constructor
    Description
    UniversalMachinePartBlockEntity(net.minecraft.core.BlockPos pPos, net.minecraft.world.level.block.state.BlockState pBlockState)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canConnect(net.minecraft.world.level.material.Fluid fluid, net.minecraft.core.Direction fromDir)
    Может ли этот коннектор принимать/отдавать жидкость указанного типа с указанной стороны.
    boolean
    canConnectEnergy(net.minecraft.core.Direction side)
    Как Forge getCapability(HBM_ENERGY_*): часть с ролью коннектора участвует в визуале проводов и ModCapabilities.hasEnergyComponent(net.minecraft.world.level.block.entity.BlockEntity) на Fabric (instanceof).
    Set<net.minecraft.core.Direction>
     
    Set<net.minecraft.core.Direction>
     
    Set<net.minecraft.core.Direction>
     
    <T> net.minecraftforge.common.util.LazyOptional<T>
    getCapability(net.minecraftforge.common.capabilities.Capability<T> cap, net.minecraft.core.Direction side)
     
    net.minecraft.core.BlockPos
     
    Возвращает текущую роль части (может быть DEFAULT если не назначено).
    net.minecraft.network.protocol.Packet<net.minecraft.network.protocol.game.ClientGamePacketListener>
     
    net.minecraft.nbt.CompoundTag
     
    void
    load(net.minecraft.nbt.CompoundTag pTag)
     
    void
     
    void
    onDataPacket(net.minecraft.network.Connection net, net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket pkt)
     
    void
    Fabric Transfer API: делегирование жидкости в контроллер (аналог Forge getCapability(FLUID_HANDLER, null)).
    protected void
    saveAdditional(net.minecraft.nbt.CompoundTag pTag)
     
    void
    setAllowedClimbSides(Set<net.minecraft.core.Direction> sides)
     
    void
    setAllowedEnergySides(Set<net.minecraft.core.Direction> sides)
    Стороны, с которых часть-коннектор принимает/отдаёт энергию (мировые направления после постройки).
    void
    setAllowedFluidSides(Set<net.minecraft.core.Direction> sides)
    Стороны, с которых часть-коннектор принимает/отдаёт жидкости (мировые направления после постройки).
    void
    setControllerPos(net.minecraft.core.BlockPos pos)
    Устанавливает позицию главного блока-контроллера.
    void
    Устанавливает роль для этой части.
    void
     
    static void
    tick(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, UniversalMachinePartBlockEntity be)
     

    Methods inherited from class net.minecraft.world.level.block.entity.BlockEntity

    addEntityType, clearRemoved, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getPersistentData, getPosFromTag, getType, hasLevel, isRemoved, loadStatic, onlyOpCanSetNbt, saveToItem, saveWithFullMetadata, saveWithId, saveWithoutMetadata, setBlockState, setChanged, setChanged, setLevel, triggerEvent

    Methods inherited from class net.minecraftforge.common.capabilities.CapabilityProvider

    areCapsCompatible, areCapsCompatible, deserializeCaps, gatherCapabilities, gatherCapabilities, gatherCapabilities, getCapabilities, invalidateCaps, reviveCaps, serializeCaps

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.minecraftforge.common.capabilities.ICapabilityProvider

    getCapability

    Methods inherited from interface net.minecraftforge.common.extensions.IForgeBlockEntity

    deserializeNBT, getModelData, getRenderBoundingBox, handleUpdateTag, hasCustomOutlineRendering, requestModelDataUpdate, serializeNBT
  • Constructor Details

    • UniversalMachinePartBlockEntity

      public UniversalMachinePartBlockEntity(net.minecraft.core.BlockPos pPos, net.minecraft.world.level.block.state.BlockState pBlockState)
  • Method Details

    • setRemoved

      public void setRemoved()
      Overrides:
      setRemoved in class net.minecraft.world.level.block.entity.BlockEntity
    • canConnect

      public boolean canConnect(net.minecraft.world.level.material.Fluid fluid, net.minecraft.core.Direction fromDir)
      Description copied from interface: IFluidConnectorMK2
      Может ли этот коннектор принимать/отдавать жидкость указанного типа с указанной стороны.
      Specified by:
      canConnect in interface IFluidConnectorMK2
      Parameters:
      fluid - тип жидкости
      fromDir - направление ОТ ЭТОГО узла к соседу (сторона, через которую идёт соединение)
    • setControllerPos

      public void setControllerPos(net.minecraft.core.BlockPos pos)
      Description copied from interface: IMultiblockPart
      Устанавливает позицию главного блока-контроллера. Этот метод вызывается из MultiblockStructureHelper при постройке структуры.
      Specified by:
      setControllerPos in interface IMultiblockPart
      Parameters:
      pos - Позиция контроллера.
    • setPartRole

      public void setPartRole(PartRole role)
      Description copied from interface: IMultiblockPart
      Устанавливает роль для этой части. Вызывается контроллером при постройке.
      Specified by:
      setPartRole in interface IMultiblockPart
      Parameters:
      role - Роль, назначенная этой части.
    • tick

      public static void tick(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, UniversalMachinePartBlockEntity be)
    • getControllerPos

      public net.minecraft.core.BlockPos getControllerPos()
      Specified by:
      getControllerPos in interface IMultiblockPart
      Returns:
      Позиция главного блока-контроллера, или null, если она не установлена.
    • getPartRole

      public PartRole getPartRole()
      Description copied from interface: IMultiblockPart
      Возвращает текущую роль части (может быть DEFAULT если не назначено).
      Specified by:
      getPartRole in interface IMultiblockPart
    • setAllowedClimbSides

      public void setAllowedClimbSides(Set<net.minecraft.core.Direction> sides)
      Specified by:
      setAllowedClimbSides in interface IMultiblockPart
    • getAllowedClimbSides

      public Set<net.minecraft.core.Direction> getAllowedClimbSides()
      Specified by:
      getAllowedClimbSides in interface IMultiblockPart
    • setAllowedEnergySides

      public void setAllowedEnergySides(Set<net.minecraft.core.Direction> sides)
      Description copied from interface: IMultiblockPart
      Стороны, с которых часть-коннектор принимает/отдаёт энергию (мировые направления после постройки). Для частей без роли энергоконнектора можно не вызывать; по умолчанию - см. default-реализацию.
      Specified by:
      setAllowedEnergySides in interface IMultiblockPart
    • getAllowedEnergySides

      public Set<net.minecraft.core.Direction> getAllowedEnergySides()
      Specified by:
      getAllowedEnergySides in interface IMultiblockPart
      Returns:
      разрешённые стороны энергии; пустой набор на коннекторе трактуется как «все стороны» (совместимость).
    • setAllowedFluidSides

      public void setAllowedFluidSides(Set<net.minecraft.core.Direction> sides)
      Description copied from interface: IMultiblockPart
      Стороны, с которых часть-коннектор принимает/отдаёт жидкости (мировые направления после постройки). Для частей без роли жидкостного коннектора можно не вызывать; по умолчанию - см. default-реализацию.
      Specified by:
      setAllowedFluidSides in interface IMultiblockPart
    • getAllowedFluidSides

      public Set<net.minecraft.core.Direction> getAllowedFluidSides()
      Specified by:
      getAllowedFluidSides in interface IMultiblockPart
      Returns:
      разрешённые стороны для жидкостей; пустой набор трактуется как «все стороны» (совместимость).
    • canConnectEnergy

      public boolean canConnectEnergy(@Nullable net.minecraft.core.Direction side)
      Как Forge getCapability(HBM_ENERGY_*): часть с ролью коннектора участвует в визуале проводов и ModCapabilities.hasEnergyComponent(net.minecraft.world.level.block.entity.BlockEntity) на Fabric (instanceof).
      Specified by:
      canConnectEnergy in interface IEnergyConnector
      Parameters:
      side - Сторона подключения (null = любая)
    • onLoad

      public void onLoad()
      Fabric Transfer API: делегирование жидкости в контроллер (аналог Forge getCapability(FLUID_HANDLER, null)).
      Specified by:
      onLoad in interface net.minecraftforge.common.extensions.IForgeBlockEntity
    • onChunkUnloaded

      public void onChunkUnloaded()
      Specified by:
      onChunkUnloaded in interface net.minecraftforge.common.extensions.IForgeBlockEntity
      Overrides:
      onChunkUnloaded in class net.minecraft.world.level.block.entity.BlockEntity
    • getCapability

      @NotNull public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(@NotNull net.minecraftforge.common.capabilities.Capability<T> cap, @Nullable net.minecraft.core.Direction side)
      Specified by:
      getCapability in interface net.minecraftforge.common.capabilities.ICapabilityProvider
      Overrides:
      getCapability in class net.minecraftforge.common.capabilities.CapabilityProvider<net.minecraft.world.level.block.entity.BlockEntity>
    • saveAdditional

      protected void saveAdditional(net.minecraft.nbt.CompoundTag pTag)
      Overrides:
      saveAdditional in class net.minecraft.world.level.block.entity.BlockEntity
    • load

      public void load(net.minecraft.nbt.CompoundTag pTag)
      Overrides:
      load in class net.minecraft.world.level.block.entity.BlockEntity
    • getUpdatePacket

      @Nullable public net.minecraft.network.protocol.Packet<net.minecraft.network.protocol.game.ClientGamePacketListener> getUpdatePacket()
      Overrides:
      getUpdatePacket in class net.minecraft.world.level.block.entity.BlockEntity
    • getUpdateTag

      public net.minecraft.nbt.CompoundTag getUpdateTag()
      Overrides:
      getUpdateTag in class net.minecraft.world.level.block.entity.BlockEntity
    • onDataPacket

      public void onDataPacket(net.minecraft.network.Connection net, net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket pkt)
      Specified by:
      onDataPacket in interface net.minecraftforge.common.extensions.IForgeBlockEntity