Class ChestOpennessStorage

java.lang.Object
com.hammy275.immersivemc.common.immersive.storage.network.impl.ChestOpennessStorage
All Implemented Interfaces:
NetworkStorage, SelfHandlingNetworkStorage

public class ChestOpennessStorage extends Object implements SelfHandlingNetworkStorage
Storage for syncing chest contents. Only the openness and isDirty are kept on the server continuously, and the isDirty only denotes if the lid handling is dirty, not the chest as a whole.
During syncing, there are generally two instances, one is the instance stored in the server, and the other is the instance created with the items to be sent to clients.
  • Field Details

  • Constructor Details

    • ChestOpennessStorage

      public ChestOpennessStorage()
    • ChestOpennessStorage

      public ChestOpennessStorage(net.minecraft.world.level.block.entity.BlockEntity blockEntity)
  • Method Details

    • encode

      public void encode(net.minecraft.network.RegistryFriendlyByteBuf buffer)
      Description copied from interface: NetworkStorage
      Encode this storage into a buffer.
      Specified by:
      encode in interface NetworkStorage
      Parameters:
      buffer - Buffer to encode storage into.
    • decode

      public void decode(net.minecraft.network.RegistryFriendlyByteBuf buffer)
      Description copied from interface: NetworkStorage
      Decode the buffer into this object.
      Specified by:
      decode in interface NetworkStorage
      Parameters:
      buffer - Buffer to decode from.
    • getOpenness

      public float getOpenness()
    • setOpenness

      public void setOpenness(float openness)
    • getPos

      public net.minecraft.core.BlockPos getPos()
    • getControllingPlayer

      @Nullable public @Nullable net.minecraft.server.level.ServerPlayer getControllingPlayer(net.minecraft.world.level.Level level)
    • getControllingPlayerUUID

      @Nullable public @Nullable UUID getControllingPlayerUUID()
    • getLevel

      public net.minecraft.world.level.Level getLevel()
    • isDirty

      public boolean isDirty()
    • setDirty

      public void setDirty()
    • setNoLongerDirty

      public void setNoLongerDirty()
    • serverTick

      public void serverTick()
    • takeControl

      public boolean takeControl(UUID newController, ChestOpennessStorage.AnimationState newAnimationState)
    • startAnimating

      public void startAnimating(net.minecraft.server.level.ServerPlayer controllingPlayer, ChestOpennessStorage.LidTarget newTarget)
    • isAnimating

      public boolean isAnimating()
    • handleClient

      public void handleClient()
      Specified by:
      handleClient in interface SelfHandlingNetworkStorage
    • handleServer

      public void handleServer(net.minecraft.server.level.ServerPlayer player)
      Specified by:
      handleServer in interface SelfHandlingNetworkStorage