Class ChestOpennessStorage
java.lang.Object
com.hammy275.immersivemc.common.immersive.storage.network.impl.ChestOpennessStorage
- All Implemented Interfaces:
NetworkStorage, 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.
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enum -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionChestOpennessStorage(net.minecraft.world.level.block.entity.BlockEntity blockEntity) -
Method Summary
Modifier and TypeMethodDescriptionvoiddecode(net.minecraft.network.RegistryFriendlyByteBuf buffer) Decode the buffer into this object.voidencode(net.minecraft.network.RegistryFriendlyByteBuf buffer) Encode this storage into a buffer.@Nullable net.minecraft.server.level.ServerPlayergetControllingPlayer(net.minecraft.world.level.Level level) @Nullable UUIDnet.minecraft.world.level.LevelgetLevel()floatnet.minecraft.core.BlockPosgetPos()voidvoidhandleServer(net.minecraft.server.level.ServerPlayer player) booleanbooleanisDirty()voidvoidsetDirty()voidvoidsetOpenness(float openness) voidstartAnimating(net.minecraft.server.level.ServerPlayer controllingPlayer, ChestOpennessStorage.LidTarget newTarget) booleantakeControl(UUID newController, ChestOpennessStorage.AnimationState newAnimationState)
-
Field Details
-
CHEST_OPEN_THRESHOLD
public static final float CHEST_OPEN_THRESHOLD- See Also:
-
-
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:NetworkStorageEncode this storage into a buffer.- Specified by:
encodein interfaceNetworkStorage- Parameters:
buffer- Buffer to encode storage into.
-
decode
public void decode(net.minecraft.network.RegistryFriendlyByteBuf buffer) Description copied from interface:NetworkStorageDecode the buffer into this object.- Specified by:
decodein interfaceNetworkStorage- 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
-
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:
handleClientin interfaceSelfHandlingNetworkStorage
-
handleServer
public void handleServer(net.minecraft.server.level.ServerPlayer player) - Specified by:
handleServerin interfaceSelfHandlingNetworkStorage
-