Add Bee#set/getTimeSinceSting() methods (#12792)

This commit is contained in:
Umbre11as
2025-07-18 23:17:06 +03:00
committed by GitHub
parent f7c59f914c
commit 0dad7f150b
3 changed files with 36 additions and 0 deletions

View File

@@ -273,6 +273,7 @@ public net.minecraft.world.entity.animal.Bee setHasStung(Z)V
public net.minecraft.world.entity.animal.Bee setRolling(Z)V
public net.minecraft.world.entity.animal.Bee stayOutOfHiveCountdown
public net.minecraft.world.entity.animal.Bee ticksWithoutNectarSinceExitingHive
public net.minecraft.world.entity.animal.Bee timeSinceSting
public net.minecraft.world.entity.animal.Cat isRelaxStateOne()Z
public net.minecraft.world.entity.animal.Cat setCollarColor(Lnet/minecraft/world/item/DyeColor;)V
public net.minecraft.world.entity.animal.Cat setRelaxStateOne(Z)V

View File

@@ -1,6 +1,7 @@
package org.bukkit.entity;
import org.bukkit.Location;
import org.checkerframework.checker.index.qual.NonNegative;
import org.jetbrains.annotations.Nullable;
/**
@@ -144,5 +145,28 @@ public interface Bee extends Animals {
* @return number of ticks
*/
int getTicksSincePollination();
/**
* Sets how many ticks have passed since this bee last stung.
* This value is used to determine when the bee should die after stinging.
* <p>
* Note that bees dont die at a fixed time. Instead, every few ticks, they
* have a random chance of dying, and that chance increases with this value.
*
* @param time number of ticks since last sting
*/
void setTimeSinceSting(@NonNegative int time);
/**
* Gets how many ticks have passed since this bee last stung.
* This value increases each tick after the bee stings and is used
* to determine when the bee should die.
* <p>
* Note that bees dont die at a fixed time. Instead, every few ticks, they
* have a random chance of dying, and that chance increases with this value.
*
* @return number of ticks since last sting
*/
int getTimeSinceSting();
// Paper end
}

View File

@@ -118,4 +118,15 @@ public class CraftBee extends CraftAnimals implements Bee {
public int getTicksSincePollination() {
return this.getHandle().ticksWithoutNectarSinceExitingHive;
}
@Override
public void setTimeSinceSting(int time) {
Preconditions.checkArgument(time >= 0, "Time since sting cannot be negative");
this.getHandle().timeSinceSting = time;
}
@Override
public int getTimeSinceSting() {
return this.getHandle().timeSinceSting;
}
}