mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-08 16:12:18 -07:00
Add Bee#set/getTimeSinceSting() methods (#12792)
This commit is contained in:
@@ -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 setRolling(Z)V
|
||||||
public net.minecraft.world.entity.animal.Bee stayOutOfHiveCountdown
|
public net.minecraft.world.entity.animal.Bee stayOutOfHiveCountdown
|
||||||
public net.minecraft.world.entity.animal.Bee ticksWithoutNectarSinceExitingHive
|
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 isRelaxStateOne()Z
|
||||||
public net.minecraft.world.entity.animal.Cat setCollarColor(Lnet/minecraft/world/item/DyeColor;)V
|
public net.minecraft.world.entity.animal.Cat setCollarColor(Lnet/minecraft/world/item/DyeColor;)V
|
||||||
public net.minecraft.world.entity.animal.Cat setRelaxStateOne(Z)V
|
public net.minecraft.world.entity.animal.Cat setRelaxStateOne(Z)V
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package org.bukkit.entity;
|
package org.bukkit.entity;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.checkerframework.checker.index.qual.NonNegative;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -144,5 +145,28 @@ public interface Bee extends Animals {
|
|||||||
* @return number of ticks
|
* @return number of ticks
|
||||||
*/
|
*/
|
||||||
int getTicksSincePollination();
|
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 don’t 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 don’t 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
|
// Paper end
|
||||||
}
|
}
|
||||||
|
@@ -118,4 +118,15 @@ public class CraftBee extends CraftAnimals implements Bee {
|
|||||||
public int getTicksSincePollination() {
|
public int getTicksSincePollination() {
|
||||||
return this.getHandle().ticksWithoutNectarSinceExitingHive;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user