method_6947: getOwner()PlayerEntity should be renamed to getPlayerEntity to remove confusion with method_24921: getOwner()Entity and annoying stack overflows
getPlayerEntity is definitely a bad name. What's the player's relation to the fishing bobber?
The player casted the fishing bobber
it could also be getCaster()
so getOwner is the entity the bobber stuck on? Needs a better name as well, like getStuckOnEntity (someone think of a more concise name)
no getOwner is from projectile entity, and that can be for arrows or fireballs etc. the getOwner from the bobber returns the the same the the other, just cast to a player entity
// FishingBobberEntity
public PlayerEntity getOwner() {
Entity owner = this.getOwner();
return owner instanceof PlayerEntity ? (PlayerEntity) owner : null;
}
// ProjectileEntity
public Entity getOwner() {
if (this.ownerUuid != null && this.world instanceof ServerWorld) {
return ((ServerWorld) this.world).getEntity(this.ownerUuid);
} else {
return this.ownerEntityId == 0 ? null : this.world.getEntityById(this.ownerEntityId);
}
}
Then I'd suggest getPlayerOwner. A similar case where a type conversion from basic entity to a player entity also happens in server command source, though that method throws than return null.
Most helpful comment
Then I'd suggest
getPlayerOwner. A similar case where a type conversion from basic entity to a player entity also happens in server command source, though that method throws than return null.