Class KineticBlockEntity
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.block.entity.BlockEntity
com.simibubi.create.foundation.blockEntity.SyncedBlockEntity
com.simibubi.create.foundation.blockEntity.CachedRenderBBBlockEntity
com.simibubi.create.foundation.blockEntity.SmartBlockEntity
com.simibubi.create.content.kinetics.base.KineticBlockEntity
- All Implemented Interfaces:
IHaveCustomOverlayIcon,IHaveGoggleInformation,IHaveHoveringInformation,PartialSafeNBT,SpecialBlockEntityItemRequirement,IInteractionChecker,net.createmod.ponder.api.VirtualBlockEntity,net.neoforged.neoforge.attachment.IAttachmentHolder,net.neoforged.neoforge.common.extensions.IBlockEntityExtension
- Direct Known Subclasses:
ArmBlockEntity,BacktankBlockEntity,BasinOperatingBlockEntity,BeltBlockEntity,BlockBreakingKineticBlockEntity,ChainConveyorBlockEntity,ChainGearshiftBlockEntity,ClockworkBearingBlockEntity,CrushingWheelBlockEntity,CuckooClockBlockEntity,DeployerBlockEntity,DirectionalShaftHalvesBlockEntity,EjectorBlockEntity,EncasedFanBlockEntity,FlapDisplayBlockEntity,FluidValveBlockEntity,FlywheelBlockEntity,GantryCarriageBlockEntity,GantryShaftBlockEntity,GaugeBlockEntity,GeneratingKineticBlockEntity,HosePulleyBlockEntity,LinearActuatorBlockEntity,MechanicalCrafterBlockEntity,MillstoneBlockEntity,PumpBlockEntity,SimpleKineticBlockEntity,SpeedControllerBlockEntity,TurntableBlockEntity
public class KineticBlockEntity
extends SmartBlockEntity
implements IHaveGoggleInformation, IHaveHoveringInformation
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.level.block.entity.BlockEntity
net.minecraft.world.level.block.entity.BlockEntity.DataComponentInputNested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
net.neoforged.neoforge.attachment.AttachmentHolder.AsField -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected floatprotected KineticEffectHandlerprotected floatprotected float@Nullable Longbooleanprotected booleanint@Nullable net.minecraft.core.BlockPosprotected floatprotected floatbooleanprotected booleanFields inherited from class com.simibubi.create.foundation.blockEntity.SmartBlockEntity
lazyTickCounter, lazyTickRateFields inherited from class net.minecraft.world.level.block.entity.BlockEntity
level, remove, worldPositionFields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
ATTACHMENTS_NBT_KEY -
Constructor Summary
ConstructorsConstructorDescriptionKineticBlockEntity(net.minecraft.world.level.block.entity.BlockEntityType<?> typeIn, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBehaviours(List<BlockEntityBehaviour> behaviours) List<net.minecraft.core.BlockPos> addPropagationLocations(IRotate block, net.minecraft.world.level.block.state.BlockState state, List<net.minecraft.core.BlockPos> neighbours) Specify additional locations the rotation propagator should look for potentially connected components.protected voidaddStressImpactStats(List<net.minecraft.network.chat.Component> tooltip, float stressAtBase) booleanaddToGoggleTooltip(List<net.minecraft.network.chat.Component> tooltip, boolean isPlayerSneaking) This method will be called when looking at aBlockEntitythat implements this interfacebooleanaddToTooltip(List<net.minecraft.network.chat.Component> tooltip, boolean isPlayerSneaking) This method will be called when looking at aBlockEntitythat implements this interfacevoidfloatfloatprotected booleancanPropagateDiagonally(IRotate block, net.minecraft.world.level.block.state.BlockState state) voidstatic floatconvertToAngular(float speed) static floatconvertToDirection(float axisSpeed, net.minecraft.core.Direction d) static floatconvertToLinear(float speed) protected voidcopySequenceContextFrom(KineticBlockEntity sourceBE) voidintfloatintgetRotationAngleOffset(net.minecraft.core.Direction.Axis axis) floatgetSpeed()protected net.minecraft.world.level.block.BlockfloatbooleanbooleanvoidbooleanisCustomConnection(KineticBlockEntity other, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.block.state.BlockState otherState) Specify whether this component can propagate speed to the other in any circumstance.protected booleanisNoisy()booleanbooleanisSource()booleanprotected KineticsChangeEventbooleanvoidonSpeedChanged(float previousSpeed) floatpropagateRotationTo(KineticBlockEntity target, net.minecraft.world.level.block.state.BlockState stateFrom, net.minecraft.world.level.block.state.BlockState stateTo, net.minecraft.core.BlockPos diff, boolean connectedViaAxes, boolean connectedViaCogs) Specify ratio of transferred rotation from this kinetic component to a specific other.protected voidread(net.minecraft.nbt.CompoundTag compound, net.minecraft.core.HolderLookup.Provider registries, boolean clientPacket) Hook only these in future subclasses of STEvoidremove()Block destroyed or picked up by a contraption.voidvoidvoidsetNetwork(@Nullable Long networkIn) voidsetSource(net.minecraft.core.BlockPos source) voidsetSpeed(float speed) static voidswitchToBlockState(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) protected booleanvoidtick()voidvoidupdateFromNetwork(float maxStress, float currentStress, int networkSize) voidprotected voidwrite(net.minecraft.nbt.CompoundTag compound, net.minecraft.core.HolderLookup.Provider registries, boolean clientPacket) Hook only these in future subclasses of STEMethods inherited from class com.simibubi.create.foundation.blockEntity.SmartBlockEntity
addBehavioursDeferred, attachBehaviourLate, award, awardIfNear, canPlayerUse, destroy, forEachBehaviour, getAllBehaviours, getBehaviour, getRequiredItems, invalidate, isChunkUnloaded, isVirtual, lazyTick, loadAdditional, markVirtual, onChunkUnloaded, readClient, refreshBlockState, registerAwardables, removeBehaviour, saveAdditional, sendToMenu, setLazyTickRate, setRemoved, writeClient, writeSafeMethods inherited from class com.simibubi.create.foundation.blockEntity.CachedRenderBBBlockEntity
createRenderBoundingBox, getRenderBoundingBox, invalidateRenderBoundingBoxMethods inherited from class com.simibubi.create.foundation.blockEntity.SyncedBlockEntity
blockHolderGetter, getUpdatePacket, getUpdateTag, handleUpdateTag, notifyUpdate, onDataPacket, sendDataMethods inherited from class net.minecraft.world.level.block.entity.BlockEntity
addEntityType, applyComponents, applyComponentsFromItemStack, applyImplicitComponents, clearRemoved, collectComponents, collectImplicitComponents, components, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getPersistentData, getPosFromTag, getType, hasLevel, isRemoved, isValidBlockState, loadCustomOnly, loadStatic, loadWithComponents, onlyOpCanSetNbt, parseCustomNameSafe, removeComponentsFromTag, removeData, saveCustomAndMetadata, saveCustomOnly, saveToItem, saveWithFullMetadata, saveWithId, saveWithoutMetadata, setBlockState, setChanged, setChanged, setComponents, setData, setLevel, syncData, triggerEventMethods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, serializeAttachmentsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData, syncDataMethods inherited from interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension
getModelData, hasCustomOutlineRendering, invalidateCapabilities, onLoadMethods inherited from interface com.simibubi.create.api.equipment.goggles.IHaveCustomOverlayIcon
getIconMethods inherited from interface com.simibubi.create.api.equipment.goggles.IHaveGoggleInformation
containedFluidTooltip
-
Field Details
-
network
-
source
@Nullable public @Nullable net.minecraft.core.BlockPos source -
networkDirty
public boolean networkDirty -
updateSpeed
public boolean updateSpeed -
preventSpeedUpdate
public int preventSpeedUpdate -
effects
-
speed
protected float speed -
capacity
protected float capacity -
stress
protected float stress -
overStressed
protected boolean overStressed -
wasMoved
protected boolean wasMoved -
lastStressApplied
protected float lastStressApplied -
lastCapacityProvided
protected float lastCapacityProvided -
sequenceContext
-
-
Constructor Details
-
KineticBlockEntity
public KineticBlockEntity(net.minecraft.world.level.block.entity.BlockEntityType<?> typeIn, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
-
-
Method Details
-
initialize
public void initialize()- Overrides:
initializein classSmartBlockEntity
-
tick
public void tick()- Overrides:
tickin classSmartBlockEntity
-
updateFromNetwork
public void updateFromNetwork(float maxStress, float currentStress, int networkSize) -
makeComputerKineticsChangeEvent
-
getStressConfigKey
protected net.minecraft.world.level.block.Block getStressConfigKey() -
calculateStressApplied
public float calculateStressApplied() -
calculateAddedStressCapacity
public float calculateAddedStressCapacity() -
onSpeedChanged
public void onSpeedChanged(float previousSpeed) -
remove
public void remove()Description copied from class:SmartBlockEntityBlock destroyed or picked up by a contraption. Usually detaches kinetics- Overrides:
removein classSmartBlockEntity
-
write
protected void write(net.minecraft.nbt.CompoundTag compound, net.minecraft.core.HolderLookup.Provider registries, boolean clientPacket) Description copied from class:SmartBlockEntityHook only these in future subclasses of STE- Overrides:
writein classSmartBlockEntity
-
needsSpeedUpdate
public boolean needsSpeedUpdate() -
read
protected void read(net.minecraft.nbt.CompoundTag compound, net.minecraft.core.HolderLookup.Provider registries, boolean clientPacket) Description copied from class:SmartBlockEntityHook only these in future subclasses of STE- Overrides:
readin classSmartBlockEntity
-
getGeneratedSpeed
public float getGeneratedSpeed() -
isSource
public boolean isSource() -
getSpeed
public float getSpeed() -
getTheoreticalSpeed
public float getTheoreticalSpeed() -
setSpeed
public void setSpeed(float speed) -
hasSource
public boolean hasSource() -
setSource
public void setSource(net.minecraft.core.BlockPos source) -
copySequenceContextFrom
-
removeSource
public void removeSource() -
setNetwork
-
getOrCreateNetwork
-
hasNetwork
public boolean hasNetwork() -
attachKinetics
public void attachKinetics() -
detachKinetics
public void detachKinetics() -
isSpeedRequirementFulfilled
public boolean isSpeedRequirementFulfilled() -
switchToBlockState
public static void switchToBlockState(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) -
addBehaviours
- Specified by:
addBehavioursin classSmartBlockEntity
-
addToTooltip
public boolean addToTooltip(List<net.minecraft.network.chat.Component> tooltip, boolean isPlayerSneaking) Description copied from interface:IHaveHoveringInformationThis method will be called when looking at aBlockEntitythat implements this interface- Specified by:
addToTooltipin interfaceIHaveHoveringInformation- Returns:
trueif the tooltip creation was successful and should be displayed, orfalseif the overlay should not be displayed
-
addToGoggleTooltip
public boolean addToGoggleTooltip(List<net.minecraft.network.chat.Component> tooltip, boolean isPlayerSneaking) Description copied from interface:IHaveGoggleInformationThis method will be called when looking at aBlockEntitythat implements this interface- Specified by:
addToGoggleTooltipin interfaceIHaveGoggleInformation- Returns:
trueif the tooltip creation was successful and should be displayed, orfalseif the overlay should not be displayed
-
addStressImpactStats
protected void addStressImpactStats(List<net.minecraft.network.chat.Component> tooltip, float stressAtBase) -
clearKineticInformation
public void clearKineticInformation() -
warnOfMovement
public void warnOfMovement() -
getFlickerScore
public int getFlickerScore() -
convertToDirection
public static float convertToDirection(float axisSpeed, net.minecraft.core.Direction d) -
convertToLinear
public static float convertToLinear(float speed) -
convertToAngular
public static float convertToAngular(float speed) -
isOverStressed
public boolean isOverStressed() -
propagateRotationTo
public float propagateRotationTo(KineticBlockEntity target, net.minecraft.world.level.block.state.BlockState stateFrom, net.minecraft.world.level.block.state.BlockState stateTo, net.minecraft.core.BlockPos diff, boolean connectedViaAxes, boolean connectedViaCogs) Specify ratio of transferred rotation from this kinetic component to a specific other.- Parameters:
target- other Kinetic BE to transfer tostateFrom- this BE's blockstatestateTo- other BE's blockstatediff- difference in position (to.pos - from.pos)connectedViaAxes- whether these kinetic blocks are connected via mutual IRotate.hasShaftTowards()connectedViaCogs- whether these kinetic blocks are connected via mutual IRotate.hasIntegratedCogwheel()- Returns:
- factor of rotation speed from this BE to other. 0 if no rotation is transferred, or the standard rules apply (integrated shafts/cogs)
-
addPropagationLocations
public List<net.minecraft.core.BlockPos> addPropagationLocations(IRotate block, net.minecraft.world.level.block.state.BlockState state, List<net.minecraft.core.BlockPos> neighbours) Specify additional locations the rotation propagator should look for potentially connected components. Neighbour list contains offset positions in all 6 directions by default.- Parameters:
block-state-neighbours-- Returns:
-
isCustomConnection
public boolean isCustomConnection(KineticBlockEntity other, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.block.state.BlockState otherState) Specify whether this component can propagate speed to the other in any circumstance. Shaft and cogwheel connections are already handled by internal logic. Does not have to be specified on both ends, it is assumed that this relation is symmetrical.- Parameters:
other-state-otherState-- Returns:
- true if this and the other component should check their propagation factor and are not already connected via integrated cogs or shafts
-
canPropagateDiagonally
protected boolean canPropagateDiagonally(IRotate block, net.minecraft.world.level.block.state.BlockState state) -
requestModelDataUpdate
public void requestModelDataUpdate()- Specified by:
requestModelDataUpdatein interfacenet.neoforged.neoforge.common.extensions.IBlockEntityExtension
-
tickAudio
public void tickAudio() -
isNoisy
protected boolean isNoisy() -
getRotationAngleOffset
public int getRotationAngleOffset(net.minecraft.core.Direction.Axis axis) -
syncSequenceContext
protected boolean syncSequenceContext()
-