Create: Estrogen

Create: Estrogen

3M Downloads

(BUG) when shooting entity with a custom arrow with the Girl Power effect, game crashes

Closed this issue ยท 1 comments

commented

Probably because it wasnt meant for other creatures, but maybe you can add it.
Heres the error:
The game crashed whilst ticking entity Error: java.lang.NullPointerException: Cannot invoke "net.minecraft.class_1324.method_6201()" because "attributeInstance" is null

Example: I shot a chicken, or a villager.

commented

public void onApplied(LivingEntity entity, AttributeContainer attributes, int amplifier) {

EntityAttributeInstance attributeInstance = entity.getAttributeInstance(BOOB_GROWING_START_TIME);
if (attributeInstance.getBaseValue() < 0.0) {
     double currentTime = Time.currentTime(entity.getWorld());
     entity.getAttributeInstance(BOOB_GROWING_START_TIME).setBaseValue(currentTime);
}

It looks like the crash is due to entity.getAttributeInstance(BOOB_GROWING_START_TIME) returning null and not being validated before .getBaseValue() is used on the result.

It might also be a solution to move the attribute check into the preexisting player check if there's no plan to expand to include other entities.