PaperMC/paper-server/nms-patches/net/minecraft/world/entity/animal/EntityOcelot.patch
CraftBukkit/Spigot 46a09d53f1 #870: Add isTrusting/setTrusting to CraftOcelot.
By: Ibrahim Ansari <ansari.ibrahim1@gmail.com>
2021-06-21 08:40:43 +10:00

49 lines
2.2 KiB
Diff

--- a/net/minecraft/world/entity/animal/EntityOcelot.java
+++ b/net/minecraft/world/entity/animal/EntityOcelot.java
@@ -68,11 +68,11 @@
this.t();
}
- boolean isTrusting() {
+ public boolean isTrusting() {
return (Boolean) this.entityData.get(EntityOcelot.DATA_TRUSTING);
}
- private void setTrusting(boolean flag) {
+ public void setTrusting(boolean flag) {
this.entityData.set(EntityOcelot.DATA_TRUSTING, flag);
this.t();
}
@@ -133,7 +133,7 @@
@Override
public boolean isTypeNotPersistent(double d0) {
- return !this.isTrusting() && this.tickCount > 2400;
+ return !this.isTrusting() /*&& this.ticksLived > 2400*/; // CraftBukkit
}
public static AttributeProvider.Builder p() {
@@ -182,7 +182,8 @@
if ((this.temptGoal == null || this.temptGoal.h()) && !this.isTrusting() && this.n(itemstack) && entityhuman.f((Entity) this) < 9.0D) {
this.a(entityhuman, enumhand, itemstack);
if (!this.level.isClientSide) {
- if (this.random.nextInt(3) == 0) {
+ // CraftBukkit - added event call and isCancelled check
+ if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
this.setTrusting(true);
this.w(true);
this.level.broadcastEntityEffect(this, (byte) 41);
@@ -312,10 +313,10 @@
private final EntityOcelot ocelot;
public a(EntityOcelot entityocelot, Class<T> oclass, float f, double d0, double d1) {
- Predicate predicate = IEntitySelector.NO_CREATIVE_OR_SPECTATOR;
+ // Predicate predicate = IEntitySelector.NO_CREATIVE_OR_SPECTATOR; // CraftBukkit - decompile error
- Objects.requireNonNull(predicate);
- super(entityocelot, oclass, f, d0, d1, predicate::test);
+ // Objects.requireNonNull(predicate); // CraftBukkit - decompile error
+ super(entityocelot, oclass, f, d0, d1, IEntitySelector.NO_CREATIVE_OR_SPECTATOR::test); // CraftBukkit - decompile error
this.ocelot = entityocelot;
}