Jump to content

Recommended Posts

Posted
@SubscribeEvent
    public static void offers(VillagerTradesEvent event){
        if(event.getType() == VillagerProfession.FLETCHER){
            event.getTrades().put(1, Collections.singletonList(new BasicItemListing(32, new ItemStack(ModItems.EXPLOSIVE_ARROW.get()), 3, 5, 0.03f)));
        }
    }

It works. But for tier one, only my offer is loaded, and vanilla is not. How to fix it?

Posted
@SubscribeEvent
    public static void offers(VillagerTradesEvent event){
        if(event.getType() == VillagerProfession.FLETCHER){
            event.getTrades().put(1, Collections.singletonList(new BasicItemListing(32, new ItemStack(ModItems.EXPLOSIVE_ARROW.get()), 3, 5, 0.03f)));
        }
    }

It works. But for tier one, only my offer is loaded, and vanilla is not. How to fix it?

Posted

you replace the vanilla Trades with Int2ObjectMap#put in this case,
you need to call Int2ObjectMap#get which returns a List of all Trades for level 1 then you can call List#add:

event.getTrades().get(1).add(<your_trade>);

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.