Package org.cyclops.evilcraft.core.fluid
Class WorldSharedTankCache
java.lang.Object
org.cyclops.evilcraft.core.fluid.WorldSharedTankCache
The cache for the shared tank contents.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe amount of ticks inbetween a packet update. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbufferPacket(String tankID, UpdateWorldSharedTankClientCachePacket packet) static WorldSharedTankCacheGet the unique instance.protected Stringnet.minecraftforge.fluids.FluidStackgetTankContent(String tankID) Get a tank contents.intGet the ticks since last packet flush.voidonLoggedIn(net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedInEvent event) voidonTick(net.minecraftforge.event.TickEvent event) When a tick event is received.voidreadFromNBT(net.minecraft.nbt.CompoundTag tag) Read the cache.protected StringremoveMapID(String mapID) voidreset()Reset the cache, packet buffer and tick offset.voidsetTankContent(String tankID, net.minecraftforge.fluids.FluidStack fluidStack) Set the tank contents.protected static booleanshouldRefreshFluid(net.minecraftforge.fluids.FluidStack old, net.minecraftforge.fluids.FluidStack newF) voidwriteToNBT(net.minecraft.nbt.CompoundTag tag) Write the cache.
-
Field Details
-
INTERPOLATION_TICK_OFFSET
public static final int INTERPOLATION_TICK_OFFSETThe amount of ticks inbetween a packet update.- See Also:
-
-
Method Details
-
reset
public void reset()Reset the cache, packet buffer and tick offset. -
getInstance
Get the unique instance.- Returns:
- The unique instance.
-
getMapID
-
removeMapID
-
getTankContent
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
Set the tank contents.- Parameters:
tankID- The id of the tank.fluidStack- The tank contents.
-
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.
-