Package net.minecraftforge.common
Class FarmlandWaterManager
- java.lang.Object
-
- net.minecraftforge.common.FarmlandWaterManager
-
public class FarmlandWaterManager extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Map<IWorldReader,java.util.Map<ChunkPos,ChunkTicketManager<Vector3d>>>
customWaterHandler
private static boolean
DEBUG
private static org.apache.logging.log4j.Logger
LOGGER
-
Constructor Summary
Constructors Constructor Description FarmlandWaterManager()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static AABBTicket
addAABBTicket(World world, AxisAlignedBB aabb)
Convenience method to add a ticket that is backed by an AABB.static <T extends SimpleTicket<Vector3d>>
TaddCustomTicket(World world, T ticket, ChunkPos masterChunk, ChunkPos... additionalChunks)
Adds a custom ticket.private static double
getDistanceSq(ChunkPos pos, Vector3d vec3d)
private static ChunkTicketManager<Vector3d>
getTicketManager(ChunkPos pos, IWorldReader world)
static boolean
hasBlockWaterTicket(IWorldReader world, BlockPos pos)
Tests if a block is in a region that is watered by blocks.(package private) static void
removeTickets(IChunk chunk)
-
-
-
Field Detail
-
DEBUG
private static final boolean DEBUG
-
customWaterHandler
private static final java.util.Map<IWorldReader,java.util.Map<ChunkPos,ChunkTicketManager<Vector3d>>> customWaterHandler
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER
-
-
Method Detail
-
addCustomTicket
public static <T extends SimpleTicket<Vector3d>> T addCustomTicket(World world, T ticket, ChunkPos masterChunk, ChunkPos... additionalChunks)
Adds a custom ticket. UseaddAABBTicket(World, AxisAlignedBB)
if you just need a ticket that can water a certain area.
If you don't want to water the region anymore, callSimpleTicket.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:
world
- The world where the region should be marked. Only server-side worlds are allowedticket
- Your ticket you want to have registeredmasterChunk
- 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(World world, AxisAlignedBB aabb)
Convenience method to add a ticket that is backed by an AABB.
If you don't want to water the region anymore, callSimpleTicket.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:
world
- The world where the region should be marked. Only server-side worlds are allowedaabb
- The region where blocks should be watered- Returns:
- The ticket for your requested region.
-
hasBlockWaterTicket
public static boolean hasBlockWaterTicket(IWorldReader world, BlockPos pos)
Tests if a block is in a region that is watered by blocks. This does not check vanilla water, seenet.minecraft.block.FarmlandBlock#hasWater(IWorldReader, BlockPos)
- Returns:
- true if there is a ticket with an AABB that includes your block
-
removeTickets
static void removeTickets(IChunk chunk)
-
getTicketManager
private static ChunkTicketManager<Vector3d> getTicketManager(ChunkPos pos, IWorldReader world)
-
-