All Implemented Interfaces:
net.minecraft.world.item.crafting.Recipe<PneumaticCraftRecipe.DummyIInventory>
Direct Known Subclasses:
AmadronPlayerOffer

public class AmadronOffer extends AmadronRecipe
  • Field Details

  • Constructor Details

  • Method Details

    • getInput

      @Nonnull public AmadronTradeResource getInput()
      Description copied from class: AmadronRecipe
      Get the offer's input, i.e. what the Amadrone will collect from the player's Amadron inventory.
      Specified by:
      getInput in class AmadronRecipe
      Returns:
      the input
    • getOutput

      @Nonnull public AmadronTradeResource getOutput()
      Description copied from class: AmadronRecipe
      Get the offer's output, i.e. what the player will receive in return from the Amadrone
      Specified by:
      getOutput in class AmadronRecipe
      Returns:
      the output
    • isStaticOffer

      public boolean isStaticOffer()
      Description copied from class: AmadronRecipe
      Is this a static offer, always displayed on the Amadron tablet? Or periodic, shuffled in at random once per Minecraft day (by default) ?
      Specified by:
      isStaticOffer in class AmadronRecipe
      Returns:
      true if this is a static offer, false otherwise
    • getTradeLevel

      public int getTradeLevel()
      Description copied from class: AmadronRecipe
      The rarity for villager and periodic trades, in the range of 1 (common) to 5 (very rare)
      Specified by:
      getTradeLevel in class AmadronRecipe
      Returns:
      the rarity, or 0 if this is a static (always shown) offer
    • setVillagerTrade

      public AmadronOffer setVillagerTrade()
    • equivalentTo

      public boolean equivalentTo(AmadronPlayerOffer offer)
    • 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.
      Specified by:
      getVendorName in class AmadronRecipe
      Returns:
      the vendor name
    • getStock

      public int getStock()
      Description copied from class: AmadronRecipe
      Get the number of trades Amadron currently has in stock for this offer. Note that all (default) static offers have unlimited trades, as do all player-added offers. Offers discovered from villager trades do have limited stock (defined by the number of trades the villager would normally offer)
      Specified by:
      getStock in class AmadronRecipe
      Returns:
      the number of trades in stock, or any negative number for unlimited stock
    • setStock

      public void setStock(int inStock)
      Description copied from class: AmadronRecipe
      Update the number of trades Amadron currently has in stock for this offer. It is the responsbility of the implementation to ensure the stock level does not go below 0, or above the max stock level as returned by AmadronRecipe.getMaxStock() (provided that the max stock level is > 0).
      Specified by:
      setStock in class AmadronRecipe
      Parameters:
      inStock - the new stock level
    • onTrade

      public void onTrade(int tradingAmount, String buyingPlayer)
    • write

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

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

      public com.google.gson.JsonObject toJson(com.google.gson.JsonObject json)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getDescription

      public net.minecraft.network.chat.Component getDescription()
      Get a player-friendly description of the offer
      Returns:
      a description string
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getSerializer

      public net.minecraft.world.item.crafting.RecipeSerializer<?> getSerializer()
    • getType

      public net.minecraft.world.item.crafting.RecipeType<?> getType()
    • getMaxStock

      public int getMaxStock()
      Description copied from class: AmadronRecipe
      Get the maximum (initial) stock level for this offer.
      Specified by:
      getMaxStock in class AmadronRecipe
      Returns:
      the max stock level; any quantity ≤ 0 indicates no maximum in force
    • isUsableByPlayer

      public boolean isUsableByPlayer(net.minecraft.world.entity.player.Player player)
      Description copied from class: AmadronRecipe
      Is this offer available to the given player? By default, all offers are available, but offers can be whitelisted/blacklisted in data packs with the "whitelist" and "blacklist" fields in the Amadron recipe JSON. This could be used, for example, to only allow selling snow in a desert biome, or only purchasing ender pearls in the End. Default filters are "dimensions" and "biome_categories", but others can be added via PneumaticRegistry.IPneumaticCraftInterface.registerPlayerMatcher(ResourceLocation, IPlayerMatcher.MatcherFactory)
      Specified by:
      isUsableByPlayer in class AmadronRecipe
      Parameters:
      player - the player to check
      Returns:
      true if the offer is available to the player at the time of use, false otherwise
    • addAvailabilityData

      public void addAvailabilityData(net.minecraft.world.entity.player.Player player, List<net.minecraft.network.chat.Component> curTip)
      Description copied from class: AmadronRecipe
      Add some information about where this offer is available, in the case of offers with limited availablity.
      Overrides:
      addAvailabilityData in class AmadronRecipe
      curTip - tooltip to add information to
    • isLocationLimited

      public boolean isLocationLimited()
      Overrides:
      isLocationLimited in class AmadronRecipe