Fix #43 (Randomly stuck sitting foxes)
This commit is contained in:
parent
63814427db
commit
7510a51f96
|
@ -181,7 +181,7 @@ public class EntityTamableFox extends EntityFox {
|
|||
compound.setString("OwnerUUID", this.getOwnerUUID().toString());
|
||||
}
|
||||
|
||||
compound.setBoolean("Sitting", this.isSitting());
|
||||
compound.setBoolean("Sitting", this.goalSit.isWillSit());
|
||||
}
|
||||
|
||||
// readAdditionalSaveData
|
||||
|
@ -192,10 +192,7 @@ public class EntityTamableFox extends EntityFox {
|
|||
|
||||
if (compound.hasKeyOfType("OwnerUUID", 8)) {
|
||||
ownerUuid = compound.getString("OwnerUUID");
|
||||
}/* else {
|
||||
String var2 = compound.getString("Owner");
|
||||
ownerUuid = NameReferencingFileConverter.a(this.getMinecraftServer(), var2);
|
||||
}*/
|
||||
}
|
||||
|
||||
if (!ownerUuid.isEmpty()) {
|
||||
try {
|
||||
|
@ -210,7 +207,9 @@ public class EntityTamableFox extends EntityFox {
|
|||
this.goalSit.setSitting(compound.getBoolean("Sitting"));
|
||||
}
|
||||
|
||||
this.setSitting(compound.getBoolean("Sitting"));
|
||||
if (!this.isTamed()) {
|
||||
goalSit.setSitting(false);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isTamed() {
|
||||
|
|
|
@ -48,6 +48,8 @@ public class FoxPathfinderGoalSit extends PathfinderGoal {
|
|||
this.entity.setSitting(false);
|
||||
}
|
||||
|
||||
public boolean isWillSit() { return this.willSit; }
|
||||
|
||||
public void setSitting(boolean flag) {
|
||||
this.willSit = flag;
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ public class EntityTamableFox extends EntityFox {
|
|||
compound.setString("OwnerUUID", this.getOwnerUUID().toString());
|
||||
}
|
||||
|
||||
compound.setBoolean("Sitting", this.isSitting());
|
||||
compound.setBoolean("Sitting", this.goalSit.isWillSit());
|
||||
}
|
||||
|
||||
// readAdditionalSaveData
|
||||
|
@ -192,10 +192,7 @@ public class EntityTamableFox extends EntityFox {
|
|||
|
||||
if (compound.hasKeyOfType("OwnerUUID", 8)) {
|
||||
ownerUuid = compound.getString("OwnerUUID");
|
||||
}/* else {
|
||||
String var2 = compound.getString("Owner");
|
||||
ownerUuid = NameReferencingFileConverter.a(this.getMinecraftServer(), var2);
|
||||
}*/
|
||||
}
|
||||
|
||||
if (!ownerUuid.isEmpty()) {
|
||||
try {
|
||||
|
@ -210,7 +207,9 @@ public class EntityTamableFox extends EntityFox {
|
|||
this.goalSit.setSitting(compound.getBoolean("Sitting"));
|
||||
}
|
||||
|
||||
this.setSitting(compound.getBoolean("Sitting"));
|
||||
if (!this.isTamed()) {
|
||||
goalSit.setSitting(false);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isTamed() {
|
||||
|
|
|
@ -49,6 +49,8 @@ public class FoxPathfinderGoalSit extends PathfinderGoal {
|
|||
this.entity.setSitting(false);
|
||||
}
|
||||
|
||||
public boolean isWillSit() { return this.willSit; }
|
||||
|
||||
public void setSitting(boolean flag) {
|
||||
this.willSit = flag;
|
||||
}
|
||||
|
|
|
@ -180,7 +180,7 @@ public class EntityTamableFox extends EntityFox {
|
|||
compound.setString("OwnerUUID", this.getOwnerUUID().toString());
|
||||
}
|
||||
|
||||
compound.setBoolean("Sitting", this.isSitting());
|
||||
compound.setBoolean("Sitting", this.goalSit.isWillSit());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -190,10 +190,7 @@ public class EntityTamableFox extends EntityFox {
|
|||
|
||||
if (compound.hasKeyOfType("OwnerUUID", 8)) {
|
||||
ownerUuid = compound.getString("OwnerUUID");
|
||||
}/* else {
|
||||
String var2 = compound.getString("Owner");
|
||||
ownerUuid = NameReferencingFileConverter.a(this.getMinecraftServer(), var2);
|
||||
}*/
|
||||
}
|
||||
|
||||
if (!ownerUuid.isEmpty()) {
|
||||
try {
|
||||
|
@ -208,7 +205,9 @@ public class EntityTamableFox extends EntityFox {
|
|||
this.goalSit.setSitting(compound.getBoolean("Sitting"));
|
||||
}
|
||||
|
||||
this.setSitting(compound.getBoolean("Sitting"));
|
||||
if (!this.isTamed()) {
|
||||
goalSit.setSitting(false);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isTamed() {
|
||||
|
|
|
@ -48,6 +48,8 @@ public class FoxPathfinderGoalSit extends PathfinderGoal {
|
|||
this.entity.setSitting(false);
|
||||
}
|
||||
|
||||
public boolean isWillSit() { return this.willSit; }
|
||||
|
||||
public void setSitting(boolean flag) {
|
||||
this.willSit = flag;
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ public class EntityTamableFox extends EntityFox {
|
|||
compound.setString("OwnerUUID", this.getOwnerUUID().toString());
|
||||
}
|
||||
|
||||
compound.setBoolean("Sitting", this.isSitting());
|
||||
compound.setBoolean("Sitting", this.goalSit.isWillSit());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -188,10 +188,7 @@ public class EntityTamableFox extends EntityFox {
|
|||
|
||||
if (compound.hasKeyOfType("OwnerUUID", 8)) {
|
||||
ownerUuid = compound.getString("OwnerUUID");
|
||||
}/* else {
|
||||
String var2 = compound.getString("Owner");
|
||||
ownerUuid = NameReferencingFileConverter.a(this.getMinecraftServer(), var2);
|
||||
}*/
|
||||
}
|
||||
|
||||
if (!ownerUuid.isEmpty()) {
|
||||
try {
|
||||
|
@ -206,7 +203,9 @@ public class EntityTamableFox extends EntityFox {
|
|||
this.goalSit.setSitting(compound.getBoolean("Sitting"));
|
||||
}
|
||||
|
||||
this.setSitting(compound.getBoolean("Sitting"));
|
||||
if (!this.isTamed()) {
|
||||
goalSit.setSitting(false);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isTamed() {
|
||||
|
|
|
@ -48,6 +48,8 @@ public class FoxPathfinderGoalSit extends PathfinderGoal {
|
|||
this.entity.setSitting(false);
|
||||
}
|
||||
|
||||
public boolean isWillSit() { return this.willSit; }
|
||||
|
||||
public void setSitting(boolean flag) {
|
||||
this.willSit = flag;
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ public class EntityTamableFox extends EntityFox {
|
|||
compound.setString("OwnerUUID", this.getOwnerUUID().toString());
|
||||
}
|
||||
|
||||
compound.setBoolean("Sitting", this.isSitting());
|
||||
compound.setBoolean("Sitting", this.goalSit.isWillSit());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -188,10 +188,7 @@ public class EntityTamableFox extends EntityFox {
|
|||
|
||||
if (compound.hasKeyOfType("OwnerUUID", 8)) {
|
||||
ownerUuid = compound.getString("OwnerUUID");
|
||||
}/* else {
|
||||
String var2 = compound.getString("Owner");
|
||||
ownerUuid = NameReferencingFileConverter.a(this.getMinecraftServer(), var2);
|
||||
}*/
|
||||
}
|
||||
|
||||
if (!ownerUuid.isEmpty()) {
|
||||
try {
|
||||
|
@ -206,7 +203,9 @@ public class EntityTamableFox extends EntityFox {
|
|||
this.goalSit.setSitting(compound.getBoolean("Sitting"));
|
||||
}
|
||||
|
||||
this.setSitting(compound.getBoolean("Sitting"));
|
||||
if (!this.isTamed()) {
|
||||
goalSit.setSitting(false);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isTamed() {
|
||||
|
|
|
@ -48,6 +48,10 @@ public class FoxPathfinderGoalSit extends PathfinderGoal {
|
|||
this.entity.setSitting(false);
|
||||
}
|
||||
|
||||
public boolean isWillSit() {
|
||||
return this.willSit;
|
||||
}
|
||||
|
||||
public void setSitting(boolean flag) {
|
||||
this.willSit = flag;
|
||||
}
|
||||
|
|
|
@ -231,7 +231,7 @@ public class EntityTamableFox extends EntityFox {
|
|||
compound.setString("OwnerUUID", this.getOwnerUUID().toString());
|
||||
}
|
||||
|
||||
compound.setBoolean("Sitting", this.isSitting());
|
||||
compound.setBoolean("Sitting", this.goalSit.isWillSit());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -241,10 +241,7 @@ public class EntityTamableFox extends EntityFox {
|
|||
|
||||
if (compound.hasKeyOfType("OwnerUUID", 8)) {
|
||||
ownerUuid = compound.getString("OwnerUUID");
|
||||
}/* else {
|
||||
String var2 = compound.getString("Owner");
|
||||
ownerUuid = NameReferencingFileConverter.a(this.getMinecraftServer(), var2);
|
||||
}*/
|
||||
}
|
||||
|
||||
if (!ownerUuid.isEmpty()) {
|
||||
try {
|
||||
|
@ -259,7 +256,9 @@ public class EntityTamableFox extends EntityFox {
|
|||
this.goalSit.setSitting(compound.getBoolean("Sitting"));
|
||||
}
|
||||
|
||||
this.setSitting(compound.getBoolean("Sitting"));
|
||||
if (!this.isTamed()) {
|
||||
goalSit.setSitting(false);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isTamed() {
|
||||
|
|
|
@ -40,12 +40,10 @@ public class FoxPathfinderGoalSit extends PathfinderGoal {
|
|||
}
|
||||
|
||||
public void c() {
|
||||
this.entity.getNavigation().o();
|
||||
this.entity.setGoalTarget(null);
|
||||
|
||||
// For some reason it needs to be ran later to not have the fox slide across the floor.
|
||||
Bukkit.getScheduler().runTaskLater(Utils.tamableFoxesPlugin, () -> {
|
||||
this.entity.setSitting(true);
|
||||
this.entity.getNavigation().o();
|
||||
}, 1L);
|
||||
}
|
||||
|
||||
|
@ -53,6 +51,8 @@ public class FoxPathfinderGoalSit extends PathfinderGoal {
|
|||
this.entity.setSitting(false);
|
||||
}
|
||||
|
||||
public boolean isWillSit() { return this.willSit; }
|
||||
|
||||
public void setSitting(boolean flag) {
|
||||
this.willSit = flag;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue