Package com.hbm_m.block.entity.machines
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, worldPositionFields inherited from interface net.minecraftforge.common.extensions.IForgeBlockEntity
INFINITE_EXTENT_AABB -
Constructor Summary
ConstructorsConstructorDescriptionUniversalMachinePartBlockEntity(net.minecraft.core.BlockPos pPos, net.minecraft.world.level.block.state.BlockState pBlockState) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanConnect(net.minecraft.world.level.material.Fluid fluid, net.minecraft.core.Direction fromDir) Может ли этот коннектор принимать/отдавать жидкость указанного типа с указанной стороны.booleancanConnectEnergy(net.minecraft.core.Direction side) Как ForgegetCapability(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.CompoundTagvoidload(net.minecraft.nbt.CompoundTag pTag) voidvoidonDataPacket(net.minecraft.network.Connection net, net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket pkt) voidonLoad()Fabric Transfer API: делегирование жидкости в контроллер (аналог ForgegetCapability(FLUID_HANDLER, null)).protected voidsaveAdditional(net.minecraft.nbt.CompoundTag pTag) voidsetAllowedClimbSides(Set<net.minecraft.core.Direction> sides) voidsetAllowedEnergySides(Set<net.minecraft.core.Direction> sides) Стороны, с которых часть-коннектор принимает/отдаёт энергию (мировые направления после постройки).voidsetAllowedFluidSides(Set<net.minecraft.core.Direction> sides) Стороны, с которых часть-коннектор принимает/отдаёт жидкости (мировые направления после постройки).voidsetControllerPos(net.minecraft.core.BlockPos pos) Устанавливает позицию главного блока-контроллера.voidsetPartRole(PartRole role) Устанавливает роль для этой части.voidstatic voidtick(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, triggerEventMethods inherited from class net.minecraftforge.common.capabilities.CapabilityProvider
areCapsCompatible, areCapsCompatible, deserializeCaps, gatherCapabilities, gatherCapabilities, gatherCapabilities, getCapabilities, invalidateCaps, reviveCaps, 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
getCapabilityMethods 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:
setRemovedin classnet.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:
canConnectin interfaceIFluidConnectorMK2- Parameters:
fluid- тип жидкостиfromDir- направление ОТ ЭТОГО узла к соседу (сторона, через которую идёт соединение)
-
setControllerPos
public void setControllerPos(net.minecraft.core.BlockPos pos) Description copied from interface:IMultiblockPartУстанавливает позицию главного блока-контроллера. Этот метод вызывается из MultiblockStructureHelper при постройке структуры.- Specified by:
setControllerPosin interfaceIMultiblockPart- Parameters:
pos- Позиция контроллера.
-
setPartRole
Description copied from interface:IMultiblockPartУстанавливает роль для этой части. Вызывается контроллером при постройке.- Specified by:
setPartRolein interfaceIMultiblockPart- 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:
getControllerPosin interfaceIMultiblockPart- Returns:
- Позиция главного блока-контроллера, или null, если она не установлена.
-
getPartRole
Description copied from interface:IMultiblockPartВозвращает текущую роль части (может быть DEFAULT если не назначено).- Specified by:
getPartRolein interfaceIMultiblockPart
-
setAllowedClimbSides
- Specified by:
setAllowedClimbSidesin interfaceIMultiblockPart
-
getAllowedClimbSides
- Specified by:
getAllowedClimbSidesin interfaceIMultiblockPart
-
setAllowedEnergySides
Description copied from interface:IMultiblockPartСтороны, с которых часть-коннектор принимает/отдаёт энергию (мировые направления после постройки). Для частей без роли энергоконнектора можно не вызывать; по умолчанию - см. default-реализацию.- Specified by:
setAllowedEnergySidesin interfaceIMultiblockPart
-
getAllowedEnergySides
- Specified by:
getAllowedEnergySidesin interfaceIMultiblockPart- Returns:
- разрешённые стороны энергии; пустой набор на коннекторе трактуется как «все стороны» (совместимость).
-
setAllowedFluidSides
Description copied from interface:IMultiblockPartСтороны, с которых часть-коннектор принимает/отдаёт жидкости (мировые направления после постройки). Для частей без роли жидкостного коннектора можно не вызывать; по умолчанию - см. default-реализацию.- Specified by:
setAllowedFluidSidesin interfaceIMultiblockPart
-
getAllowedFluidSides
- Specified by:
getAllowedFluidSidesin interfaceIMultiblockPart- Returns:
- разрешённые стороны для жидкостей; пустой набор трактуется как «все стороны» (совместимость).
-
canConnectEnergy
public boolean canConnectEnergy(@Nullable net.minecraft.core.Direction side) Как ForgegetCapability(HBM_ENERGY_*): часть с ролью коннектора участвует в визуале проводов иModCapabilities.hasEnergyComponent(net.minecraft.world.level.block.entity.BlockEntity)на Fabric (instanceof).- Specified by:
canConnectEnergyin interfaceIEnergyConnector- Parameters:
side- Сторона подключения (null = любая)
-
onLoad
public void onLoad()Fabric Transfer API: делегирование жидкости в контроллер (аналог ForgegetCapability(FLUID_HANDLER, null)).- Specified by:
onLoadin interfacenet.minecraftforge.common.extensions.IForgeBlockEntity
-
onChunkUnloaded
public void onChunkUnloaded()- Specified by:
onChunkUnloadedin interfacenet.minecraftforge.common.extensions.IForgeBlockEntity- Overrides:
onChunkUnloadedin classnet.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:
getCapabilityin interfacenet.minecraftforge.common.capabilities.ICapabilityProvider- Overrides:
getCapabilityin classnet.minecraftforge.common.capabilities.CapabilityProvider<net.minecraft.world.level.block.entity.BlockEntity>
-
saveAdditional
protected void saveAdditional(net.minecraft.nbt.CompoundTag pTag) - Overrides:
saveAdditionalin classnet.minecraft.world.level.block.entity.BlockEntity
-
load
public void load(net.minecraft.nbt.CompoundTag pTag) - Overrides:
loadin classnet.minecraft.world.level.block.entity.BlockEntity
-
getUpdatePacket
@Nullable public net.minecraft.network.protocol.Packet<net.minecraft.network.protocol.game.ClientGamePacketListener> getUpdatePacket()- Overrides:
getUpdatePacketin classnet.minecraft.world.level.block.entity.BlockEntity
-
getUpdateTag
public net.minecraft.nbt.CompoundTag getUpdateTag()- Overrides:
getUpdateTagin classnet.minecraft.world.level.block.entity.BlockEntity
-
onDataPacket
public void onDataPacket(net.minecraft.network.Connection net, net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket pkt) - Specified by:
onDataPacketin interfacenet.minecraftforge.common.extensions.IForgeBlockEntity
-