mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-30 20:39:10 +00:00
perf(entity): 最终的优化
- 已测试 1.20.1 1.20.4 1.21.4
This commit is contained in:
@@ -366,8 +366,8 @@ public class BukkitFurniture implements Furniture {
|
||||
try {
|
||||
Object trackedEntity = FastNMS.INSTANCE.field$Entity$trackedEntity(nmsEntity);
|
||||
Object serverEntity = FastNMS.INSTANCE.filed$ChunkMap$TrackedEntity$serverEntity(trackedEntity);
|
||||
CoreReflections.handle$ServerEntity$broadcastSetter.invoke(serverEntity, Handlers.DO_NOTHING);
|
||||
CoreReflections.handle$ServerEntity$updateIntervalSetter.invoke(serverEntity, Integer.MAX_VALUE);
|
||||
CoreReflections.handle$ServerEntity$broadcastSetter.invokeExact(serverEntity, Handlers.DO_NOTHING);
|
||||
CoreReflections.handle$ServerEntity$updateIntervalSetter.invokeExact(serverEntity, Integer.MAX_VALUE);
|
||||
} catch (Throwable e) {
|
||||
CraftEngine.instance().logger().warn("Failed to inject collider", e);
|
||||
}
|
||||
@@ -375,7 +375,7 @@ public class BukkitFurniture implements Furniture {
|
||||
|
||||
@FunctionalInterface
|
||||
public interface Handlers extends Consumer<Object> {
|
||||
Handlers DO_NOTHING = doNothing();
|
||||
Consumer<Object> DO_NOTHING = doNothing();
|
||||
|
||||
static Handlers doNothing() {
|
||||
return (packet) -> {};
|
||||
|
||||
@@ -1169,14 +1169,14 @@ public class PacketConsumers {
|
||||
public static final TriConsumer<NetWorkUser, NMSPacketEvent, Object> HELLO_C2S = (user, event, packet) -> {
|
||||
try {
|
||||
BukkitServerPlayer player = (BukkitServerPlayer) user;
|
||||
String name = (String) NetworkReflections.handle$ServerboundHelloPacket$nameGetter.invoke(packet);
|
||||
String name = (String) NetworkReflections.handle$ServerboundHelloPacket$nameGetter.invokeExact(packet);
|
||||
player.setName(name);
|
||||
if (VersionHelper.isOrAbove1_20_2()) {
|
||||
UUID uuid = (UUID) NetworkReflections.handle$ServerboundHelloPacket$uuidGetter.invoke(packet);
|
||||
UUID uuid = (UUID) NetworkReflections.handle$ServerboundHelloPacket$uuidGetter.invokeExact(packet);
|
||||
player.setUUID(uuid);
|
||||
} else {
|
||||
@SuppressWarnings("unchecked")
|
||||
Optional<UUID> uuid = (Optional<UUID>) NetworkReflections.handle$ServerboundHelloPacket$uuidGetter.invoke(packet);
|
||||
Optional<UUID> uuid = (Optional<UUID>) NetworkReflections.handle$ServerboundHelloPacket$uuidGetter.invokeExact(packet);
|
||||
if (uuid.isPresent()) {
|
||||
player.setUUID(uuid.get());
|
||||
} else {
|
||||
@@ -1220,10 +1220,10 @@ public class PacketConsumers {
|
||||
player.clearView();
|
||||
Object dimensionKey;
|
||||
if (!VersionHelper.isOrAbove1_20_2()) {
|
||||
dimensionKey = NetworkReflections.handle$ClientboundRespawnPacket$dimensionGetter.invoke(packet);
|
||||
dimensionKey = NetworkReflections.handle$ClientboundRespawnPacket$dimensionGetter.invokeExact(packet);
|
||||
} else {
|
||||
Object commonInfo = NetworkReflections.handle$ClientboundRespawnPacket$commonPlayerSpawnInfoGetter.invoke(packet);
|
||||
dimensionKey = NetworkReflections.handle$CommonPlayerSpawnInfo$dimensionGetter.invoke(commonInfo);
|
||||
Object commonInfo = NetworkReflections.handle$ClientboundRespawnPacket$commonPlayerSpawnInfoGetter.invokeExact(packet);
|
||||
dimensionKey = NetworkReflections.handle$CommonPlayerSpawnInfo$dimensionGetter.invokeExact(commonInfo);
|
||||
}
|
||||
Object location = FastNMS.INSTANCE.field$ResourceKey$location(dimensionKey);
|
||||
World world = Bukkit.getWorld(Objects.requireNonNull(NamespacedKey.fromString(location.toString())));
|
||||
@@ -1248,10 +1248,10 @@ public class PacketConsumers {
|
||||
if (BukkitNetworkManager.hasViaVersion()) {
|
||||
user.setProtocolVersion(CraftEngine.instance().compatibilityManager().getPlayerProtocolVersion(player.uuid()));
|
||||
}
|
||||
dimensionKey = NetworkReflections.handle$ClientboundLoginPacket$dimensionGetter.invoke(packet);
|
||||
dimensionKey = NetworkReflections.handle$ClientboundLoginPacket$dimensionGetter.invokeExact(packet);
|
||||
} else {
|
||||
Object commonInfo = NetworkReflections.handle$ClientboundLoginPacket$commonPlayerSpawnInfoGetter.invoke(packet);
|
||||
dimensionKey = NetworkReflections.handle$CommonPlayerSpawnInfo$dimensionGetter.invoke(commonInfo);
|
||||
Object commonInfo = NetworkReflections.handle$ClientboundLoginPacket$commonPlayerSpawnInfoGetter.invokeExact(packet);
|
||||
dimensionKey = NetworkReflections.handle$CommonPlayerSpawnInfo$dimensionGetter.invokeExact(commonInfo);
|
||||
}
|
||||
Object location = FastNMS.INSTANCE.field$ResourceKey$location(dimensionKey);
|
||||
World world = Bukkit.getWorld(Objects.requireNonNull(NamespacedKey.fromString(location.toString())));
|
||||
@@ -1295,9 +1295,9 @@ public class PacketConsumers {
|
||||
Player bukkitPlayer = player.platformPlayer();
|
||||
if (bukkitPlayer == null) return;
|
||||
if (bukkitPlayer.getGameMode() != GameMode.CREATIVE) return;
|
||||
int slot = (int) NetworkReflections.handle$ServerboundSetCreativeModeSlotPacket$slotNumGetter.invoke(packet);
|
||||
int slot = VersionHelper.isOrAbove1_20_5() ? (short) NetworkReflections.handle$ServerboundSetCreativeModeSlotPacket$slotNumGetter.invokeExact(packet) : (int) NetworkReflections.handle$ServerboundSetCreativeModeSlotPacket$slotNumGetter.invokeExact(packet);
|
||||
if (slot < 36 || slot > 44) return;
|
||||
ItemStack item = FastNMS.INSTANCE.method$CraftItemStack$asCraftMirror(NetworkReflections.handle$ServerboundSetCreativeModeSlotPacket$itemStackGetter.invoke(packet));
|
||||
ItemStack item = FastNMS.INSTANCE.method$CraftItemStack$asCraftMirror(NetworkReflections.handle$ServerboundSetCreativeModeSlotPacket$itemStackGetter.invokeExact(packet));
|
||||
if (ItemUtils.isEmpty(item)) return;
|
||||
if (slot - 36 != bukkitPlayer.getInventory().getHeldItemSlot()) {
|
||||
return;
|
||||
@@ -1370,7 +1370,7 @@ public class PacketConsumers {
|
||||
if (!user.isOnline()) return;
|
||||
Player player = (Player) user.platformPlayer();
|
||||
if (player == null) return;
|
||||
Object pos = NetworkReflections.handle$ServerboundPickItemFromBlockPacket$posGetter.invoke(packet);
|
||||
Object pos = NetworkReflections.handle$ServerboundPickItemFromBlockPacket$posGetter.invokeExact(packet);
|
||||
if (VersionHelper.isFolia()) {
|
||||
int x = FastNMS.INSTANCE.field$Vec3i$x(pos);
|
||||
int z = FastNMS.INSTANCE.field$Vec3i$z(pos);
|
||||
@@ -1408,7 +1408,7 @@ public class PacketConsumers {
|
||||
// 1.21.4+
|
||||
public static final TriConsumer<NetWorkUser, NMSPacketEvent, Object> PICK_ITEM_FROM_ENTITY = (user, event, packet) -> {
|
||||
try {
|
||||
int entityId = (int) NetworkReflections.handle$ServerboundPickItemFromEntityPacket$idGetter.invoke(packet);
|
||||
int entityId = (int) NetworkReflections.handle$ServerboundPickItemFromEntityPacket$idGetter.invokeExact(packet);
|
||||
BukkitFurniture furniture = BukkitFurnitureManager.instance().loadedFurnitureByEntityId(entityId);
|
||||
if (furniture == null) return;
|
||||
Player player = (Player) user.platformPlayer();
|
||||
@@ -1450,11 +1450,11 @@ public class PacketConsumers {
|
||||
assert CoreReflections.method$ServerGamePacketListenerImpl$tryPickItem != null;
|
||||
if (VersionHelper.isOrAbove1_21_5()) {
|
||||
CoreReflections.method$ServerGamePacketListenerImpl$tryPickItem.invoke(
|
||||
CoreReflections.handle$ServerPlayer$connectionGetter.invoke(FastNMS.INSTANCE.method$CraftPlayer$getHandle(player)),
|
||||
CoreReflections.handle$ServerPlayer$connectionGetter.invokeExact(FastNMS.INSTANCE.method$CraftPlayer$getHandle(player)),
|
||||
FastNMS.INSTANCE.method$CraftItemStack$asNMSCopy(itemStack), blockPos, entity, true);
|
||||
} else {
|
||||
CoreReflections.method$ServerGamePacketListenerImpl$tryPickItem.invoke(
|
||||
CoreReflections.handle$ServerPlayer$connectionGetter.invoke(FastNMS.INSTANCE.method$CraftPlayer$getHandle(player)), FastNMS.INSTANCE.method$CraftItemStack$asNMSCopy(itemStack));
|
||||
CoreReflections.handle$ServerPlayer$connectionGetter.invokeExact(FastNMS.INSTANCE.method$CraftPlayer$getHandle(player)), FastNMS.INSTANCE.method$CraftItemStack$asNMSCopy(itemStack));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1519,7 +1519,7 @@ public class PacketConsumers {
|
||||
}
|
||||
BukkitFurniture furniture = BukkitFurnitureManager.instance().loadedFurnitureByEntityId(entityId);
|
||||
if (furniture == null) return;
|
||||
Object action = NetworkReflections.handle$ServerboundInteractPacket$actionGetter.invoke(packet);
|
||||
Object action = NetworkReflections.handle$ServerboundInteractPacket$actionGetter.invokeExact(packet);
|
||||
Object actionType = NetworkReflections.method$ServerboundInteractPacket$Action$getType.invoke(action);
|
||||
if (actionType == null) return;
|
||||
Location location = furniture.baseEntity().getLocation();
|
||||
@@ -1552,9 +1552,9 @@ public class PacketConsumers {
|
||||
InteractionHand hand;
|
||||
Location interactionPoint;
|
||||
try {
|
||||
Object interactionHand = NetworkReflections.handle$ServerboundInteractPacket$InteractionAtLocationAction$handGetter.invoke(action);
|
||||
Object interactionHand = NetworkReflections.handle$ServerboundInteractPacket$InteractionAtLocationAction$handGetter.invokeExact(action);
|
||||
hand = interactionHand == CoreReflections.instance$InteractionHand$MAIN_HAND ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND;
|
||||
Object vec3 = NetworkReflections.handle$ServerboundInteractPacket$InteractionAtLocationAction$locationGetter.invoke(action);
|
||||
Object vec3 = NetworkReflections.handle$ServerboundInteractPacket$InteractionAtLocationAction$locationGetter.invokeExact(action);
|
||||
|
||||
double x = FastNMS.INSTANCE.field$Vec3$x(vec3);
|
||||
double y = FastNMS.INSTANCE.field$Vec3$y(vec3);
|
||||
@@ -1696,14 +1696,14 @@ public class PacketConsumers {
|
||||
if (((BukkitServerPlayer) user).hasPermission(FontManager.BYPASS_ANVIL)) {
|
||||
return;
|
||||
}
|
||||
String message = (String) NetworkReflections.handle$ServerboundRenameItemPacket$nameGetter.invoke(packet);
|
||||
String message = (String) NetworkReflections.handle$ServerboundRenameItemPacket$nameGetter.invokeExact(packet);
|
||||
if (message != null && !message.isEmpty()) {
|
||||
// check bypass
|
||||
FontManager manager = CraftEngine.instance().fontManager();
|
||||
IllegalCharacterProcessResult result = manager.processIllegalCharacters(message);
|
||||
if (result.has()) {
|
||||
try {
|
||||
NetworkReflections.handle$ServerboundRenameItemPacket$nameSetter.invoke(packet, result.text());
|
||||
NetworkReflections.handle$ServerboundRenameItemPacket$nameSetter.invokeExact(packet, result.text());
|
||||
} catch (ReflectiveOperationException e) {
|
||||
CraftEngine.instance().logger().warn("Failed to replace chat", e);
|
||||
}
|
||||
@@ -1722,7 +1722,7 @@ public class PacketConsumers {
|
||||
if (((BukkitServerPlayer) user).hasPermission(FontManager.BYPASS_SIGN)) {
|
||||
return;
|
||||
}
|
||||
String[] lines = (String[]) NetworkReflections.handle$ServerboundSignUpdatePacket$linesGetter.invoke(packet);
|
||||
String[] lines = (String[]) NetworkReflections.handle$ServerboundSignUpdatePacket$linesGetter.invokeExact(packet);
|
||||
FontManager manager = CraftEngine.instance().fontManager();
|
||||
if (!manager.isDefaultFontInUse()) return;
|
||||
for (int i = 0; i < lines.length; i++) {
|
||||
@@ -1753,9 +1753,9 @@ public class PacketConsumers {
|
||||
|
||||
boolean changed = false;
|
||||
|
||||
List<String> pages = (List<String>) NetworkReflections.handleServerboundEditBookPacket$pagesGetter.invoke(packet);
|
||||
List<String> pages = (List<String>) NetworkReflections.handleServerboundEditBookPacket$pagesGetter.invokeExact(packet);
|
||||
List<String> newPages = new ArrayList<>(pages.size());
|
||||
Optional<String> title = (Optional<String>) NetworkReflections.handle$ServerboundEditBookPacket$titleGetter.invoke(packet);
|
||||
Optional<String> title = (Optional<String>) NetworkReflections.handle$ServerboundEditBookPacket$titleGetter.invokeExact(packet);
|
||||
Optional<String> newTitle;
|
||||
|
||||
if (title.isPresent()) {
|
||||
@@ -1779,7 +1779,7 @@ public class PacketConsumers {
|
||||
|
||||
if (changed) {
|
||||
Object newPacket = NetworkReflections.constructor$ServerboundEditBookPacket.newInstance(
|
||||
NetworkReflections.handle$ServerboundEditBookPacket$slotGetter.invoke(packet),
|
||||
(int) NetworkReflections.handle$ServerboundEditBookPacket$slotGetter.invokeExact(packet),
|
||||
newPages,
|
||||
newTitle
|
||||
);
|
||||
@@ -1812,7 +1812,7 @@ public class PacketConsumers {
|
||||
public static final TriConsumer<NetWorkUser, NMSPacketEvent, Object> CUSTOM_PAYLOAD = (user, event, packet) -> {
|
||||
try {
|
||||
if (!VersionHelper.isOrAbove1_20_5()) return;
|
||||
Object payload = NetworkReflections.handle$ServerboundCustomPayloadPacket$payloadGetter.invoke(packet);
|
||||
Object payload = NetworkReflections.handle$ServerboundCustomPayloadPacket$payloadGetter.invokeExact(packet);
|
||||
if (NetworkReflections.clazz$DiscardedPayload.isInstance(payload)) {
|
||||
Payload discardedPayload = DiscardedPayload.from(payload);
|
||||
if (discardedPayload == null || !discardedPayload.channel().equals(NetworkManager.MOD_CHANNEL_KEY))
|
||||
@@ -2231,7 +2231,7 @@ public class PacketConsumers {
|
||||
public static final TriConsumer<NetWorkUser, NMSPacketEvent, Object> HANDSHAKE_C2S = (user, event, packet) -> {
|
||||
try {
|
||||
if (BukkitNetworkManager.hasViaVersion()) return;
|
||||
int protocolVersion = (int) NetworkReflections.handle$ClientIntentionPacket$protocolVersionGetter.invoke(packet);
|
||||
int protocolVersion = (int) NetworkReflections.handle$ClientIntentionPacket$protocolVersionGetter.invokeExact(packet);
|
||||
user.setProtocolVersion(protocolVersion);
|
||||
} catch (Throwable e) {
|
||||
CraftEngine.instance().logger().warn("Failed to handle ClientIntentionPacket", e);
|
||||
@@ -2251,7 +2251,7 @@ public class PacketConsumers {
|
||||
public static final TriConsumer<NetWorkUser, NMSPacketEvent, Object> RESOURCE_PACK_RESPONSE = (user, event, packet) -> {
|
||||
try {
|
||||
if (user.sentResourcePack() || !Config.sendPackOnJoin() || !Config.kickOnDeclined()) return;
|
||||
Object action = NetworkReflections.handle$ServerboundResourcePackPacket$actionGetter.invoke(packet);
|
||||
Object action = NetworkReflections.handle$ServerboundResourcePackPacket$actionGetter.invokeExact(packet);
|
||||
if (action == null) return;
|
||||
if (action == NetworkReflections.instance$ServerboundResourcePackPacket$Action$DECLINED
|
||||
|| action == NetworkReflections.instance$ServerboundResourcePackPacket$Action$FAILED_DOWNLOAD) {
|
||||
@@ -2273,9 +2273,9 @@ public class PacketConsumers {
|
||||
try {
|
||||
Object player = user.serverPlayer();
|
||||
if (player == null) return;
|
||||
int entityId = (int) NetworkReflections.handle$ClientboundEntityEventPacket$entityIdGetter.invoke(packet);
|
||||
int entityId = (int) NetworkReflections.handle$ClientboundEntityEventPacket$entityIdGetter.invokeExact(packet);
|
||||
if (entityId != FastNMS.INSTANCE.method$Entity$getId(player)) return;
|
||||
byte eventId = (byte) NetworkReflections.handle$ClientboundEntityEventPacket$eventIdGetter.invoke(packet);
|
||||
byte eventId = (byte) NetworkReflections.handle$ClientboundEntityEventPacket$eventIdGetter.invokeExact(packet);
|
||||
if (eventId >= 24 && eventId <= 28) {
|
||||
CraftEngine.instance().fontManager().refreshEmojiSuggestions(user.uuid());
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.momirealms.craftengine.core.util.VersionHelper;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodType;
|
||||
import java.lang.invoke.VarHandle;
|
||||
import java.lang.reflect.*;
|
||||
import java.util.*;
|
||||
@@ -3275,13 +3276,16 @@ public final class CoreReflections {
|
||||
|
||||
public static final MethodHandle handle$ServerEntity$broadcastSetter = requireNonNull(
|
||||
ReflectionUtils.unreflectSetter(field$ServerEntity$broadcast)
|
||||
.asType(MethodType.methodType(void.class, Object.class, Consumer.class))
|
||||
);
|
||||
|
||||
public static final MethodHandle handle$ServerEntity$updateIntervalSetter = requireNonNull(
|
||||
ReflectionUtils.unreflectSetter(field$ServerEntity$updateInterval)
|
||||
.asType(MethodType.methodType(void.class, Object.class, int.class))
|
||||
);
|
||||
|
||||
public static final MethodHandle handle$ServerPlayer$connectionGetter = requireNonNull(
|
||||
ReflectionUtils.unreflectGetter(field$ServerPlayer$connection)
|
||||
.asType(MethodType.methodType(Object.class, Object.class))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import net.momirealms.craftengine.core.util.ReflectionUtils;
|
||||
import net.momirealms.craftengine.core.util.VersionHelper;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodType;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
@@ -969,7 +970,7 @@ public final class NetworkReflections {
|
||||
);
|
||||
|
||||
public static final Field field$ServerboundEditBookPacket$slot = requireNonNull(
|
||||
ReflectionUtils.getDeclaredField(clazz$ServerboundEditBookPacket, int.class, 0)
|
||||
ReflectionUtils.getDeclaredField(clazz$ServerboundEditBookPacket, int.class, VersionHelper.isOrAbove1_20_5() ? 0 : 4)
|
||||
);
|
||||
|
||||
public static final Field field$ServerboundEditBookPacket$pages = requireNonNull(
|
||||
@@ -1297,102 +1298,119 @@ public final class NetworkReflections {
|
||||
|
||||
public static final MethodHandle handle$ServerboundRenameItemPacket$nameGetter = requireNonNull(
|
||||
ReflectionUtils.unreflectGetter(field$ServerboundRenameItemPacket$name)
|
||||
.asType(MethodType.methodType(String.class, Object.class))
|
||||
);
|
||||
|
||||
public static final MethodHandle handle$ServerboundRenameItemPacket$nameSetter = requireNonNull(
|
||||
ReflectionUtils.unreflectSetter(field$ServerboundRenameItemPacket$name)
|
||||
.asType(MethodType.methodType(void.class, Object.class, String.class))
|
||||
);
|
||||
|
||||
public static final MethodHandle handle$ServerboundHelloPacket$nameGetter = requireNonNull(
|
||||
ReflectionUtils.unreflectGetter(field$ServerboundHelloPacket$name)
|
||||
.asType(MethodType.methodType(String.class, Object.class))
|
||||
);
|
||||
|
||||
public static final MethodHandle handle$ServerboundHelloPacket$uuidGetter = requireNonNull(
|
||||
ReflectionUtils.unreflectGetter(field$ServerboundHelloPacket$uuid)
|
||||
.asType(MethodType.methodType(VersionHelper.isOrAbove1_20_2() ? UUID.class : Optional.class, Object.class))
|
||||
);
|
||||
|
||||
public static final MethodHandle handle$ClientboundRespawnPacket$dimensionGetter = Optional.ofNullable(field$ClientboundRespawnPacket$dimension)
|
||||
.map(ReflectionUtils::unreflectGetter)
|
||||
.map(it -> ReflectionUtils.unreflectGetter(it).asType(MethodType.methodType(Object.class, Object.class)))
|
||||
.orElse(null);
|
||||
|
||||
public static final MethodHandle handle$ClientboundRespawnPacket$commonPlayerSpawnInfoGetter = Optional.ofNullable(field$ClientboundRespawnPacket$commonPlayerSpawnInfo)
|
||||
.map(ReflectionUtils::unreflectGetter)
|
||||
.map(it -> ReflectionUtils.unreflectGetter(it).asType(MethodType.methodType(Object.class, Object.class)))
|
||||
.orElse(null);
|
||||
|
||||
public static final MethodHandle handle$CommonPlayerSpawnInfo$dimensionGetter = Optional.ofNullable(field$CommonPlayerSpawnInfo$dimension)
|
||||
.map(ReflectionUtils::unreflectGetter)
|
||||
.map(it -> ReflectionUtils.unreflectGetter(it).asType(MethodType.methodType(Object.class, Object.class)))
|
||||
.orElse(null);
|
||||
|
||||
public static final MethodHandle handle$ClientboundLoginPacket$dimensionGetter = Optional.ofNullable(field$ClientboundLoginPacket$dimension)
|
||||
.map(ReflectionUtils::unreflectGetter)
|
||||
.map(it -> ReflectionUtils.unreflectGetter(it).asType(MethodType.methodType(Object.class, Object.class)))
|
||||
.orElse(null);
|
||||
|
||||
public static final MethodHandle handle$ClientboundLoginPacket$commonPlayerSpawnInfoGetter = Optional.ofNullable(field$ClientboundLoginPacket$commonPlayerSpawnInfo)
|
||||
.map(ReflectionUtils::unreflectGetter)
|
||||
.map(it -> ReflectionUtils.unreflectGetter(it).asType(MethodType.methodType(Object.class, Object.class)))
|
||||
.orElse(null);
|
||||
|
||||
public static final MethodHandle handle$ServerboundSetCreativeModeSlotPacket$itemStackGetter = requireNonNull(
|
||||
ReflectionUtils.unreflectGetter(field$ServerboundSetCreativeModeSlotPacket$itemStack)
|
||||
.asType(MethodType.methodType(Object.class, Object.class))
|
||||
);
|
||||
|
||||
public static final MethodHandle handle$ServerboundSetCreativeModeSlotPacket$slotNumGetter = requireNonNull(
|
||||
ReflectionUtils.unreflectGetter(field$ServerboundSetCreativeModeSlotPacket$slotNum)
|
||||
.asType(MethodType.methodType(VersionHelper.isOrAbove1_20_5() ? short.class : int.class, Object.class))
|
||||
);
|
||||
|
||||
public static final MethodHandle handle$ServerboundPickItemFromBlockPacket$posGetter = Optional.ofNullable(field$ServerboundPickItemFromBlockPacket$pos)
|
||||
.map(ReflectionUtils::unreflectGetter)
|
||||
.map(it -> ReflectionUtils.unreflectGetter(it).asType(MethodType.methodType(Object.class, Object.class)))
|
||||
.orElse(null);
|
||||
|
||||
public static final MethodHandle handle$ServerboundPickItemFromEntityPacket$idGetter = Optional.ofNullable(field$ServerboundPickItemFromEntityPacket$id)
|
||||
.map(ReflectionUtils::unreflectGetter)
|
||||
.map(it -> ReflectionUtils.unreflectGetter(it).asType(MethodType.methodType(int.class, Object.class)))
|
||||
.orElse(null);
|
||||
|
||||
public static final MethodHandle handle$ServerboundInteractPacket$actionGetter = requireNonNull(
|
||||
ReflectionUtils.unreflectGetter(field$ServerboundInteractPacket$action)
|
||||
.asType(MethodType.methodType(Object.class, Object.class))
|
||||
);
|
||||
|
||||
public static final MethodHandle handle$ServerboundInteractPacket$InteractionAtLocationAction$handGetter = requireNonNull(
|
||||
ReflectionUtils.unreflectGetter(field$ServerboundInteractPacket$InteractionAtLocationAction$hand)
|
||||
.asType(MethodType.methodType(Object.class, Object.class))
|
||||
);
|
||||
|
||||
public static final MethodHandle handle$ServerboundInteractPacket$InteractionAtLocationAction$locationGetter = requireNonNull(
|
||||
ReflectionUtils.unreflectGetter(field$ServerboundInteractPacket$InteractionAtLocationAction$location)
|
||||
.asType(MethodType.methodType(Object.class, Object.class))
|
||||
);
|
||||
|
||||
public static final MethodHandle handle$ServerboundSignUpdatePacket$linesGetter = requireNonNull(
|
||||
ReflectionUtils.unreflectGetter(field$ServerboundSignUpdatePacket$lines)
|
||||
.asType(MethodType.methodType(String[].class, Object.class))
|
||||
);
|
||||
|
||||
public static final MethodHandle handleServerboundEditBookPacket$pagesGetter = requireNonNull(
|
||||
ReflectionUtils.unreflectGetter(field$ServerboundEditBookPacket$pages)
|
||||
.asType(MethodType.methodType(List.class, Object.class))
|
||||
);
|
||||
|
||||
public static final MethodHandle handle$ServerboundEditBookPacket$titleGetter = requireNonNull(
|
||||
ReflectionUtils.unreflectGetter(field$ServerboundEditBookPacket$title)
|
||||
.asType(MethodType.methodType(Optional.class, Object.class))
|
||||
);
|
||||
|
||||
public static final MethodHandle handle$ServerboundEditBookPacket$slotGetter = requireNonNull(
|
||||
ReflectionUtils.unreflectGetter(field$ServerboundEditBookPacket$slot)
|
||||
.asType(MethodType.methodType(int.class, Object.class))
|
||||
);
|
||||
|
||||
public static final MethodHandle handle$ServerboundCustomPayloadPacket$payloadGetter = Optional.ofNullable(field$ServerboundCustomPayloadPacket$payload)
|
||||
.map(ReflectionUtils::unreflectGetter)
|
||||
.map(it -> ReflectionUtils.unreflectGetter(it).asType(MethodType.methodType(Object.class, Object.class)))
|
||||
.orElse(null);
|
||||
|
||||
public static final MethodHandle handle$ServerboundResourcePackPacket$actionGetter = requireNonNull(
|
||||
ReflectionUtils.unreflectGetter(field$ServerboundResourcePackPacket$action)
|
||||
.asType(MethodType.methodType(Object.class, Object.class))
|
||||
);
|
||||
|
||||
public static final MethodHandle handle$ClientboundEntityEventPacket$entityIdGetter = requireNonNull(
|
||||
ReflectionUtils.unreflectGetter(field$ClientboundEntityEventPacket$entityId)
|
||||
.asType(MethodType.methodType(int.class, Object.class))
|
||||
);
|
||||
|
||||
public static final MethodHandle handle$ClientboundEntityEventPacket$eventIdGetter = requireNonNull(
|
||||
ReflectionUtils.unreflectGetter(field$ClientboundEntityEventPacket$eventId)
|
||||
.asType(MethodType.methodType(byte.class, Object.class))
|
||||
);
|
||||
|
||||
public static final MethodHandle handle$ClientIntentionPacket$protocolVersionGetter = requireNonNull(
|
||||
ReflectionUtils.unreflectGetter(field$ClientIntentionPacket$protocolVersion)
|
||||
.asType(MethodType.methodType(int.class, Object.class))
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user