Fix bees aging inside hives

This commit is contained in:
Etil
2021-10-04 17:55:36 +02:00
parent 432743d4a4
commit 53deee627c

View File

@@ -0,0 +1,47 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Etil <81570777+etil2jz@users.noreply.github.com>
Date: Mon, 4 Oct 2021 17:50:00 +0200
Subject: [PATCH] Fix bees aging inside hives
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
index 8484e80a70129fb0358d56efab6fd54798b54e6e..0621d328d5eb6e23da3ca19844bd4e3296ffee85 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
@@ -315,17 +315,18 @@ public class BeehiveBlockEntity extends BlockEntity {
for (Iterator iterator = bees.iterator(); iterator.hasNext(); ++tileentitybeehive_hivebee.ticksInHive) {
tileentitybeehive_hivebee = (BeehiveBlockEntity.BeeData) iterator.next();
- if (tileentitybeehive_hivebee.ticksInHive > tileentitybeehive_hivebee.minOccupationTicks) {
+ if (tileentitybeehive_hivebee.exitTickCounter > tileentitybeehive_hivebee.minOccupationTicks) { // Mirai - use exitTickCounter
BeehiveBlockEntity.BeeReleaseStatus tileentitybeehive_releasestatus = tileentitybeehive_hivebee.entityData.getBoolean("HasNectar") ? BeehiveBlockEntity.BeeReleaseStatus.HONEY_DELIVERED : BeehiveBlockEntity.BeeReleaseStatus.BEE_RELEASED;
if (BeehiveBlockEntity.releaseOccupant(world, pos, state, tileentitybeehive_hivebee, (List) null, tileentitybeehive_releasestatus, flowerPos)) {
iterator.remove();
// CraftBukkit start
} else {
- tileentitybeehive_hivebee.ticksInHive = tileentitybeehive_hivebee.minOccupationTicks / 2; // Not strictly Vanilla behaviour in cases where bees cannot spawn but still reasonable
+ tileentitybeehive_hivebee.exitTickCounter = tileentitybeehive_hivebee.minOccupationTicks / 2; // Not strictly Vanilla behaviour in cases where bees cannot spawn but still reasonable // Mirai - use exitTickCounter to keep actual bee life
// CraftBukkit end
}
}
+ tileentitybeehive_hivebee.exitTickCounter++; // Mirai
}
}
@@ -410,6 +411,7 @@ public class BeehiveBlockEntity extends BlockEntity {
final CompoundTag entityData;
int ticksInHive;
+ int exitTickCounter; // Mirai - separate counter for checking if bee should exit to reduce exit attempts
final int minOccupationTicks;
BeeData(CompoundTag nbttagcompound, int i, int j) {
@@ -417,6 +419,7 @@ public class BeehiveBlockEntity extends BlockEntity {
this.entityData = nbttagcompound;
this.ticksInHive = i;
this.minOccupationTicks = j;
+ this.exitTickCounter = this.ticksInHive; // Mirai
}
}
}