diff --git a/1_14_R1/pom.xml b/1_14_R1/pom.xml index 107ae1d..853485e 100644 --- a/1_14_R1/pom.xml +++ b/1_14_R1/pom.xml @@ -7,7 +7,7 @@ tamablefoxes-parent net.seanomik - 2.2.1-SNAPSHOT + 2.2.2-SNAPSHOT tamablefoxes_v1_14_R1 diff --git a/1_15_R1/pom.xml b/1_15_R1/pom.xml index 50f9b5f..f7022fa 100644 --- a/1_15_R1/pom.xml +++ b/1_15_R1/pom.xml @@ -7,7 +7,7 @@ tamablefoxes-parent net.seanomik - 2.2.1-SNAPSHOT + 2.2.2-SNAPSHOT tamablefoxes_v1_15_R1 diff --git a/1_16_R1/pom.xml b/1_16_R1/pom.xml index 69c94b3..d7cbaf8 100644 --- a/1_16_R1/pom.xml +++ b/1_16_R1/pom.xml @@ -7,7 +7,7 @@ tamablefoxes-parent net.seanomik - 2.2.1-SNAPSHOT + 2.2.2-SNAPSHOT tamablefoxes_v1_16_R1 diff --git a/1_16_R2/pom.xml b/1_16_R2/pom.xml index 7b7e304..6a16117 100644 --- a/1_16_R2/pom.xml +++ b/1_16_R2/pom.xml @@ -7,7 +7,7 @@ tamablefoxes-parent net.seanomik - 2.2.1-SNAPSHOT + 2.2.2-SNAPSHOT tamablefoxes_v1_16_R2 diff --git a/1_16_R3/pom.xml b/1_16_R3/pom.xml index b677a14..14d3302 100644 --- a/1_16_R3/pom.xml +++ b/1_16_R3/pom.xml @@ -7,7 +7,7 @@ net.seanomik tamablefoxes-parent - 2.2.1-SNAPSHOT + 2.2.2-SNAPSHOT tamablefoxes_v1_16_R3 diff --git a/1_17_1_R1/pom.xml b/1_17_1_R1/pom.xml index 53369d7..8db3a7b 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.1-SNAPSHOT + 2.2.2-SNAPSHOT diff --git a/1_17_R1/pom.xml b/1_17_R1/pom.xml index 4eb1814..5a101be 100644 --- a/1_17_R1/pom.xml +++ b/1_17_R1/pom.xml @@ -7,7 +7,7 @@ net.seanomik tamablefoxes-parent - 2.2.1-SNAPSHOT + 2.2.2-SNAPSHOT diff --git a/1_18_1_R1/pom.xml b/1_18_1_R1/pom.xml index 04fa6aa..2109084 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.1-SNAPSHOT + 2.2.2-SNAPSHOT diff --git a/1_18_1_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_18_1_R1/EntityTamableFox.java b/1_18_1_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_18_1_R1/EntityTamableFox.java index 064e97d..51cf1ef 100644 --- a/1_18_1_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_18_1_R1/EntityTamableFox.java +++ b/1_18_1_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_18_1_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/1_18_R1/pom.xml b/1_18_R1/pom.xml index da5a295..bc6aebd 100644 --- a/1_18_R1/pom.xml +++ b/1_18_R1/pom.xml @@ -7,7 +7,7 @@ net.seanomik tamablefoxes-parent - 2.2.1-SNAPSHOT + 2.2.2-SNAPSHOT diff --git a/Plugin/pom.xml b/Plugin/pom.xml index 234091a..3ebc67c 100644 --- a/Plugin/pom.xml +++ b/Plugin/pom.xml @@ -7,7 +7,7 @@ net.seanomik tamablefoxes-parent - 2.2.1-SNAPSHOT + 2.2.2-SNAPSHOT tamablefoxes diff --git a/Utility/pom.xml b/Utility/pom.xml index 0a66a0e..a112179 100644 --- a/Utility/pom.xml +++ b/Utility/pom.xml @@ -7,7 +7,7 @@ net.seanomik tamablefoxes-parent - 2.2.1-SNAPSHOT + 2.2.2-SNAPSHOT tamablefoxes-util diff --git a/pom.xml b/pom.xml index dbdce17..963efd5 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.seanomik tamablefoxes-parent - 2.2.1-SNAPSHOT + 2.2.2-SNAPSHOT pom