Package wtf.choco.veinminer.network
Class FabricServerState
java.lang.Object
wtf.choco.veinminer.network.FabricServerState
- All Implemented Interfaces:
MessageReceiver,PluginMessageListener,ClientboundPluginMessageListener
public final class FabricServerState
extends Object
implements ClientboundPluginMessageListener, MessageReceiver
The client's state on a connected server.
-
Constructor Summary
ConstructorsConstructorDescriptionFabricServerState(@NotNull net.minecraft.client.Minecraft client) Construct a newFabricServerState. -
Method Summary
Modifier and TypeMethodDescriptionbooleanchangePattern(boolean next) Change to an adjacent pattern.@NotNull ClientConfigGet theClientConfigfor the mod.@Nullable net.minecraft.core.DirectionGet the block faceDirectionlast looked at by the client, or null if the client has not looked at a block.@Nullable net.minecraft.core.BlockPosGet theBlockPoslast looked at by the client, or null if the client has not looked at a block.@NotNull NamespacedKeyGet theNamespacedKeyof the next pattern to be selected.@NotNull List<NamespacedKey>Get aListof all pattern keys known to the client.@NotNull NamespacedKeyGet theNamespacedKeyof the previous pattern to be selected.@NotNull NamespacedKeyGet theNamespacedKeyof the currently selected pattern.intGet the index of the currently selected pattern.@Nullable net.minecraft.world.phys.shapes.VoxelShapeGet theVoxelShapeoutlining the last vein mine result received from the server.voidhandleHandshakeResponse(@NotNull PluginMessageClientboundHandshakeResponse message) Handles thePluginMessageClientboundHandshakeResponsemessage.voidhandleSetConfig(@NotNull PluginMessageClientboundSetConfig message) Handles thePluginMessageClientboundSetConfigmessage.voidhandleSetPattern(@NotNull PluginMessageClientboundSetPattern message) Handles thePluginMessageClientboundSetPatternmessage.voidhandleSyncRegisteredPatterns(@NotNull PluginMessageClientboundSyncRegisteredPatterns message) Handles thePluginMessageClientboundSyncRegisteredPatternsmessage.voidhandleVeinMineResults(@NotNull PluginMessageClientboundVeinMineResults message) Handles thePluginMessageClientboundVeinMineResultsmessage.booleanCheck whether or not any pattern keys are currently available.booleanisActive()Check whether or not vein mine is active.booleanCheck whether or not VeinMiner is enabled on the server.voidReset the last vein mine result shape.voidsendMessage(@NotNull NamespacedKey channel, byte[] message) Send a message represented by the given bytes on the specified channel.voidsetActive(boolean active) Set whether or not vein miner is active.voidsetLastLookedAt(@Nullable net.minecraft.core.BlockPos position, @Nullable net.minecraft.core.Direction blockFace) Set the lastBlockPosandDirectionthe client has looked at.
-
Constructor Details
-
FabricServerState
public FabricServerState(@NotNull @NotNull net.minecraft.client.Minecraft client) Construct a newFabricServerState.- Parameters:
client- theMinecraftinstance
-
-
Method Details
-
getConfig
Get theClientConfigfor the mod.- Returns:
- the config
-
isEnabledOnServer
public boolean isEnabledOnServer()Check whether or not VeinMiner is enabled on the server.- Returns:
- true if enabled, false otherwise
-
setActive
public void setActive(boolean active) Set whether or not vein miner is active.- Parameters:
active- the new active state
-
isActive
public boolean isActive()Check whether or not vein mine is active.- Returns:
- true if active, false otherwise
-
getSelectedPatternIndex
public int getSelectedPatternIndex()Get the index of the currently selected pattern.- Returns:
- the selected pattern index
-
getSelectedPattern
Get theNamespacedKeyof the currently selected pattern.- Returns:
- the selected pattern key
-
getNextPattern
Get theNamespacedKeyof the next pattern to be selected.- Returns:
- the next pattern key
-
getPreviousPattern
Get theNamespacedKeyof the previous pattern to be selected.- Returns:
- the previous pattern key
-
changePattern
public boolean changePattern(boolean next) Change to an adjacent pattern.- Parameters:
next- whether or not to move to the next or previous index- Returns:
- true if the pattern was changed, false if the client does not recognize any pattern yet and could not be changed
-
getPatternKeys
Get aListof all pattern keys known to the client.- Returns:
- all known pattern keys
-
hasPatternKeys
public boolean hasPatternKeys()Check whether or not any pattern keys are currently available.- Returns:
- true if there are pattern keys, false otherwise
-
setLastLookedAt
public void setLastLookedAt(@Nullable @Nullable net.minecraft.core.BlockPos position, @Nullable @Nullable net.minecraft.core.Direction blockFace) Set the lastBlockPosandDirectionthe client has looked at.- Parameters:
position- the last looked at positionblockFace- the last looked at block face
-
getLastLookedAtBlockPos
@Nullable public @Nullable net.minecraft.core.BlockPos getLastLookedAtBlockPos()Get theBlockPoslast looked at by the client, or null if the client has not looked at a block.- Returns:
- the last looked at block position, or null if none
-
getLastLookedAtBlockFace
@Nullable public @Nullable net.minecraft.core.Direction getLastLookedAtBlockFace()Get the block faceDirectionlast looked at by the client, or null if the client has not looked at a block.- Returns:
- the last looked at block face, or null if none
-
getVeinMineResultShape
@Nullable public @Nullable net.minecraft.world.phys.shapes.VoxelShape getVeinMineResultShape()Get theVoxelShapeoutlining the last vein mine result received from the server.- Returns:
- the last vein mine result shape, or null if none
-
resetShape
public void resetShape()Reset the last vein mine result shape. -
sendMessage
Description copied from interface:MessageReceiverSend a message represented by the given bytes on the specified channel.- Specified by:
sendMessagein interfaceMessageReceiver- Parameters:
channel- the channel on which the message should be sentmessage- the message bytes to be sent
-
handleHandshakeResponse
public void handleHandshakeResponse(@NotNull @NotNull PluginMessageClientboundHandshakeResponse message) Description copied from interface:ClientboundPluginMessageListenerHandles thePluginMessageClientboundHandshakeResponsemessage.- Specified by:
handleHandshakeResponsein interfaceClientboundPluginMessageListener- Parameters:
message- the message
-
handleSyncRegisteredPatterns
public void handleSyncRegisteredPatterns(@NotNull @NotNull PluginMessageClientboundSyncRegisteredPatterns message) Description copied from interface:ClientboundPluginMessageListenerHandles thePluginMessageClientboundSyncRegisteredPatternsmessage.- Specified by:
handleSyncRegisteredPatternsin interfaceClientboundPluginMessageListener- Parameters:
message- the message
-
handleSetConfig
Description copied from interface:ClientboundPluginMessageListenerHandles thePluginMessageClientboundSetConfigmessage.- Specified by:
handleSetConfigin interfaceClientboundPluginMessageListener- Parameters:
message- the message
-
handleVeinMineResults
public void handleVeinMineResults(@NotNull @NotNull PluginMessageClientboundVeinMineResults message) Description copied from interface:ClientboundPluginMessageListenerHandles thePluginMessageClientboundVeinMineResultsmessage.- Specified by:
handleVeinMineResultsin interfaceClientboundPluginMessageListener- Parameters:
message- the message
-
handleSetPattern
Description copied from interface:ClientboundPluginMessageListenerHandles thePluginMessageClientboundSetPatternmessage.- Specified by:
handleSetPatternin interfaceClientboundPluginMessageListener- Parameters:
message- the message
-