Class ShulkerBoxHandler
java.lang.Object
com.hammy275.immersivemc.common.immersive.handler.ContainerHandler<ListOfItemsStorage>
com.hammy275.immersivemc.common.immersive.handler.ChestLikeHandler<ListOfItemsStorage>
com.hammy275.immersivemc.common.immersive.handler.ShulkerBoxHandler
- All Implemented Interfaces:
ImmersiveHandler<ListOfItemsStorage>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanPlaceItem(net.minecraft.world.item.ItemStack item) booleanenabledInConfig(net.minecraft.world.entity.player.Player player) net.minecraft.resources.IdentifiergetID()booleanisValidBlock(net.minecraft.core.BlockPos pos, net.minecraft.world.level.Level level) makeInventoryContents(net.minecraft.server.level.ServerPlayer player, net.minecraft.core.BlockPos pos) Creates inventory contents on the server to send to clients.voidonStopTracking(net.minecraft.server.level.ServerPlayer player, net.minecraft.core.BlockPos pos) Function called whenever this immersive is no longer being tracked.Methods inherited from class ChestLikeHandler
getBaseEmptyNetworkStorage, isDirtyForClientSync, makeBaseInventoryContents, swapMethods inherited from class ContainerHandler
clientAuthoritative
-
Constructor Details
-
ShulkerBoxHandler
public ShulkerBoxHandler()
-
-
Method Details
-
canPlaceItem
public boolean canPlaceItem(net.minecraft.world.item.ItemStack item) - Overrides:
canPlaceItemin classChestLikeHandler<ListOfItemsStorage>
-
isValidBlock
public boolean isValidBlock(net.minecraft.core.BlockPos pos, net.minecraft.world.level.Level level) - Specified by:
isValidBlockin interfaceImmersiveHandler<ListOfItemsStorage>- Overrides:
isValidBlockin classChestLikeHandler<ListOfItemsStorage>- Parameters:
pos- Position to check.level- The level being checked in.- Returns:
- Whether the supplied block matches what this handler handles.
-
makeInventoryContents
public ListOfItemsStorage makeInventoryContents(net.minecraft.server.level.ServerPlayer player, net.minecraft.core.BlockPos pos) Description copied from interface:ImmersiveHandlerCreates inventory contents on the server to send to clients.- Specified by:
makeInventoryContentsin interfaceImmersiveHandler<ListOfItemsStorage>- Specified by:
makeInventoryContentsin classChestLikeHandler<ListOfItemsStorage>- Parameters:
player- Player being sent to.pos- Position of the block being sent about.- Returns:
- A NetworkStorage to be sent over the network.
-
getEmptyNetworkStorage
- Specified by:
getEmptyNetworkStoragein interfaceImmersiveHandler<ListOfItemsStorage>- Specified by:
getEmptyNetworkStoragein classChestLikeHandler<ListOfItemsStorage>- Returns:
- A new instance of the same type of NetworkStorage as made with makeInventoryContents(), but in an empty state for purposes such as being decoded into by the client.
-
enabledInConfig
public boolean enabledInConfig(net.minecraft.world.entity.player.Player player) - Parameters:
player- The player we're checking the config of.- Returns:
- Whether the immersive this handler handles is enabled. If you do not have a configuration system, this should always return true.
-
onStopTracking
public void onStopTracking(net.minecraft.server.level.ServerPlayer player, net.minecraft.core.BlockPos pos) Description copied from interface:ImmersiveHandlerFunction called whenever this immersive is no longer being tracked. Only ever called server-side.- Specified by:
onStopTrackingin interfaceImmersiveHandler<ListOfItemsStorage>- Overrides:
onStopTrackingin classChestLikeHandler<ListOfItemsStorage>- Parameters:
player- Player who is no longer tracking this immersive.pos- Position of the block no longer being tracked.
-
getID
public net.minecraft.resources.Identifier getID()- Returns:
- A unique ID to identify this handler. The same value should always be returned by this method.
-