Class VisualWorkbenchHandler
java.lang.Object
com.hammy275.immersivemc.common.immersive.handler.ContainerHandler<ListOfItemsStorage>
com.hammy275.immersivemc.common.immersive.handler.TCCraftingStationHandler
com.hammy275.immersivemc.common.immersive.handler.VisualWorkbenchHandler
- All Implemented Interfaces:
ImmersiveHandler<ListOfItemsStorage>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
enabledInConfig
(net.minecraft.world.entity.player.Player player) net.minecraft.resources.ResourceLocation
getID()
boolean
isDirtyForClientSync
(net.minecraft.server.level.ServerPlayer player, net.minecraft.core.BlockPos pos) Function to determine whether the block has changed its contents to sync to the client since its last sync.boolean
isValidBlock
(net.minecraft.core.BlockPos pos, net.minecraft.world.level.Level level) void
swap
(int slot, net.minecraft.world.InteractionHand hand, net.minecraft.core.BlockPos pos, net.minecraft.server.level.ServerPlayer player, ItemSwapAmount amount) Swaps an item from a player's hand into this immersive (and/or vice-versa).Methods inherited from class com.hammy275.immersivemc.common.immersive.handler.TCCraftingStationHandler
getEmptyNetworkStorage, makeInventoryContents
Methods inherited from class com.hammy275.immersivemc.common.immersive.handler.ContainerHandler
clientAuthoritative
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.hammy275.immersivemc.api.common.immersive.ImmersiveHandler
onStopTracking
-
Constructor Details
-
VisualWorkbenchHandler
public VisualWorkbenchHandler()
-
-
Method Details
-
isDirtyForClientSync
public boolean isDirtyForClientSync(net.minecraft.server.level.ServerPlayer player, net.minecraft.core.BlockPos pos) Description copied from interface:ImmersiveHandler
Function to determine whether the block has changed its contents to sync to the client since its last sync. Dirtiness is addressed every tick, so for every tick, you should clear ALL flags used for dirtiness.- Specified by:
isDirtyForClientSync
in interfaceImmersiveHandler<ListOfItemsStorage>
- Overrides:
isDirtyForClientSync
in classTCCraftingStationHandler
- Parameters:
player
- Player to potentially send new data to.pos
- Position of block to check.- Returns:
- Whether the given block has changed since it was last synced to the client
-
swap
public void swap(int slot, net.minecraft.world.InteractionHand hand, net.minecraft.core.BlockPos pos, net.minecraft.server.level.ServerPlayer player, ItemSwapAmount amount) Description copied from interface:ImmersiveHandler
Swaps an item from a player's hand into this immersive (and/or vice-versa).- Specified by:
swap
in interfaceImmersiveHandler<ListOfItemsStorage>
- Overrides:
swap
in classTCCraftingStationHandler
- Parameters:
slot
- Slot being swapped with in this immersive.hand
- Player's hand being swapped with.pos
- Position of block being swapped with.player
- Player who is swapping.amount
- An object representing the amount of items to swap. UseItemSwapAmount.getNumItemsToSwap()
, passing in the item stack size of the item in the player's hand to get the amount of items to swap.
-
isValidBlock
public boolean isValidBlock(net.minecraft.core.BlockPos pos, net.minecraft.world.level.Level level) - Specified by:
isValidBlock
in interfaceImmersiveHandler<ListOfItemsStorage>
- Overrides:
isValidBlock
in classTCCraftingStationHandler
- Parameters:
pos
- Position to check.level
- The level being checked in.- Returns:
- Whether the supplied block matches what this handler handles.
-
enabledInConfig
public boolean enabledInConfig(net.minecraft.world.entity.player.Player player) - Specified by:
enabledInConfig
in interfaceImmersiveHandler<ListOfItemsStorage>
- Overrides:
enabledInConfig
in classTCCraftingStationHandler
- 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.
-
getID
public net.minecraft.resources.ResourceLocation getID()- Specified by:
getID
in interfaceImmersiveHandler<ListOfItemsStorage>
- Overrides:
getID
in classTCCraftingStationHandler
- Returns:
- A unique ID to identify this handler. The same value should always be returned by this method.
-