Skip to content

Create turtle/pocket item stacks #2062

Answered by SquidDev
SirEndii asked this question in Q&A
Discussion options

You must be logged in to vote

You need to get the upgrade registry in the available HolderLookup.Provider, and then fetch the upgrade from that. For village trades, you can probably use the enchantment or potion trades as an example:

public MerchantOffer getOffer(Entity trader, RandomSource random) {
    var registryaccess = trader.level().registryAccess();
    var upgrade = registryaccess.registryOrThrow(IPocketUpgrade.REGISTRY)
        .getHolder(ResourceLocation.fromNamespaceAndPath("mymod", "my_upgade_id"))
        .orElseThrow();
    var stack = DataComponentUtil.createStack(ModRegistry.Items.POCKET_COMPUTER_ADVANCED.get(), ModRegistry.DataComponents.RIGHT_TURTLE_UPGRADE.get(), UpgradeData.ofDefault(upgrade));
    

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@SirEndii
Comment options

@SquidDev
Comment options

@SirEndii
Comment options

@SquidDev
Comment options

@SirEdvin
Comment options

Answer selected by SirEndii
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants