Class KineticTileEntity

java.lang.Object
net.minecraftforge.common.capabilities.CapabilityProvider<net.minecraft.world.level.block.entity.BlockEntity>
net.minecraft.world.level.block.entity.BlockEntity
All Implemented Interfaces:
com.jozufozu.flywheel.backend.instancing.IInstanceRendered, IHaveGoggleInformation, IHaveHoveringInformation, IInteractionChecker, IPartialSafeNBT, 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>
Direct Known Subclasses:
AdjustablePulleyTileEntity, ArmTileEntity, BasinOperatingTileEntity, BeltTileEntity, BlockBreakingKineticTileEntity, ClockworkBearingTileEntity, CopperBacktankTileEntity, CrushingWheelTileEntity, CuckooClockTileEntity, DeployerTileEntity, DirectionalShaftHalvesTileEntity, EjectorTileEntity, FluidValveTileEntity, GantryCarriageTileEntity, GantryShaftTileEntity, GaugeTileEntity, GeneratingKineticTileEntity, HosePulleyTileEntity, LinearActuatorTileEntity, MechanicalCrafterTileEntity, MillstoneTileEntity, PumpTileEntity, SimpleKineticTileEntity, SpeedControllerTileEntity, TurntableTileEntity

public class KineticTileEntity extends SmartTileEntity implements IHaveGoggleInformation, IHaveHoveringInformation, com.jozufozu.flywheel.backend.instancing.IInstanceRendered
  • 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
    • cachedBoundingBox

      protected net.minecraft.world.phys.AABB cachedBoundingBox
  • Constructor Details

    • KineticTileEntity

      public KineticTileEntity(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 SmartTileEntity
    • tick

      public void tick()
      Overrides:
      tick in class SmartTileEntity
    • 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)
    • setRemoved

      public void setRemoved()
      Overrides:
      setRemoved in class SmartTileEntity
    • write

      protected void write(net.minecraft.nbt.CompoundTag compound, boolean clientPacket)
      Description copied from class: SmartTileEntity
      Hook only these in future subclasses of STE
      Overrides:
      write in class SmartTileEntity
    • needsSpeedUpdate

      public boolean needsSpeedUpdate()
    • fromTag

      protected void fromTag(net.minecraft.nbt.CompoundTag compound, boolean clientPacket)
      Description copied from class: SmartTileEntity
      Hook only these in future subclasses of STE
      Overrides:
      fromTag in class SmartTileEntity
    • 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)
    • 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<TileEntityBehaviour> behaviours)
      Specified by:
      addBehaviours in class SmartTileEntity
    • addToTooltip

      public boolean addToTooltip(List<net.minecraft.network.chat.Component> tooltip, boolean isPlayerSneaking)
      Specified by:
      addToTooltip in interface IHaveHoveringInformation
    • 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 TileEntity that implemented 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
    • 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(KineticTileEntity 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 TE to transfer to
      stateFrom - this TE's blockstate
      stateTo - other TE'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 TE 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(KineticTileEntity 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.minecraftforge.common.extensions.IForgeBlockEntity
    • getRenderBoundingBox

      public net.minecraft.world.phys.AABB getRenderBoundingBox()
      Specified by:
      getRenderBoundingBox in interface net.minecraftforge.common.extensions.IForgeBlockEntity
    • makeRenderBoundingBox

      protected net.minecraft.world.phys.AABB makeRenderBoundingBox()
    • tickAudio

      public void tickAudio()
    • isNoisy

      protected boolean isNoisy()