Compare commits

...
5 Commits
Author SHA1 Message Date
purplexdev 2916fb7112 Version updated to 1.3.7.2 2020-06-27 08:10:58 +02:00
purplexdev 1ca1a960b5 1.3.7.1 release! 2020-06-27 08:05:10 +02:00
retrooper 6c6a1c9465 1.3.7.1 as packetwrapper entityaction bugs fixed
Thr entity-action wrapper should work now, it has only been tested on 1.8.8, should work on 1.8+ for sure but not tested 1.7.10 but should work too :)
2020-06-26 23:28:03 +02:00
retrooper 0be7a21bab second attempt on fixing entity action wrapper 2020-06-26 22:48:03 +02:00
retrooper ca51988694 attempt on bug fix 2020-06-26 22:33:21 +02:00
2 changed files with 18 additions and 19 deletions

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>io.github.retrooper</groupId>
<artifactId>packetevents</artifactId>
<version>1.3.7</version>
<version>1.3.7.2</version>
<packaging>jar</packaging>
<name>packetevents</name>
<properties>
@@ -12,9 +12,6 @@ public final class WrappedPacketInEntityAction extends WrappedPacket {
private static Class<?> entityActionClass;
@Nullable
private static Class<?> enumPlayerActionClass;
@Nullable
private static Object[] enumPlayerActionConstants;
static {
try {
entityActionClass = NMSUtils.getNMSClass("PacketPlayInEntityAction");
@@ -25,7 +22,10 @@ public final class WrappedPacketInEntityAction extends WrappedPacket {
break;
}
}
}
}
else {
enumPlayerActionClass = NMSUtils.getNMSClass("EnumPlayerAction");
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
@@ -44,7 +44,13 @@ public final class WrappedPacketInEntityAction extends WrappedPacket {
protected void setup() {
try {
final int entityId = Reflection.getField(entityActionClass, int.class, 0).getInt(packet);
final int jumpBoost = Reflection.getField(entityActionClass, int.class, 2).getInt(packet);
final int jumpBoost;
if(version.isLowerThan(ServerVersion.v_1_8)) {
jumpBoost = Reflection.getField(entityActionClass, int.class, 2).getInt(packet);
}
else {
jumpBoost = Reflection.getField(entityActionClass, int.class, 1).getInt(packet);
}
int animationIndex = -1;
@@ -52,24 +58,17 @@ public final class WrappedPacketInEntityAction extends WrappedPacket {
if (version.isLowerThan(ServerVersion.v_1_8)) {
animationIndex = Reflection.getField(entityActionClass, int.class, 1).getInt(packet);
} else {
final Object enumObj = Reflection.getField(entityActionClass, enumPlayerActionClass, 0);
final Object[] enumValues = enumPlayerActionConstants;
final int len = enumValues.length;
for (int i = 0; i < len; i++) {
final Object val = enumValues[i];
if (val.toString().equals(enumObj.toString())) {
animationIndex = i;
break;
}
}
final Object enumObj = Reflection.getField(entityActionClass, enumPlayerActionClass, 0).get(packet);
this.action = PlayerAction.valueOf(enumObj.toString());
}
this.entityId = entityId;
this.jumpBoost = jumpBoost;
this.action = PlayerAction.get(animationIndex);
if(animationIndex != -1) {
this.action = PlayerAction.get(animationIndex);
}
this.entity = NMSUtils.getEntityById(this.entityId);
} catch (IllegalAccessException e) {
e.printStackTrace();