diff --git a/1_14_R1/pom.xml b/1_14_R1/pom.xml
index 853485e..3e5b634 100644
--- a/1_14_R1/pom.xml
+++ b/1_14_R1/pom.xml
@@ -7,7 +7,7 @@
tamablefoxes-parent
net.seanomik
- 2.2.2-SNAPSHOT
+ 2.2.3-SNAPSHOT
tamablefoxes_v1_14_R1
diff --git a/1_15_R1/pom.xml b/1_15_R1/pom.xml
index f7022fa..6b623ac 100644
--- a/1_15_R1/pom.xml
+++ b/1_15_R1/pom.xml
@@ -7,7 +7,7 @@
tamablefoxes-parent
net.seanomik
- 2.2.2-SNAPSHOT
+ 2.2.3-SNAPSHOT
tamablefoxes_v1_15_R1
diff --git a/1_16_R1/pom.xml b/1_16_R1/pom.xml
index d7cbaf8..f9d2d9a 100644
--- a/1_16_R1/pom.xml
+++ b/1_16_R1/pom.xml
@@ -7,7 +7,7 @@
tamablefoxes-parent
net.seanomik
- 2.2.2-SNAPSHOT
+ 2.2.3-SNAPSHOT
tamablefoxes_v1_16_R1
diff --git a/1_16_R2/pom.xml b/1_16_R2/pom.xml
index 6a16117..5ea5c95 100644
--- a/1_16_R2/pom.xml
+++ b/1_16_R2/pom.xml
@@ -7,7 +7,7 @@
tamablefoxes-parent
net.seanomik
- 2.2.2-SNAPSHOT
+ 2.2.3-SNAPSHOT
tamablefoxes_v1_16_R2
diff --git a/1_16_R3/pom.xml b/1_16_R3/pom.xml
index 14d3302..e71a7d2 100644
--- a/1_16_R3/pom.xml
+++ b/1_16_R3/pom.xml
@@ -7,7 +7,7 @@
net.seanomik
tamablefoxes-parent
- 2.2.2-SNAPSHOT
+ 2.2.3-SNAPSHOT
tamablefoxes_v1_16_R3
diff --git a/1_17_1_R1/pom.xml b/1_17_1_R1/pom.xml
index 8db3a7b..5d10176 100644
--- a/1_17_1_R1/pom.xml
+++ b/1_17_1_R1/pom.xml
@@ -7,7 +7,7 @@
net.seanomik
tamablefoxes-parent
- 2.2.2-SNAPSHOT
+ 2.2.3-SNAPSHOT
diff --git a/1_17_R1/pom.xml b/1_17_R1/pom.xml
index 5a101be..c16535c 100644
--- a/1_17_R1/pom.xml
+++ b/1_17_R1/pom.xml
@@ -7,7 +7,7 @@
net.seanomik
tamablefoxes-parent
- 2.2.2-SNAPSHOT
+ 2.2.3-SNAPSHOT
diff --git a/1_18_1_R1/pom.xml b/1_18_1_R1/pom.xml
index 2109084..904018e 100644
--- a/1_18_1_R1/pom.xml
+++ b/1_18_1_R1/pom.xml
@@ -7,7 +7,7 @@
net.seanomik
tamablefoxes-parent
- 2.2.2-SNAPSHOT
+ 2.2.3-SNAPSHOT
diff --git a/1_18_R1/pom.xml b/1_18_R1/pom.xml
index bc6aebd..cab6597 100644
--- a/1_18_R1/pom.xml
+++ b/1_18_R1/pom.xml
@@ -7,7 +7,7 @@
net.seanomik
tamablefoxes-parent
- 2.2.2-SNAPSHOT
+ 2.2.3-SNAPSHOT
diff --git a/1_18_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_18_R1/EntityTamableFox.java b/1_18_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_18_R1/EntityTamableFox.java
index 400d130..2c67ecd 100644
--- a/1_18_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_18_R1/EntityTamableFox.java
+++ b/1_18_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_18_R1/EntityTamableFox.java
@@ -170,31 +170,49 @@ public class EntityTamableFox extends Fox {
}
}
- public boolean isDefending() {
+ protected EntityDataAccessor getDataFlagsId() throws NoSuchFieldException, IllegalAccessException {
+ Field dataFlagsField = Fox.class.getDeclaredField("cb"); // DATA_FLAGS_ID
+ dataFlagsField.setAccessible(true);
+ EntityDataAccessor dataFlagsId = (EntityDataAccessor) dataFlagsField.get(null);
+ dataFlagsField.setAccessible(false);
+
+ return dataFlagsId;
+ }
+
+ protected boolean getFlag(int i) {
try {
- Method method = Fox.class.getDeclaredMethod("fL"); // isDefending
- method.setAccessible(true);
- boolean defending = (boolean) method.invoke((Fox) this);
- method.setAccessible(false);
- return defending;
- } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
+ EntityDataAccessor dataFlagsId = getDataFlagsId();
+
+ return ((Byte)super.entityData.get(dataFlagsId) & i) != 0;
+ } catch (IllegalAccessException | NoSuchFieldException e) {
e.printStackTrace();
}
return false;
}
- public void setDefending(boolean defending) {
+ protected void setFlag(int i, boolean flag) {
try {
- Method method = Fox.class.getDeclaredMethod("A", boolean.class); // setDefending
- method.setAccessible(true);
- method.invoke((Fox) this, defending);
- method.setAccessible(false);
- } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
+ EntityDataAccessor dataFlagsId = getDataFlagsId();
+
+ if (flag) {
+ this.entityData.set(dataFlagsId, (byte)((Byte)this.entityData.get(dataFlagsId) | i));
+ } else {
+ this.entityData.set(dataFlagsId, (byte)((Byte)this.entityData.get(dataFlagsId) & ~i));
+ }
+ } catch (IllegalAccessException | NoSuchFieldException e) {
e.printStackTrace();
}
}
+ public boolean isDefending() {
+ return getFlag(128);
+ }
+
+ public void setDefending(boolean defending) {
+ setFlag(128, defending);
+ }
+
@Override
protected void defineSynchedData() {
super.defineSynchedData();
diff --git a/Plugin/pom.xml b/Plugin/pom.xml
index 3ebc67c..92dbac9 100644
--- a/Plugin/pom.xml
+++ b/Plugin/pom.xml
@@ -7,7 +7,7 @@
net.seanomik
tamablefoxes-parent
- 2.2.2-SNAPSHOT
+ 2.2.3-SNAPSHOT
tamablefoxes
diff --git a/Utility/pom.xml b/Utility/pom.xml
index a112179..132c50e 100644
--- a/Utility/pom.xml
+++ b/Utility/pom.xml
@@ -7,7 +7,7 @@
net.seanomik
tamablefoxes-parent
- 2.2.2-SNAPSHOT
+ 2.2.3-SNAPSHOT
tamablefoxes-util
diff --git a/pom.xml b/pom.xml
index 963efd5..d2db3fb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
net.seanomik
tamablefoxes-parent
- 2.2.2-SNAPSHOT
+ 2.2.3-SNAPSHOT
pom