Class AmadronPlayerOffer

All Implemented Interfaces:
net.minecraft.world.item.crafting.Recipe<PneumaticCraftRecipe.DummyIInventory>

public class AmadronPlayerOffer extends AmadronOffer
Extended Amadron offer used for player-player trading.
  • Constructor Details

  • Method Details

    • setProvidingPosition

      public AmadronPlayerOffer setProvidingPosition(net.minecraft.core.GlobalPos pos)
    • setReturningPosition

      public AmadronPlayerOffer setReturningPosition(net.minecraft.core.GlobalPos pos)
    • getReversedOffer

      public AmadronPlayerOffer getReversedOffer()
      Create an offer which is the reverse of this offer. Used for Amadron restocking and returning of unsold stock when a player offer is removed. Note that the reversed offer has "_rev" appended to its ID; this new offer is available via AmadronOfferManager.getOffer(ResourceLocation) (assuming the original offer is) but will never appear in the active offers list. If this is called on an already-reversed offer, the original offer will be returned.
      Returns:
      a new Amadron offer with the input and output swapped
    • updatePlayerId

      public void updatePlayerId()
    • addPayment

      public void addPayment(int payment)
    • getVendorName

      public net.minecraft.network.chat.Component getVendorName()
      Description copied from class: AmadronRecipe
      Get the offer's vendor name, for display purposes. The default is "Amadron" for static and periodic offers loaded from datapack, "Villagers" for villager-discovered offers, and the player's display name (at the time of offer creation) for player-added offers.
      Overrides:
      getVendorName in class AmadronOffer
      Returns:
      the vendor name
    • getPlayerId

      public UUID getPlayerId()
    • onTrade

      public void onTrade(int tradingAmount, String buyingPlayer)
      Overrides:
      onTrade in class AmadronOffer
    • isRemovableBy

      public boolean isRemovableBy(net.minecraft.world.entity.player.Player player)
      Description copied from class: AmadronRecipe
      Can this offer be removed by the given player?
      Overrides:
      isRemovableBy in class AmadronRecipe
      Parameters:
      player - the player
      Returns:
      true if this player can remove this offer from the system, false otherwise
    • notifyRestock

      public void notifyRestock()
    • payout

      public boolean payout()
    • returnStock

      public void returnStock()
      Return any unsold stock when an Amadron offer is removed. If there's no space in the provider inventory or the inventory is gone, items will be dumped on the ground.
    • getProvidingTileEntity

      public net.minecraft.world.level.block.entity.BlockEntity getProvidingTileEntity()
    • getProvidingPos

      public net.minecraft.core.GlobalPos getProvidingPos()
    • write

      public void write(net.minecraft.network.FriendlyByteBuf buf)
      Description copied from class: PneumaticCraftRecipe
      Writes this recipe to a PacketBuffer.
      Overrides:
      write in class AmadronOffer
      Parameters:
      buf - The buffer to write to.
    • playerOfferFromBuf

      public static AmadronPlayerOffer playerOfferFromBuf(net.minecraft.resources.ResourceLocation id, net.minecraft.network.FriendlyByteBuf buf)
    • toJson

      public com.google.gson.JsonObject toJson(com.google.gson.JsonObject json)
      Overrides:
      toJson in class AmadronOffer
    • fromJson

      public static AmadronPlayerOffer fromJson(com.google.gson.JsonObject json) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • equivalentTo

      public boolean equivalentTo(AmadronPlayerOffer otherOffer)
      Overrides:
      equivalentTo in class AmadronOffer
    • toString

      public String toString()
      Overrides:
      toString in class AmadronOffer
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class AmadronOffer
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AmadronOffer
    • getReversedId

      public static net.minecraft.resources.ResourceLocation getReversedId(net.minecraft.resources.ResourceLocation id)