Class ItemSettingMessage

java.lang.Object
com.ldtteam.common.network.AbstractServerPlayMessage
com.minecolonies.core.network.messages.server.ItemSettingMessage
All Implemented Interfaces:
com.ldtteam.common.network.IServerboundDistributor, net.minecraft.network.protocol.common.custom.CustomPacketPayload

public class ItemSettingMessage extends com.ldtteam.common.network.AbstractServerPlayMessage
  • Nested Class Summary

    Nested classes/interfaces inherited from interface net.minecraft.network.protocol.common.custom.CustomPacketPayload

    net.minecraft.network.protocol.common.custom.CustomPacketPayload.FallbackProvider<B extends net.minecraft.network.FriendlyByteBuf>, net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>, net.minecraft.network.protocol.common.custom.CustomPacketPayload.TypeAndCodec<B extends net.minecraft.network.FriendlyByteBuf,T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    int
     
    static final com.ldtteam.common.network.PlayMessageType<?>
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
    ItemSettingMessage(String name, int value)
     
    protected
    ItemSettingMessage(net.minecraft.network.RegistryFriendlyByteBuf buf, com.ldtteam.common.network.PlayMessageType<?> type)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    onExecute(net.neoforged.neoforge.network.handling.IPayloadContext context, net.minecraft.server.level.ServerPlayer player)
    Executes the onExecute method which sets the custom data of an ItemClipboard.
    protected void
    toBytes(net.minecraft.network.RegistryFriendlyByteBuf buf)
     
    net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<?>
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.minecraft.network.protocol.common.custom.CustomPacketPayload

    toVanillaClientbound, toVanillaServerbound, type

    Methods inherited from interface com.ldtteam.common.network.IServerboundDistributor

    sendToServer
  • Field Details

    • TYPE

      public static final com.ldtteam.common.network.PlayMessageType<?> TYPE
    • settingName

      public String settingName
    • settingValue

      public int settingValue
  • Constructor Details

    • ItemSettingMessage

      public ItemSettingMessage(String name, int value)
    • ItemSettingMessage

      protected ItemSettingMessage(net.minecraft.network.RegistryFriendlyByteBuf buf, com.ldtteam.common.network.PlayMessageType<?> type)
  • Method Details

    • onExecute

      protected void onExecute(net.neoforged.neoforge.network.handling.IPayloadContext context, net.minecraft.server.level.ServerPlayer player)
      Executes the onExecute method which sets the custom data of an ItemClipboard. If the player or the stack is null, or the stack does not contain an ItemClipboard, the method returns early. Otherwise, it reads the current custom data (or creates an empty one if it doesn't exist), mutates a copy of it by setting the settingName to the settingValue, sets the new custom data back to the stack, and notifies the player's inventory and menu of the change.
      Specified by:
      onExecute in class com.ldtteam.common.network.AbstractServerPlayMessage
      Parameters:
      context - the IPayloadContext object
      player - the ServerPlayer object
    • toBytes

      protected void toBytes(net.minecraft.network.RegistryFriendlyByteBuf buf)
    • type

      public net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<?> type()
      Specified by:
      type in interface net.minecraft.network.protocol.common.custom.CustomPacketPayload