forked from SteamWar/SteamWar
Hotfix REntityServer for 1.15 or earlier
This commit is contained in:
@@ -50,11 +50,11 @@ public class REntityServer implements Listener {
|
||||
private static final Class<?> useEntity = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundInteractPacket");
|
||||
private static final Reflection.Field<Integer> useEntityTarget = Reflection.getField(useEntity, int.class, 0);
|
||||
private static final Class<?> useEntityEnumAction = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundInteractPacket$Action");
|
||||
private static final Class<?> useEntityEnumActionType = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundInteractPacket$ActionType");
|
||||
private static final Reflection.Field<?> useEntityAction = Reflection.getField(useEntity, useEntityEnumAction, 0);
|
||||
private static final Function<Object, Integer> getEntityAction;
|
||||
static {
|
||||
if(Core.getVersion() > 15) {
|
||||
Class<?> useEntityEnumActionType = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundInteractPacket$ActionType");
|
||||
Reflection.Method useEntityGetAction = Reflection.getTypedMethod(useEntityEnumAction, null, useEntityEnumActionType);
|
||||
getEntityAction = value -> ((Enum<?>) useEntityGetAction.invoke(value)).ordinal();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user