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