Class FarmlandWaterManager

java.lang.Object
net.neoforged.neoforge.common.FarmlandWaterManager

public class FarmlandWaterManager extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final Map<net.minecraft.world.level.LevelReader,Map<net.minecraft.world.level.ChunkPos,ChunkTicketManager<net.minecraft.world.phys.Vec3>>>
     
    private static final boolean
     
    private static final org.apache.logging.log4j.Logger
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static AABBTicket
    addAABBTicket(net.minecraft.world.level.Level level, net.minecraft.world.phys.AABB aabb)
    Convenience method to add a ticket that is backed by an AABB.
    static <T extends SimpleTicket<net.minecraft.world.phys.Vec3>>
    T
    addCustomTicket(net.minecraft.world.level.Level level, T ticket, net.minecraft.world.level.ChunkPos masterChunk, net.minecraft.world.level.ChunkPos... additionalChunks)
    Adds a custom ticket.
    private static double
    getDistanceSq(net.minecraft.world.level.ChunkPos pos, net.minecraft.world.phys.Vec3 vec3d)
     
    private static ChunkTicketManager<net.minecraft.world.phys.Vec3>
    getTicketManager(net.minecraft.world.level.ChunkPos pos, net.minecraft.world.level.LevelReader level)
     
    static boolean
    hasBlockWaterTicket(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos pos)
    Tests if a block is in a region that is watered by blocks.
    (package private) static void
    removeTickets(net.minecraft.world.level.chunk.ChunkAccess chunk)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEBUG

      private static final boolean DEBUG
    • customWaterHandler

      private static final Map<net.minecraft.world.level.LevelReader,Map<net.minecraft.world.level.ChunkPos,ChunkTicketManager<net.minecraft.world.phys.Vec3>>> customWaterHandler
    • LOGGER

      private static final org.apache.logging.log4j.Logger LOGGER
  • Constructor Details

    • FarmlandWaterManager

      public FarmlandWaterManager()
  • Method Details

    • addCustomTicket

      public static <T extends SimpleTicket<net.minecraft.world.phys.Vec3>> T addCustomTicket(net.minecraft.world.level.Level level, T ticket, net.minecraft.world.level.ChunkPos masterChunk, net.minecraft.world.level.ChunkPos... additionalChunks)
      Adds a custom ticket. Use addAABBTicket(Level, AABB) if you just need a ticket that can water a certain area.
      If you don't want to water the region anymore, call SimpleTicket.invalidate(). Also call this when the region this is unloaded (e.g. your TE is unloaded or the block is removed), and validate once it is loaded
      Parameters:
      level - The level where the region should be marked. Only server-side worlds are allowed
      ticket - Your ticket you want to have registered
      masterChunk - The chunk pos that is controls when the ticket may be unloaded. The ticket should originate from here.
      additionalChunks - The chunks in that this ticket wants to operate as well.
      Returns:
      The ticket for your requested region.
    • addAABBTicket

      public static AABBTicket addAABBTicket(net.minecraft.world.level.Level level, net.minecraft.world.phys.AABB aabb)
      Convenience method to add a ticket that is backed by an AABB.
      If you don't want to water the region anymore, call SimpleTicket.invalidate(). Also call this when the region this is unloaded (e.g. your TE is unloaded or the block is removed), and validate once it is loaded
      The AABB in the ticket is immutable
      Parameters:
      level - The level where the region should be marked. Only server-side worlds are allowed
      aabb - The region where blocks should be watered
      Returns:
      The ticket for your requested region.
    • getDistanceSq

      private static double getDistanceSq(net.minecraft.world.level.ChunkPos pos, net.minecraft.world.phys.Vec3 vec3d)
    • hasBlockWaterTicket

      public static boolean hasBlockWaterTicket(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos pos)
      Tests if a block is in a region that is watered by blocks. This does not check vanilla water, see net.minecraft.level.level.block.FarmBlock#isNearWater(LevelReader, BlockPos)
      Returns:
      true if there is a ticket with an AABB that includes your block
    • removeTickets

      static void removeTickets(net.minecraft.world.level.chunk.ChunkAccess chunk)
    • getTicketManager

      private static ChunkTicketManager<net.minecraft.world.phys.Vec3> getTicketManager(net.minecraft.world.level.ChunkPos pos, net.minecraft.world.level.LevelReader level)