PocketMine-MP
PocketMine-MP copied to clipboard
Implemented working Name tag
Introduction
Implement the nametags and their function (currently only obtainable through commands because there are no anvils).
Follow-up
- https://github.com/pmmp/Language/pull/134
Tests
https://youtu.be/DCpjGbXHEh0 (The interactive tag for fishing rod was implemented overriding the item on a plugin for testing the api)
I think an event must be written for this feature.
I think an event must be written for this feature.
There is PlayerEntityInteractEvent
Looks good, well done
The PR looks functionally OK.
The thing that's giving me pause is that the mode of operation here is inconsistent with every other method of item interaction. For example, weapon damage when attacking an entity is not handled by the entity itself; it's processed in Item->onAttackEntity(). We also already have API methods like Item->onInteractBlock().
The PR looks functionally OK.
The thing that's giving me pause is that the mode of operation here is inconsistent with every other method of item interaction. For example, weapon damage when attacking an entity is not handled by the entity itself; it's processed in
Item->onAttackEntity(). We also already have API methods likeItem->onInteractBlock().
I agree with adding a method like that, but for this specific case I am more inclined towards the idea of adding an interface for renameable entities because they have a property: EntityMetadataProperties::INTERACTIVE_TAG.
The following changes have been made:
- Logic for renaming has been moved to
NameableTrait, renameable entities should use it and implementNameable - Implemented API for Interactive Tags (interaction button displayed above the hotbar).
- Interactive tag is now displayed when looking at the renameable entity.
The above changes require this to be merged
This PR has caught up with the latest changes and now uses the new Item::onInteractEntity() method.
I do not understand what is redundant
Nameable and NameableTrait exists because not all Living entities are nameable, some examples are:
HumanEnderDragonand there are also non-Livingentities that are nameable:ArmorStand
I believe the look detection is what is being considered as redundant here. The nametag can be implemented from when it gets used and shouldn't depend on whether or not an entity is being looked at.
The look detection isn't redundant in itself, I just think that the implementation of it is vastly overcomplicated.