PocketMine-MP icon indicating copy to clipboard operation
PocketMine-MP copied to clipboard

Implemented working Name tag

Open IvanCraft623 opened this issue 3 years ago • 6 comments

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)

IvanCraft623 avatar Aug 06 '22 01:08 IvanCraft623

I think an event must be written for this feature.

xerenahmed avatar Aug 11 '22 11:08 xerenahmed

I think an event must be written for this feature.

There is PlayerEntityInteractEvent

IvanCraft623 avatar Aug 11 '22 14:08 IvanCraft623

Looks good, well done

xqwtxon avatar Sep 15 '22 09:09 xqwtxon

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().

dktapps avatar Sep 15 '22 11:09 dktapps

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().

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.

IvanCraft623 avatar Sep 16 '22 01:09 IvanCraft623

The following changes have been made:

  • Logic for renaming has been moved to NameableTrait, renameable entities should use it and implement Nameable
  • 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

IvanCraft623 avatar Sep 25 '22 18:09 IvanCraft623

This PR has caught up with the latest changes and now uses the new Item::onInteractEntity() method.

IvanCraft623 avatar Dec 17 '22 07:12 IvanCraft623

I do not understand what is redundant Nameable and NameableTrait exists because not all Living entities are nameable, some examples are:

  • Human
  • EnderDragon and there are also non-Living entities that are nameable:
  • ArmorStand

IvanCraft623 avatar Dec 18 '22 22:12 IvanCraft623

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.

jasonw4331 avatar Mar 17 '23 15:03 jasonw4331

The look detection isn't redundant in itself, I just think that the implementation of it is vastly overcomplicated.

dktapps avatar Mar 17 '23 15:03 dktapps