Class WorldSharedTankCache

java.lang.Object
org.cyclops.evilcraft.core.fluid.WorldSharedTankCache

public class WorldSharedTankCache extends Object
The cache for the shared tank contents.
  • Field Details

    • INTERPOLATION_TICK_OFFSET

      public static final int INTERPOLATION_TICK_OFFSET
      The amount of ticks inbetween a packet update.
      See Also:
  • Method Details

    • reset

      public void reset()
      Reset the cache, packet buffer and tick offset.
    • getInstance

      public static WorldSharedTankCache getInstance()
      Get the unique instance.
      Returns:
      The unique instance.
    • getMapID

      protected String getMapID(String tankID)
    • removeMapID

      protected String removeMapID(String mapID)
    • getTankContent

      public net.minecraftforge.fluids.FluidStack getTankContent(String tankID)
      Get a tank contents.
      Parameters:
      tankID - The tank.
      Returns:
      The contents.
    • shouldRefreshFluid

      protected static boolean shouldRefreshFluid(@Nullable net.minecraftforge.fluids.FluidStack old, net.minecraftforge.fluids.FluidStack newF)
    • setTankContent

      public void setTankContent(String tankID, net.minecraftforge.fluids.FluidStack fluidStack)
      Set the tank contents.
      Parameters:
      tankID - The id of the tank.
      fluidStack - The tank contents.
    • bufferPacket

      protected void bufferPacket(String tankID, UpdateWorldSharedTankClientCachePacket packet)
    • getTickOffset

      public int getTickOffset()
      Get the ticks since last packet flush.
      Returns:
      The tick offset.
    • onTick

      public void onTick(net.minecraftforge.event.TickEvent event)
      When a tick event is received.
      Parameters:
      event - The received event.
    • onLoggedIn

      public void onLoggedIn(net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedInEvent event)
    • readFromNBT

      public void readFromNBT(net.minecraft.nbt.CompoundTag tag)
      Read the cache.
      Parameters:
      tag - The tag to read from.
    • writeToNBT

      public void writeToNBT(net.minecraft.nbt.CompoundTag tag)
      Write the cache.
      Parameters:
      tag - The tag to write to.