Package design.aeonic.nifty.api.machine
Class MachineBlockEntity
java.lang.Object
net.minecraft.world.level.block.entity.BlockEntity
design.aeonic.nifty.api.machine.MachineBlockEntity
- All Implemented Interfaces:
AspectProvider<net.minecraft.world.level.block.entity.BlockEntity,
,net.minecraft.core.Direction> AspectProviderBlockEntity
- Direct Known Subclasses:
MachineBlockEntityRedstoneControllable
public abstract class MachineBlockEntity
extends net.minecraft.world.level.block.entity.BlockEntity
implements AspectProviderBlockEntity
-
Field Summary
Fields inherited from class net.minecraft.world.level.block.entity.BlockEntity
level, remove, worldPosition
-
Constructor Summary
ConstructorsConstructorDescriptionMachineBlockEntity
(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) -
Method Summary
Modifier and TypeMethodDescriptionboolean
canRun()
Checks whether the machine can run this tick.abstract MachineConsumption
Returns the machine consumption for this blockentity, which automatically calls its methods before execution and serializes/deserializes it with the blockentity.void
load
(net.minecraft.nbt.CompoundTag tag) abstract void
runMachine
(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) Called every server tick if the checks incanRun()
pass, and afterMachineConsumption.run()
if the machine consumption for this machine is nonnull.protected void
saveAdditional
(net.minecraft.nbt.CompoundTag tag) void
serverTick
(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) Called every tick on the server.Methods inherited from class net.minecraft.world.level.block.entity.BlockEntity
addEntityType, clearRemoved, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getPosFromTag, getType, getUpdatePacket, getUpdateTag, hasLevel, isRemoved, loadStatic, onlyOpCanSetNbt, saveToItem, saveWithFullMetadata, saveWithId, saveWithoutMetadata, setBlockState, setChanged, setChanged, setLevel, setRemoved, triggerEvent
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface design.aeonic.nifty.api.aspect.AspectProvider
getAspect, self
-
Constructor Details
-
MachineBlockEntity
public MachineBlockEntity(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
-
-
Method Details
-
getMachineConsumption
Returns the machine consumption for this blockentity, which automatically calls its methods before execution and serializes/deserializes it with the blockentity. If null is returned, does nothing and assumes the canRun check would always assume true. -
canRun
public boolean canRun()Checks whether the machine can run this tick. -
runMachine
public abstract void runMachine(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) Called every server tick if the checks incanRun()
pass, and afterMachineConsumption.run()
if the machine consumption for this machine is nonnull. -
serverTick
public void serverTick(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) Called every tick on the server. -
load
public void load(net.minecraft.nbt.CompoundTag tag) - Overrides:
load
in classnet.minecraft.world.level.block.entity.BlockEntity
-
saveAdditional
protected void saveAdditional(net.minecraft.nbt.CompoundTag tag) - Overrides:
saveAdditional
in classnet.minecraft.world.level.block.entity.BlockEntity
-