Class AmadronPlayerOffer
java.lang.Object
me.desht.pneumaticcraft.api.crafting.recipe.PneumaticCraftRecipe
me.desht.pneumaticcraft.api.crafting.recipe.AmadronRecipe
me.desht.pneumaticcraft.common.recipes.amadron.AmadronOffer
me.desht.pneumaticcraft.common.recipes.amadron.AmadronPlayerOffer
- All Implemented Interfaces:
net.minecraft.world.item.crafting.Recipe<PneumaticCraftRecipe.DummyIInventory>
Extended Amadron offer used for player-player trading.
-
Nested Class Summary
Nested classes/interfaces inherited from class me.desht.pneumaticcraft.common.recipes.amadron.AmadronOffer
AmadronOffer.Serializer<T extends AmadronRecipe>Nested classes/interfaces inherited from class me.desht.pneumaticcraft.api.crafting.recipe.PneumaticCraftRecipe
PneumaticCraftRecipe.DummyIInventory -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionAmadronPlayerOffer(net.minecraft.resources.ResourceLocation id, AmadronTradeResource input, AmadronTradeResource output, net.minecraft.world.entity.player.Player player) AmadronPlayerOffer(net.minecraft.resources.ResourceLocation id, AmadronTradeResource input, AmadronTradeResource output, net.minecraft.world.entity.player.Player offeringPlayer, PlayerFilter whitelist, PlayerFilter blacklist) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPayment(int payment) booleanbooleanequivalentTo(AmadronPlayerOffer otherOffer) static AmadronPlayerOfferfromJson(com.google.gson.JsonObject json) net.minecraft.core.GlobalPosnet.minecraft.world.level.block.entity.BlockEntitystatic net.minecraft.resources.ResourceLocationgetReversedId(net.minecraft.resources.ResourceLocation id) Create an offer which is the reverse of this offer.net.minecraft.network.chat.ComponentGet the offer's vendor name, for display purposes.inthashCode()booleanisRemovableBy(net.minecraft.world.entity.player.Player player) Can this offer be removed by the given player?voidvoidbooleanpayout()static AmadronPlayerOfferplayerOfferFromBuf(net.minecraft.resources.ResourceLocation id, net.minecraft.network.FriendlyByteBuf buf) voidReturn any unsold stock when an Amadron offer is removed.setProvidingPosition(net.minecraft.core.GlobalPos pos) setReturningPosition(net.minecraft.core.GlobalPos pos) com.google.gson.JsonObjecttoJson(com.google.gson.JsonObject json) toString()voidvoidwrite(net.minecraft.network.FriendlyByteBuf buf) Writes this recipe to a PacketBuffer.Methods inherited from class me.desht.pneumaticcraft.common.recipes.amadron.AmadronOffer
addAvailabilityData, getDescription, getInput, getMaxStock, getOutput, getSerializer, getStock, getTradeLevel, getType, isLocationLimited, isStaticOffer, isUsableByPlayer, offerFromBuf, setStock, setVillagerTradeMethods inherited from class me.desht.pneumaticcraft.api.crafting.recipe.AmadronRecipe
passesQueryMethods inherited from class me.desht.pneumaticcraft.api.crafting.recipe.PneumaticCraftRecipe
assemble, canCraftInDimensions, getId, getResultItem, isSpecial, matchesMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.item.crafting.Recipe
getGroup, getIngredients, getRemainingItems, getToastSymbol, isIncomplete
-
Constructor Details
-
AmadronPlayerOffer
public AmadronPlayerOffer(net.minecraft.resources.ResourceLocation id, AmadronTradeResource input, AmadronTradeResource output, net.minecraft.world.entity.player.Player offeringPlayer, PlayerFilter whitelist, PlayerFilter blacklist) -
AmadronPlayerOffer
public AmadronPlayerOffer(net.minecraft.resources.ResourceLocation id, AmadronTradeResource input, AmadronTradeResource output, net.minecraft.world.entity.player.Player player)
-
-
Method Details
-
setProvidingPosition
-
setReturningPosition
-
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 viaAmadronOfferManager.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:AmadronRecipeGet 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:
getVendorNamein classAmadronOffer- Returns:
- the vendor name
-
getPlayerId
-
onTrade
- Overrides:
onTradein classAmadronOffer
-
isRemovableBy
public boolean isRemovableBy(net.minecraft.world.entity.player.Player player) Description copied from class:AmadronRecipeCan this offer be removed by the given player?- Overrides:
isRemovableByin classAmadronRecipe- 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:PneumaticCraftRecipeWrites this recipe to a PacketBuffer.- Overrides:
writein classAmadronOffer- 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:
toJsonin classAmadronOffer
-
fromJson
public static AmadronPlayerOffer fromJson(com.google.gson.JsonObject json) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
equivalentTo
- Overrides:
equivalentToin classAmadronOffer
-
toString
- Overrides:
toStringin classAmadronOffer
-
equals
- Overrides:
equalsin classAmadronOffer
-
hashCode
public int hashCode()- Overrides:
hashCodein classAmadronOffer
-
getReversedId
public static net.minecraft.resources.ResourceLocation getReversedId(net.minecraft.resources.ResourceLocation id)
-