Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build-data/paper.at
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions paper-api/src/main/java/org/bukkit/entity/Bee.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.bukkit.entity;

import org.bukkit.Location;
import org.checkerframework.checker.index.qual.NonNegative;
import org.jetbrains.annotations.Nullable;

/**
Expand Down Expand Up @@ -144,5 +145,22 @@ 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.
*
* @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.
*
* @return number of ticks since last sting
*/
int getTimeSinceSting();
// Paper end
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,15 @@ public void setTicksSincePollination(int ticks) {
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;
}
}
Loading