Skip to content

FarmingUtil

Package: com.hypixel.hytale.builtin.adventure.farming

public class FarmingUtil

Utility class containing the core farming tick logic and harvest methods. Called by FarmingSystems.Ticking and FarmingSystems.OnFarmBlockAdded to advance crop growth, and by HarvestCropInteraction to process harvests.

ModifierTypeNameValue
private static finalintMAX_SECONDS_BETWEEN_TICKS15
private static finalintBETWEEN_RANDOM10
ModifierReturn TypeSignature
public staticvoidtickFarming(@Nonnull CommandBuffer<ChunkStore> commandBuffer, @Nonnull BlockChunk blockChunk, @Nonnull BlockSection blockSection, @Nonnull Ref<ChunkStore> sectionRef, @Nonnull Ref<ChunkStore> blockRef, @Nonnull FarmingBlock farmingBlock, int x, int y, int z, boolean initialTick)
public staticbooleanharvest(@Nonnull World world, @Nonnull ComponentAccessor<EntityStore> componentAccessor, @Nonnull Ref<EntityStore> ref, @Nonnull BlockType blockType, int rotationIndex, @Nonnull Vector3i blockPosition)
@Nullable public staticCapturedNPCMetadatagenerateCapturedNPCMetadata(@Nonnull ComponentAccessor<EntityStore> componentAccessor, @Nonnull Ref<EntityStore> entityRef, String npcNameKey)
protected staticbooleanharvest0(@Nonnull ComponentAccessor<EntityStore> store, @Nonnull Ref<EntityStore> ref, @Nonnull BlockType blockType, int rotationIndex, @Nonnull Vector3i blockPosition)
protected staticvoidgiveDrops(@Nonnull ComponentAccessor<EntityStore> store, @Nonnull Ref<EntityStore> ref, @Nonnull Vector3d origin, @Nonnull BlockType blockType)

tickFarming advances a farming block through its configured stage pipeline. For each stage, it computes the duration (randomized from the stage’s Rangef), applies all growth modifiers (fertilizer, light, water) as multipliers, and either advances to the next stage or schedules a future tick. When a stage completes, stages[nextStage].apply(...) is called to apply the visual/structural change (block type swap, prefab placement, spread, etc.). The tick caps at MAX_SECONDS_BETWEEN_TICKS + BETWEEN_RANDOM seconds of real-time game ticks to prevent unbounded catch-up.

harvest delegates to harvest0, which drops items via BlockHarvestUtils.getDrops and either transitions to the stageSetAfterHarvest stage set or breaks the block entirely.

Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.