Buzzier Bees

Buzzier Bees

25M Downloads

Bee duplication with Bee in a Bottle and Realistic Bees

James103 opened this issue ยท 1 comments

commented

Information

Minecraft version: 1.16.5
Forge version: 36.2.2
Buzzier Bees 1.16.5 - 3.0.1
Realistic Bees 1.5
Environment: Singleplayer and Multiplayer
Originally reported in Serilum/.issue-tracker#657

The bug

When Buzzier Bees is used in conjunction with Realistic Bees, releasing a bee from a Bee in a Bottle causes Realistic Bees to spawn 4 more bees where the bee was released at.

To try a work around this bug, in the bee spawn that occurs as a result of using a Bee in a Bottle, add the following line of code:

bee.addTag("realisticbees.ignorebee");

NOTE: If adding in the line inside the if (entity instanceof BeeEntity) { ... } block does not prevent the bug, the following lines will need to be refactored so that the tag can be added before the entity can be spawned into the world:

Entity entity = EntityType.BEE.spawn((ServerWorld) world, itemstack, context.getPlayer(), blockpos1, SpawnReason.BUCKET, true, !Objects.equals(blockpos, blockpos1) && direction == Direction.UP);
if (entity instanceof BeeEntity) {
BeeEntity bee = (BeeEntity) entity;
int anger = tag.contains("AngerTime") ? tag.getInt("AngerTime") : 0;
UUID angryAt = tag.contains("AngryAt") ? tag.getUUID("AngryAt") : null;
int age = tag.contains("Age") ? tag.getInt("Age") : 0;
boolean nectar = tag.contains("HasNectar") && tag.getBoolean("HasNectar");
boolean stung = tag.contains("HasStung") && tag.getBoolean("HasStung");
float health = tag.contains("Health") ? tag.getFloat("Health") : 10.0F;
bee.setAge(age);
bee.setHasNectar(nectar);
bee.setHasStung(stung);
bee.setRemainingPersistentAngerTime(anger);
if (angryAt != null) bee.setPersistentAngerTarget(angryAt);
bee.setHealth(health);
bee.setPersistenceRequired();
}
return ActionResultType.SUCCESS;

commented

This seems like something that should be fixed on Realistic Bees' end, because it could cause issues for just about any mod that spawns bees for something. Realistic Bees should instead check the SpawnReason when a bee is spawned to make sure it is natural rather than duplicating all bee spawns.