[SPIGOT-7965] Inconsistency in TransformReason for Hoglins Created: 26/Nov/24  Updated: 25/Dec/24  Resolved: 26/Nov/24

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: David Mühlan Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None

Version: 1.21.2-R0.1-SNAPSHOT
Guidelines Read: Yes

 Description   

When using EntityTransformEvent to check for piglins or piglin brutes being transformed to zombified piglins, the event is called and the TransformReason is flagged "PIGLIN_ZOMBIFIED". The piglins transform because I guess the overworld is too cold for them. But the exact same thing happens to hoglins when they transform to zoglins. However, then the TransformReason is flagged "UNKNOWN"
Since the transformation for piglins, piglin brutes and hoglins is the exact same thing, I assume that this is an inconsistency and not intended

Recreation:

@EventHandler
public void onEntityTransform(EntityTransformEvent ev) {
    if(ev.getEntity().getType().equals(EntityType.HOGLIN)) {
        getLogger().info("Hoglin transformation reason: " + ev.getTransformReason().name());
    }
    if(ev.getEntity().getType().equals(EntityType.PIGLIN)) {
        getLogger().info("Piglin transformation reason: " + ev.getTransformReason().name());
    }
}

Generated at Mon Mar 24 19:11:52 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.