
Initialization order issue with the SimpleEntityElement class
haykam821 opened this issue ยท 0 comments
The data tracker in the GenericEntityElement
class is constructed before the SimpleEntityElement
constructor runs, so the entity type returned by the GenericEntityElement#getEntityType
method will always be null. This issue makes using the SimpleEntityElement
class for its intended purpose impossible.
The error printed will look like:
[Server thread/WARN] (Polymer) Couldn't create template entity of minecraft:pig... Defaulting to empty. This might cause problems!
[Server thread/WARN] (Polymer) First error:
[Server thread/INFO] (Minecraft) [STDERR]: java.lang.NullPointerException: Cannot invoke "net.minecraft.entity.EntityType.create(net.minecraft.world.World)" because "type" is null
[Server thread/INFO] (Minecraft) [STDERR]: at eu.pb4.polymer.common.impl.entity.InternalEntityHelpers.getEntity(InternalEntityHelpers.java:110)
[Server thread/INFO] (Minecraft) [STDERR]: at eu.pb4.polymer.common.impl.entity.InternalEntityHelpers.getExampleTrackedDataOfEntityType(InternalEntityHelpers.java:74)
[Server thread/INFO] (Minecraft) [STDERR]: at eu.pb4.polymer.virtualentity.api.tracker.SimpleDataTracker.<init>(SimpleDataTracker.java:20)
[Server thread/INFO] (Minecraft) [STDERR]: at eu.pb4.polymer.virtualentity.api.elements.GenericEntityElement.createDataTracker(GenericEntityElement.java:38)
[Server thread/INFO] (Minecraft) [STDERR]: at eu.pb4.polymer.virtualentity.api.elements.GenericEntityElement.<init>(GenericEntityElement.java:29)
[Server thread/INFO] (Minecraft) [STDERR]: at eu.pb4.polymer.virtualentity.api.elements.SimpleEntityElement.<init>(SimpleEntityElement.java:9)