Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
MythicMobs MythicMobs
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 132
    • Issues 132
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • MythicCraft
  • MythicMobsMythicMobs
  • Issues
  • #73

Closed
Open
Created Sep 04, 2020 by Lix3nn@Lix3nn53

1.16.2 Entity has vanilla attributes when spawned via API

Here I debug with a small code that displays attributes of LivingEntity on PlayerInteractEntityEvent: ss

It still does not have exactly 200 hp and 8 damage when spawned via command but very close.

Config:

CatAllBlack:
  Type: WOLF
  Tameable: false
  Display: '&8Vantablack'
  Health: 200
  Damage: 8
  LevelModifiers:
  - health 5
  - damage 1

My code:

MobManager mobManager = MythicMobs.inst().getMobManager();
ActiveMob activeMob = mobManager.spawnMob(petCode, spawnLoc, petLevel);
AbstractEntity entity = activeMob.getEntity();
Tameable pet = (Tameable) entity.getBukkitEntity();
pet.setSilent(true);
pet.setTamed(true);
pet.setOwner(owner);
pet.setCustomNameVisible(true);

// health
int maxHP = (int) (pet.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue() + 0.5);
GuardiansOfAdelia.getInstance().getLogger().info("Pet maxHP: " + maxHP);

The last line in my code says 20 health too.

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking