Interface IExtentCache

All Known Subinterfaces:
IFarmController, IFarmHousing

public interface IExtentCache
Cache that can be used to cache the last extends of IFarmLogics. Some IFarmLogics that potentially could make many operation for a single position like the arboreal logic can use this to cache the last position they worked on.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    cleanExtents(net.minecraft.core.Direction direction)
    Clears the cache for the given direction.
    int
    getExtents(net.minecraft.core.Direction direction, net.minecraft.core.BlockPos pos)
    Gets the current extent for the given direction and position.
    default int
    getValidExtent(net.minecraft.core.Direction direction, net.minecraft.core.BlockPos pos, int maxExtend)
    Gets the current extend but returns 0 if the extend is bigger given maximal extent
    default net.minecraft.core.BlockPos
    getValidPosition(net.minecraft.core.Direction direction, net.minecraft.core.BlockPos pos, int maxExtend, net.minecraft.core.BlockPos baseLocation)
    Offsets the given base location in the given direction by the valid extent of the logic position.
    default int
    increaseExtent(net.minecraft.core.Direction direction, net.minecraft.core.BlockPos pos, int maxExtend)
    Increases the valid position by one.
    void
    setExtents(net.minecraft.core.Direction direction, net.minecraft.core.BlockPos pos, int extend)
    Sets the current extent for the given direction and position.
  • Method Details

    • getExtents

      int getExtents(net.minecraft.core.Direction direction, net.minecraft.core.BlockPos pos)
      Gets the current extent for the given direction and position.
      Parameters:
      direction - The direction of the farm logic.
      pos - The position the logic starts to operate on
      Returns:
      The current extent for the given direction and position.
    • setExtents

      void setExtents(net.minecraft.core.Direction direction, net.minecraft.core.BlockPos pos, int extend)
      Sets the current extent for the given direction and position.
      Parameters:
      direction - The direction of the farm logic.
      pos - The position the logic starts to operate on
      extend - The extent
    • cleanExtents

      void cleanExtents(net.minecraft.core.Direction direction)
      Clears the cache for the given direction.

      For example used if the player remove the circuit from the farm.

      Parameters:
      direction - The direction that should be cleared
    • getValidExtent

      default int getValidExtent(net.minecraft.core.Direction direction, net.minecraft.core.BlockPos pos, int maxExtend)
      Gets the current extend but returns 0 if the extend is bigger given maximal extent
      Parameters:
      direction - The direction of the farm logic.
      pos - The position the logic starts to operate on
      maxExtend - The maximal extent this method can return. If the current extend is bigger than this value 0 will be returned.
      Returns:
      The current extend but returns 0 if the extend is bigger given maximal extent.
    • getValidPosition

      default net.minecraft.core.BlockPos getValidPosition(net.minecraft.core.Direction direction, net.minecraft.core.BlockPos pos, int maxExtend, net.minecraft.core.BlockPos baseLocation)
      Offsets the given base location in the given direction by the valid extent of the logic position.
      Parameters:
      direction - The direction of the farm logic.
      pos - The position the logic starts to operate on
      maxExtend - The maximal extent as defined in "getValidExtent"
      baseLocation - The location that will be offset by the extent
      Returns:
      The base location offset in the given direction by the valid extent of the logic position.
    • increaseExtent

      default int increaseExtent(net.minecraft.core.Direction direction, net.minecraft.core.BlockPos pos, int maxExtend)
      Increases the valid position by one.
      Parameters:
      direction - The direction of the farm logic.
      pos - The position the logic starts to operate on
      maxExtend - The maximal extent as defined in "getValidExtent"
      Returns:
      The valid position increased by one.