Fix for 1.18 paper
This commit is contained in:
parent
ee8df0c2b3
commit
5bcfc5cc7f
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>tamablefoxes-parent</artifactId>
|
<artifactId>tamablefoxes-parent</artifactId>
|
||||||
<groupId>net.seanomik</groupId>
|
<groupId>net.seanomik</groupId>
|
||||||
<version>2.2.2-SNAPSHOT</version>
|
<version>2.2.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>tamablefoxes_v1_14_R1</artifactId>
|
<artifactId>tamablefoxes_v1_14_R1</artifactId>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>tamablefoxes-parent</artifactId>
|
<artifactId>tamablefoxes-parent</artifactId>
|
||||||
<groupId>net.seanomik</groupId>
|
<groupId>net.seanomik</groupId>
|
||||||
<version>2.2.2-SNAPSHOT</version>
|
<version>2.2.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>tamablefoxes_v1_15_R1</artifactId>
|
<artifactId>tamablefoxes_v1_15_R1</artifactId>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>tamablefoxes-parent</artifactId>
|
<artifactId>tamablefoxes-parent</artifactId>
|
||||||
<groupId>net.seanomik</groupId>
|
<groupId>net.seanomik</groupId>
|
||||||
<version>2.2.2-SNAPSHOT</version>
|
<version>2.2.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>tamablefoxes_v1_16_R1</artifactId>
|
<artifactId>tamablefoxes_v1_16_R1</artifactId>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>tamablefoxes-parent</artifactId>
|
<artifactId>tamablefoxes-parent</artifactId>
|
||||||
<groupId>net.seanomik</groupId>
|
<groupId>net.seanomik</groupId>
|
||||||
<version>2.2.2-SNAPSHOT</version>
|
<version>2.2.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>tamablefoxes_v1_16_R2</artifactId>
|
<artifactId>tamablefoxes_v1_16_R2</artifactId>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.seanomik</groupId>
|
<groupId>net.seanomik</groupId>
|
||||||
<artifactId>tamablefoxes-parent</artifactId>
|
<artifactId>tamablefoxes-parent</artifactId>
|
||||||
<version>2.2.2-SNAPSHOT</version>
|
<version>2.2.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>tamablefoxes_v1_16_R3</artifactId>
|
<artifactId>tamablefoxes_v1_16_R3</artifactId>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.seanomik</groupId>
|
<groupId>net.seanomik</groupId>
|
||||||
<artifactId>tamablefoxes-parent</artifactId>
|
<artifactId>tamablefoxes-parent</artifactId>
|
||||||
<version>2.2.2-SNAPSHOT</version>
|
<version>2.2.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.seanomik</groupId>
|
<groupId>net.seanomik</groupId>
|
||||||
<artifactId>tamablefoxes-parent</artifactId>
|
<artifactId>tamablefoxes-parent</artifactId>
|
||||||
<version>2.2.2-SNAPSHOT</version>
|
<version>2.2.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.seanomik</groupId>
|
<groupId>net.seanomik</groupId>
|
||||||
<artifactId>tamablefoxes-parent</artifactId>
|
<artifactId>tamablefoxes-parent</artifactId>
|
||||||
<version>2.2.2-SNAPSHOT</version>
|
<version>2.2.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.seanomik</groupId>
|
<groupId>net.seanomik</groupId>
|
||||||
<artifactId>tamablefoxes-parent</artifactId>
|
<artifactId>tamablefoxes-parent</artifactId>
|
||||||
<version>2.2.2-SNAPSHOT</version>
|
<version>2.2.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -170,31 +170,49 @@ public class EntityTamableFox extends Fox {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDefending() {
|
protected EntityDataAccessor<Byte> getDataFlagsId() throws NoSuchFieldException, IllegalAccessException {
|
||||||
|
Field dataFlagsField = Fox.class.getDeclaredField("cb"); // DATA_FLAGS_ID
|
||||||
|
dataFlagsField.setAccessible(true);
|
||||||
|
EntityDataAccessor<Byte> dataFlagsId = (EntityDataAccessor<Byte>) dataFlagsField.get(null);
|
||||||
|
dataFlagsField.setAccessible(false);
|
||||||
|
|
||||||
|
return dataFlagsId;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean getFlag(int i) {
|
||||||
try {
|
try {
|
||||||
Method method = Fox.class.getDeclaredMethod("fL"); // isDefending
|
EntityDataAccessor<Byte> dataFlagsId = getDataFlagsId();
|
||||||
method.setAccessible(true);
|
|
||||||
boolean defending = (boolean) method.invoke((Fox) this);
|
return ((Byte)super.entityData.get(dataFlagsId) & i) != 0;
|
||||||
method.setAccessible(false);
|
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||||
return defending;
|
|
||||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefending(boolean defending) {
|
protected void setFlag(int i, boolean flag) {
|
||||||
try {
|
try {
|
||||||
Method method = Fox.class.getDeclaredMethod("A", boolean.class); // setDefending
|
EntityDataAccessor<Byte> dataFlagsId = getDataFlagsId();
|
||||||
method.setAccessible(true);
|
|
||||||
method.invoke((Fox) this, defending);
|
if (flag) {
|
||||||
method.setAccessible(false);
|
this.entityData.set(dataFlagsId, (byte)((Byte)this.entityData.get(dataFlagsId) | i));
|
||||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
} else {
|
||||||
|
this.entityData.set(dataFlagsId, (byte)((Byte)this.entityData.get(dataFlagsId) & ~i));
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isDefending() {
|
||||||
|
return getFlag(128);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefending(boolean defending) {
|
||||||
|
setFlag(128, defending);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void defineSynchedData() {
|
protected void defineSynchedData() {
|
||||||
super.defineSynchedData();
|
super.defineSynchedData();
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.seanomik</groupId>
|
<groupId>net.seanomik</groupId>
|
||||||
<artifactId>tamablefoxes-parent</artifactId>
|
<artifactId>tamablefoxes-parent</artifactId>
|
||||||
<version>2.2.2-SNAPSHOT</version>
|
<version>2.2.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>tamablefoxes</artifactId>
|
<artifactId>tamablefoxes</artifactId>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.seanomik</groupId>
|
<groupId>net.seanomik</groupId>
|
||||||
<artifactId>tamablefoxes-parent</artifactId>
|
<artifactId>tamablefoxes-parent</artifactId>
|
||||||
<version>2.2.2-SNAPSHOT</version>
|
<version>2.2.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>tamablefoxes-util</artifactId>
|
<artifactId>tamablefoxes-util</artifactId>
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<groupId>net.seanomik</groupId>
|
<groupId>net.seanomik</groupId>
|
||||||
<artifactId>tamablefoxes-parent</artifactId>
|
<artifactId>tamablefoxes-parent</artifactId>
|
||||||
<version>2.2.2-SNAPSHOT</version>
|
<version>2.2.3-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
|
Loading…
Reference in New Issue