Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic villager trades #1819

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

Ragnok123
Copy link

@Ragnok123 Ragnok123 commented Apr 2, 2021

This pull request should add basic villager trade inventory with custom api.

Screenshot_2021-04-06-01-02-23-334_com mojang minecraftpe


public class EntityVillager extends EntityCreature implements EntityNPC, EntityAgeable {
public class EntityVillager extends EntityCreature implements InventoryHolder, EntityNPC, EntityAgeable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about implementing InventoryHolder here, since it has no physical inventory

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or does it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Villager trading is inventory and since villager contains trade recipes, i find them as inventory holders.

Fix nbt
Handle trade inventory transaction
}

@Override
public boolean onInteract(Player player, Item item) {
Copy link
Contributor

@lt-name lt-name May 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Google Translate)
I think we also need to rewrite the onInteract(Player player, Item item, Vector3 clickedPos) method
like this:

    @Override
    public boolean onInteract(Player player, Item item, Vector3 clickedPos) {
        if (super.onInteract(player, item, clickedPos)) {
            return true;
        }
        return this.onInteract(player, item);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants