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 Details

    • FabricServerState

      public FabricServerState(@NotNull @NotNull net.minecraft.client.Minecraft client)
      Construct a new FabricServerState.
      Parameters:
      client - the Minecraft instance
  • Method Details

    • getConfig

      @NotNull public @NotNull ClientConfig getConfig()
      Get the ClientConfig for 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

      @NotNull public @NotNull NamespacedKey getSelectedPattern()
      Get the NamespacedKey of the currently selected pattern.
      Returns:
      the selected pattern key
    • getNextPattern

      @NotNull public @NotNull NamespacedKey getNextPattern()
      Get the NamespacedKey of the next pattern to be selected.
      Returns:
      the next pattern key
    • getPreviousPattern

      @NotNull public @NotNull NamespacedKey getPreviousPattern()
      Get the NamespacedKey of 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

      @NotNull public @NotNull List<NamespacedKey> getPatternKeys()
      Get a List of 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 last BlockPos and Direction the client has looked at.
      Parameters:
      position - the last looked at position
      blockFace - the last looked at block face
    • getLastLookedAtBlockPos

      @Nullable public @Nullable net.minecraft.core.BlockPos getLastLookedAtBlockPos()
      Get the BlockPos last 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 face Direction last 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 the VoxelShape outlining 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

      public void sendMessage(@NotNull @NotNull NamespacedKey channel, byte[] message)
      Description copied from interface: MessageReceiver
      Send a message represented by the given bytes on the specified channel.
      Specified by:
      sendMessage in interface MessageReceiver
      Parameters:
      channel - the channel on which the message should be sent
      message - the message bytes to be sent
    • handleHandshakeResponse

      public void handleHandshakeResponse(@NotNull @NotNull PluginMessageClientboundHandshakeResponse message)
      Description copied from interface: ClientboundPluginMessageListener
      Specified by:
      handleHandshakeResponse in interface ClientboundPluginMessageListener
      Parameters:
      message - the message
    • handleSyncRegisteredPatterns

      public void handleSyncRegisteredPatterns(@NotNull @NotNull PluginMessageClientboundSyncRegisteredPatterns message)
      Description copied from interface: ClientboundPluginMessageListener
      Specified by:
      handleSyncRegisteredPatterns in interface ClientboundPluginMessageListener
      Parameters:
      message - the message
    • handleSetConfig

      public void handleSetConfig(@NotNull @NotNull PluginMessageClientboundSetConfig message)
      Description copied from interface: ClientboundPluginMessageListener
      Specified by:
      handleSetConfig in interface ClientboundPluginMessageListener
      Parameters:
      message - the message
    • handleVeinMineResults

      public void handleVeinMineResults(@NotNull @NotNull PluginMessageClientboundVeinMineResults message)
      Description copied from interface: ClientboundPluginMessageListener
      Specified by:
      handleVeinMineResults in interface ClientboundPluginMessageListener
      Parameters:
      message - the message
    • handleSetPattern

      public void handleSetPattern(@NotNull @NotNull PluginMessageClientboundSetPattern message)
      Description copied from interface: ClientboundPluginMessageListener
      Specified by:
      handleSetPattern in interface ClientboundPluginMessageListener
      Parameters:
      message - the message