Class KineticBlockEntity

java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
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
  • Field Details

    • network

      @Nullable public Long network
    • source

      @Nullable public net.minecraft.core.BlockPos source
    • networkDirty

      public boolean networkDirty
    • updateSpeed

      public boolean updateSpeed
    • preventSpeedUpdate

      public int preventSpeedUpdate
    • effects

      protected KineticEffectHandler 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:
      initialize in class SmartBlockEntity
    • tick

      public void tick()
      Overrides:
      tick in class SmartBlockEntity
    • updateFromNetwork

      public void updateFromNetwork(float maxStress, float currentStress, int networkSize)
    • 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: SmartBlockEntity
      Block destroyed or picked up by a contraption. Usually detaches kinetics
      Overrides:
      remove in class SmartBlockEntity
    • write

      protected void write(net.minecraft.nbt.CompoundTag compound, net.minecraft.core.HolderLookup.Provider registries, boolean clientPacket)
      Description copied from class: SmartBlockEntity
      Hook only these in future subclasses of STE
      Overrides:
      write in class SmartBlockEntity
    • 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: SmartBlockEntity
      Hook only these in future subclasses of STE
      Overrides:
      read in class SmartBlockEntity
    • 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

      protected void copySequenceContextFrom(KineticBlockEntity sourceBE)
    • removeSource

      public void removeSource()
    • setNetwork

      public void setNetwork(@Nullable Long networkIn)
    • getOrCreateNetwork

      public KineticNetwork 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

      public void addBehaviours(List<BlockEntityBehaviour> behaviours)
      Specified by:
      addBehaviours in class SmartBlockEntity
    • addToTooltip

      public boolean addToTooltip(List<net.minecraft.network.chat.Component> tooltip, boolean isPlayerSneaking)
      Description copied from interface: IHaveHoveringInformation
      This method will be called when looking at a BlockEntity that implements this interface
      Specified by:
      addToTooltip in interface IHaveHoveringInformation
      Returns:
      true if the tooltip creation was successful and should be displayed, or false if the overlay should not be displayed
    • addToGoggleTooltip

      public boolean addToGoggleTooltip(List<net.minecraft.network.chat.Component> tooltip, boolean isPlayerSneaking)
      Description copied from interface: IHaveGoggleInformation
      This method will be called when looking at a BlockEntity that implements this interface
      Specified by:
      addToGoggleTooltip in interface IHaveGoggleInformation
      Returns:
      true if the tooltip creation was successful and should be displayed, or false if 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 to
      stateFrom - this BE's blockstate
      stateTo - other BE's blockstate
      diff - 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:
      requestModelDataUpdate in interface net.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()