mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-04 22:14:40 +01:00
SPIGOT-4803: Fox related APIs
This commit is contained in:
parent
ba2e5e7c74
commit
5193f762a7
4 changed files with 109 additions and 5 deletions
66
nms-patches/EntityFox.patch
Normal file
66
nms-patches/EntityFox.patch
Normal file
|
@ -0,0 +1,66 @@
|
|||
--- a/net/minecraft/server/EntityFox.java
|
||||
+++ b/net/minecraft/server/EntityFox.java
|
||||
@@ -96,7 +96,7 @@
|
||||
this.goalSelector.a(10, new EntityFox.p());
|
||||
this.goalSelector.a(11, new EntityFox.j(this, EntityHuman.class, 24.0F));
|
||||
this.goalSelector.a(12, new EntityFox.r());
|
||||
- this.targetSelector.a(3, new EntityFox.a(EntityLiving.class, false, false, (entityliving) -> {
|
||||
+ this.targetSelector.a(3, new EntityFox.a(EntityLiving.class, false, false, (entityliving) -> { // CraftBukkit - decompile error
|
||||
return EntityFox.bF.test(entityliving) && !this.c(entityliving.getUniqueID());
|
||||
}));
|
||||
}
|
||||
@@ -260,15 +260,15 @@
|
||||
return EntityFox.Type.a((Integer) this.datawatcher.get(EntityFox.bz));
|
||||
}
|
||||
|
||||
- private void a(EntityFox.Type entityfox_type) {
|
||||
+ public void a(EntityFox.Type entityfox_type) { // PAIL
|
||||
this.datawatcher.set(EntityFox.bz, entityfox_type.c());
|
||||
}
|
||||
|
||||
private List<UUID> ek() {
|
||||
List<UUID> list = Lists.newArrayList();
|
||||
|
||||
- list.add(((Optional) this.datawatcher.get(EntityFox.bB)).orElse((Object) null));
|
||||
- list.add(((Optional) this.datawatcher.get(EntityFox.bD)).orElse((Object) null));
|
||||
+ list.add((this.datawatcher.get(EntityFox.bB)).orElse(null)); // CraftBukkit - decompile error
|
||||
+ list.add((this.datawatcher.get(EntityFox.bD)).orElse(null)); // CraftBukkit - decompile error
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@
|
||||
return this.r(32);
|
||||
}
|
||||
|
||||
- private void x(boolean flag) {
|
||||
+ public void x(boolean flag) { // PAIL
|
||||
this.d(32, flag);
|
||||
}
|
||||
|
||||
@@ -983,7 +983,7 @@
|
||||
private int f;
|
||||
|
||||
public r() {
|
||||
- super(null);
|
||||
+ super(); // CraftBukkit - decompile error
|
||||
this.a(EnumSet.of(PathfinderGoal.Type.MOVE, PathfinderGoal.Type.LOOK));
|
||||
}
|
||||
|
||||
@@ -1035,7 +1035,7 @@
|
||||
private int c;
|
||||
|
||||
public t() {
|
||||
- super(null);
|
||||
+ super(); // CraftBukkit - decompile error
|
||||
this.c = EntityFox.this.random.nextInt(140);
|
||||
this.a(EnumSet.of(PathfinderGoal.Type.MOVE, PathfinderGoal.Type.LOOK, PathfinderGoal.Type.JUMP));
|
||||
}
|
||||
@@ -1146,7 +1146,7 @@
|
||||
private EntityLiving k;
|
||||
private int l;
|
||||
|
||||
- public a(Class oclass, boolean flag, boolean flag1, Predicate predicate) {
|
||||
+ public a(Class oclass, boolean flag, boolean flag1, Predicate<EntityLiving> predicate) { // CraftBukkit - decompile error
|
||||
super(EntityFox.this, oclass, 10, flag, flag1, predicate);
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.server.EntityFox;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
@ -25,4 +26,41 @@ public class CraftFox extends CraftAnimals implements Fox {
|
|||
public String toString() {
|
||||
return "CraftFox";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getFoxType() {
|
||||
return Type.values()[getHandle().dV().ordinal()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFoxType(Type type) {
|
||||
Preconditions.checkArgument(type != null, "type");
|
||||
|
||||
getHandle().a(EntityFox.Type.values()[type.ordinal()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCrouching() {
|
||||
return getHandle().ef();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCrouching(boolean crouching) {
|
||||
getHandle().t(crouching);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSitting() {
|
||||
return getHandle().dW();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSitting(boolean sitting) {
|
||||
getHandle().r(sitting);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSleeping(boolean sleeping) {
|
||||
getHandle().x(sleeping);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,11 +135,6 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSleeping() {
|
||||
return getHandle().isSleeping();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSleepTicks() {
|
||||
return getHandle().sleepTicks;
|
||||
|
|
|
@ -551,6 +551,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||
return getHandle().isRiptiding();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSleeping() {
|
||||
return getHandle().isSleeping();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttributeInstance getAttribute(Attribute attribute) {
|
||||
return getHandle().craftAttributes.getAttribute(attribute);
|
||||
|
|
Loading…
Reference in a new issue