From 411e1ae539c9284c14cbbf8a378b47b3a9a7c57f Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 14 Jan 2022 21:42:18 +0100 Subject: [PATCH] WIP 1.18 support Signed-off-by: Lixfel --- .../utils/FlatteningWrapper14.java | 4 +- FightSystem_18/pom.xml | 44 +++++++++++++++++ .../fightsystem/utils/BlockIdWrapper18.java | 47 ++++++++++--------- .../utils/CraftbukkitWrapper18.java | 30 ++++++------ .../fightsystem/utils/BountifulWrapper9.java | 12 ++--- FightSystem_Core/pom.xml | 6 +++ .../de/steamwar/fightsystem/fight/Fight.java | 10 ++-- .../fightsystem/listener/Recording.java | 4 +- .../steamwar/fightsystem/record/REntity.java | 35 +++++++++----- 9 files changed, 125 insertions(+), 67 deletions(-) diff --git a/FightSystem_14/src/de/steamwar/fightsystem/utils/FlatteningWrapper14.java b/FightSystem_14/src/de/steamwar/fightsystem/utils/FlatteningWrapper14.java index 3cd74c0..0456dc9 100644 --- a/FightSystem_14/src/de/steamwar/fightsystem/utils/FlatteningWrapper14.java +++ b/FightSystem_14/src/de/steamwar/fightsystem/utils/FlatteningWrapper14.java @@ -120,9 +120,9 @@ public class FlatteningWrapper14 implements FlatteningWrapper.IFlatteningWrapper // field not present } - private static final Class entityTypes = Reflection.getClass("{nms}.EntityTypes"); + private static final Class entityTypes = Reflection.getClass("{nms.world.entity}.EntityTypes"); private static final Reflection.FieldAccessor spawnType = Reflection.getField(REntity.spawnPacket, entityTypes, 0); - private static final Object tnt = Reflection.getField(entityTypes, "TNT", entityTypes).get(null); + private static final Object tnt = Reflection.getField(entityTypes, "TNT", entityTypes).get(null); //TODO: Names not usable in 1.18 private static final Object arrow = Reflection.getField(entityTypes, "ARROW", entityTypes).get(null); private static final Object fireball = Reflection.getField(entityTypes, "FIREBALL", entityTypes).get(null); @Override diff --git a/FightSystem_18/pom.xml b/FightSystem_18/pom.xml index edd0bde..4788519 100644 --- a/FightSystem_18/pom.xml +++ b/FightSystem_18/pom.xml @@ -36,6 +36,44 @@ FightSystem_18 1.0 + + + + net.md-5 + specialsource-maven-plugin + 1.2.3 + + + package + + remap + + remap-obf + + org.spigotmc:minecraft-server:1.18.1-R0.1-SNAPSHOT:txt:maps-mojang + true + org.spigotmc:spigot:1.18.1-R0.1-SNAPSHOT:jar:remapped-mojang + true + remapped-obf + + + + package + + remap + + remap-spigot + + ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar + org.spigotmc:minecraft-server:1.18.1-R0.1-SNAPSHOT:csrg:maps-spigot + org.spigotmc:spigot:1.18.1-R0.1-SNAPSHOT:jar:remapped-obf + + + + + + + org.spigotmc @@ -43,6 +81,12 @@ 1.18-R0.1-SNAPSHOT provided + + com.mojang + datafixerupper + 4.0.26 + provided + steamwar Spigot diff --git a/FightSystem_18/src/de/steamwar/fightsystem/utils/BlockIdWrapper18.java b/FightSystem_18/src/de/steamwar/fightsystem/utils/BlockIdWrapper18.java index 83772aa..4aa3ff9 100644 --- a/FightSystem_18/src/de/steamwar/fightsystem/utils/BlockIdWrapper18.java +++ b/FightSystem_18/src/de/steamwar/fightsystem/utils/BlockIdWrapper18.java @@ -19,15 +19,15 @@ package de.steamwar.fightsystem.utils; -import com.sk89q.worldedit.world.fluid.FluidTypes; import de.steamwar.fightsystem.Config; -import net.minecraft.core.BlockPosition; -import net.minecraft.core.IRegistry; -import net.minecraft.resources.MinecraftKey; -import net.minecraft.server.level.WorldServer; -import net.minecraft.world.entity.EntityPose; -import net.minecraft.world.level.block.state.IBlockData; -import net.minecraft.world.level.material.Fluid; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Pose; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.craftbukkit.v1_18_R1.CraftWorld; @@ -38,35 +38,36 @@ import java.util.Objects; import java.util.Set; public class BlockIdWrapper18 implements BlockIdWrapper.IBlockIdWrapper { + @Override public int blockToId(Block block) { - return net.minecraft.world.level.block.Block.p.a(((CraftBlock)block).getNMS()); + return net.minecraft.world.level.block.Block.getId(((CraftBlock)block).getNMS()); } @Override public void setBlock(World world, int x, int y, int z, int blockState) { - IBlockData blockData = Objects.requireNonNull(net.minecraft.world.level.block.Block.a(blockState)); - WorldServer cworld = ((CraftWorld)world).getHandle(); - BlockPosition pos = new BlockPosition(x, y, z); - cworld.removeTileEntity(pos); - cworld.setTypeAndData(pos, blockData, 1042); - cworld.getChunkProvider().flagDirty(pos); + BlockState blockData = Objects.requireNonNull(net.minecraft.world.level.block.Block.stateById(blockState)); + ServerLevel cworld = ((CraftWorld)world).getHandle(); + BlockPos pos = new BlockPos(x, y, z); + cworld.removeBlockEntity(pos); + cworld.setBlock(pos, blockData, 1042); + cworld.getChunkSource().blockChanged(pos); } @Override public Set getHiddenBlockIds() { Set hiddenBlockIds = new HashSet<>(); for(String tag : Config.HiddenBlocks){ - for(IBlockData data : IRegistry.k.get(new MinecraftKey(tag)).getStates().a()){ - hiddenBlockIds.add(net.minecraft.world.level.block.Block.getCombinedId(data)); + for(BlockState data : Registry.BLOCK.get(new ResourceLocation(tag)).getStateDefinition().getPossibleStates()){ + hiddenBlockIds.add(net.minecraft.world.level.block.Block.getId(data)); } } if(Config.HiddenBlocks.contains("water")){ - Fluid water = FluidTypes.WATER.a(false); - for(IBlockData data : net.minecraft.world.level.block.Block.p){ - if(data.getFluid() == water){ - hiddenBlockIds.add(net.minecraft.world.level.block.Block.getCombinedId(data)); + FluidState water = Fluids.WATER.defaultFluidState(); + for(BlockState data : net.minecraft.world.level.block.Block.BLOCK_STATE_REGISTRY) { + if(data.getFluidState() == water) { + hiddenBlockIds.add(net.minecraft.world.level.block.Block.getId(data)); } } } @@ -76,11 +77,11 @@ public class BlockIdWrapper18 implements BlockIdWrapper.IBlockIdWrapper { @Override public int getObfuscateWith() { - return net.minecraft.world.level.block.Block.i(IRegistry.k.get(new MinecraftKey(Config.ObfuscateWith)).getBlockData()); + return net.minecraft.world.level.block.Block.getId(Registry.BLOCK.get(new ResourceLocation(Config.ObfuscateWith)).defaultBlockState()); } @Override public Object getPose(boolean sneaking) { - return sneaking ? EntityPose.f : EntityPose.a; + return sneaking ? Pose.CROUCHING : Pose.STANDING; } } diff --git a/FightSystem_18/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper18.java b/FightSystem_18/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper18.java index 8ca6b68..a666d06 100644 --- a/FightSystem_18/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper18.java +++ b/FightSystem_18/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper18.java @@ -19,8 +19,7 @@ package de.steamwar.fightsystem.utils; -import de.steamwar.fightsystem.fight.FightWorld; -import net.minecraft.world.level.chunk.Chunk; +import net.minecraft.world.level.chunk.LevelChunk; import org.bukkit.World; import org.bukkit.craftbukkit.v1_18_R1.CraftWorld; import org.bukkit.craftbukkit.v1_18_R1.entity.CraftEntity; @@ -37,34 +36,33 @@ public class CraftbukkitWrapper18 implements CraftbukkitWrapper.ICraftbukkitWrap @Override public void resetChunk(World world, World backup, int x, int z) { - net.minecraft.world.level.World w = ((CraftWorld) world).getHandle(); - Chunk chunk = w.d(x, z); - Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z); + net.minecraft.world.level.Level w = ((CraftWorld) world).getHandle(); + LevelChunk chunk = w.getChunk(x, z); + LevelChunk backupChunk = ((CraftWorld) backup).getHandle().getChunk(x, z); System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length); - w.tileEntityListTick.removeAll(chunk.tileEntities.values()); - if (!FightWorld.isPaper()) { - w.tileEntityList.removeAll(chunk.tileEntities.values()); - } - chunk.tileEntities.clear(); - chunk.tileEntities.putAll(backupChunk.tileEntities); - chunk.heightMap.clear(); - chunk.heightMap.putAll(backupChunk.heightMap); + + //w.blockEntityTickers.removeAll(chunk.tickersInLevel.values()); + //if (!FightWorld.isPaper()) { + // w.blockEntityTickersPending.removeAll(chunk.tickersInLevel.values()); + //} + //chunk.tickersInLevel.clear(); + //chunk.tickersInLevel.putAll(backupChunk.tickersInLevel); } @Override public void sendResourcePack(Player player, String pack, String sha1) { - ((CraftPlayer)player).getHandle().setResourcePack(pack, sha1); + ((CraftPlayer)player).getHandle().sendTexturePack(pack, sha1, true, null); } @Override public float headRotation(Entity e) { - return ((CraftEntity)e).getHandle().getHeadRotation(); + return ((CraftEntity)e).getHandle().getYHeadRot(); } @Override public boolean hasItems(ItemStack stack) { - Set keys = new HashSet<>(CraftItemStack.asNMSCopy(stack).s().d()); + Set keys = new HashSet<>(CraftItemStack.asNMSCopy(stack).getTag().getAllKeys()); keys.remove("Enchantments"); keys.remove("Damage"); return !keys.isEmpty(); diff --git a/FightSystem_9/src/de/steamwar/fightsystem/utils/BountifulWrapper9.java b/FightSystem_9/src/de/steamwar/fightsystem/utils/BountifulWrapper9.java index a21a46c..0f10e45 100644 --- a/FightSystem_9/src/de/steamwar/fightsystem/utils/BountifulWrapper9.java +++ b/FightSystem_9/src/de/steamwar/fightsystem/utils/BountifulWrapper9.java @@ -46,7 +46,7 @@ import java.util.UUID; public class BountifulWrapper9 implements BountifulWrapper.IBountifulWrapper { - private static final Class enumHand = Reflection.getClass("{nms}.EnumHand"); + private static final Class enumHand = Reflection.getClass("{nms.world}.EnumHand"); private static final Object mainHand = enumHand.getEnumConstants()[0]; private static final Reflection.FieldAccessor blockPlaceHand = Reflection.getField(Recording.blockPlacePacket, enumHand, 0); @@ -118,9 +118,9 @@ public class BountifulWrapper9 implements BountifulWrapper.IBountifulWrapper { } - private static final Class dataWatcherObject = Reflection.getClass("{nms}.DataWatcherObject"); - private static final Class dataWatcherRegistry = Reflection.getClass("{nms}.DataWatcherRegistry"); - private static final Class dataWatcherSerializer = Reflection.getClass("{nms}.DataWatcherSerializer"); + private static final Class dataWatcherObject = Reflection.getClass("{nms.network.syncher}.DataWatcherObject"); + private static final Class dataWatcherRegistry = Reflection.getClass("{nms.network.syncher}.DataWatcherRegistry"); + private static final Class dataWatcherSerializer = Reflection.getClass("{nms.network.syncher}.DataWatcherSerializer"); private static final Reflection.ConstructorInvoker dataWatcherObjectConstructor = Reflection.getConstructor(dataWatcherObject, int.class, dataWatcherSerializer); @Override public Object getDataWatcherObject(int index, Class type) { @@ -136,7 +136,7 @@ public class BountifulWrapper9 implements BountifulWrapper.IBountifulWrapper { throw new SecurityException("Could not find Serializer for " + type.getName()); } - private static final Class item = Reflection.getClass("{nms}.DataWatcher$Item"); + private static final Class item = Reflection.getClass("{nms.network.syncher}.DataWatcher$Item"); private static final Reflection.ConstructorInvoker itemConstructor = Reflection.getConstructor(item, dataWatcherObject, Object.class); @Override public Object getDataWatcherItem(Object dwo, Object value) { @@ -159,7 +159,7 @@ public class BountifulWrapper9 implements BountifulWrapper.IBountifulWrapper { spawnUUID.set(packet, uuid); } - private static final Class enumItemSlot = Reflection.getClass("{nms}.EnumItemSlot"); + private static final Class enumItemSlot = Reflection.getClass("{nms.world.entity}.EnumItemSlot"); private static final Reflection.FieldAccessor equipmentSlot = Reflection.getField(REntity.equipmentPacket, enumItemSlot, 0); private static final Object[] itemSlots = enumItemSlot.getEnumConstants(); @Override diff --git a/FightSystem_Core/pom.xml b/FightSystem_Core/pom.xml index f427dfc..2ce9c10 100644 --- a/FightSystem_Core/pom.xml +++ b/FightSystem_Core/pom.xml @@ -24,6 +24,12 @@ 1.18-R0.1-SNAPSHOT provided + + it.unimi.dsi + fastutil + 8.5.6 + provided + io.netty netty-all diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/fight/Fight.java b/FightSystem_Core/src/de/steamwar/fightsystem/fight/Fight.java index 6a1a3c6..a8e4236 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/fight/Fight.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/fight/Fight.java @@ -130,19 +130,19 @@ public class Fight { } } - private static final Class playerInfoPacket = Reflection.getClass("{nms}.PacketPlayOutPlayerInfo"); + private static final Class playerInfoPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutPlayerInfo"); private static final Reflection.ConstructorInvoker playerInfoConstructor = Reflection.getConstructor(playerInfoPacket); - private static final Class playerInfoActionClass = Reflection.getClass("{nms}.PacketPlayOutPlayerInfo$EnumPlayerInfoAction"); + private static final Class playerInfoActionClass = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutPlayerInfo$EnumPlayerInfoAction"); public static final Object addPlayer = playerInfoActionClass.getEnumConstants()[0]; private static final Reflection.FieldAccessor playerInfoAction = Reflection.getField(playerInfoPacket, playerInfoActionClass, 0); private static final Object updateGamemode = playerInfoActionClass.getEnumConstants()[1]; public static final Object removePlayer = playerInfoActionClass.getEnumConstants()[4]; private static final Reflection.FieldAccessor playerInfoData = Reflection.getField(playerInfoPacket, List.class, 0); - private static final Class playerInfoDataClass = Reflection.getClass("{nms}.PacketPlayOutPlayerInfo$PlayerInfoData"); - private static final Class enumGamemode = Reflection.getClass(Core.getVersion() > 9 ? "{nms}.EnumGamemode" : "{nms}.WorldSettings$EnumGamemode"); + private static final Class playerInfoDataClass = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutPlayerInfo$PlayerInfoData"); + private static final Class enumGamemode = Reflection.getClass(Core.getVersion() > 9 ? "{nms.world.level}.EnumGamemode" : "{nms}.WorldSettings$EnumGamemode"); public static final Object creative = enumGamemode.getEnumConstants()[2]; private static final Object spectator = enumGamemode.getEnumConstants()[4]; - private static final Class iChatBaseComponent = Reflection.getClass("{nms}.IChatBaseComponent"); + private static final Class iChatBaseComponent = Reflection.getClass("{nms.network.chat}.IChatBaseComponent"); private static final Reflection.ConstructorInvoker playerInfoDataConstructor = Reflection.getConstructor(playerInfoDataClass, playerInfoPacket, GameProfile.class, int.class, enumGamemode, iChatBaseComponent); public static void pseudoSpectator(Player player, boolean enable) { diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/Recording.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/Recording.java index 1d2f412..0b158b6 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/Recording.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/Recording.java @@ -115,7 +115,7 @@ public class Recording implements Listener { }, 1, 1); } - private static final Class blockDigPacket = Reflection.getClass("{nms}.PacketPlayInBlockDig"); + private static final Class blockDigPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInBlockDig"); private static final Class playerDigType = blockDigPacket.getDeclaredClasses()[0]; private static final Reflection.FieldAccessor blockDigType = Reflection.getField(blockDigPacket, playerDigType, 0); private static final Object releaseUseItem = playerDigType.getEnumConstants()[5]; @@ -125,7 +125,7 @@ public class Recording implements Listener { return packet; } - public static final Class blockPlacePacket = Reflection.getClass("{nms}.PacketPlayInBlockPlace"); + public static final Class blockPlacePacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInBlockPlace"); private Object blockPlace(Player p, Object packet) { boolean mainHand = BountifulWrapper.impl.mainHand(packet); if(BountifulWrapper.impl.bowInHand(mainHand, p)) diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/record/REntity.java b/FightSystem_Core/src/de/steamwar/fightsystem/record/REntity.java index 2523cf0..3c703d8 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/record/REntity.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/record/REntity.java @@ -31,6 +31,8 @@ import de.steamwar.fightsystem.utils.BountifulWrapper; import de.steamwar.fightsystem.utils.FlatteningWrapper; import de.steamwar.fightsystem.utils.ProtocolAPI; import de.steamwar.sql.SteamwarUser; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.EntityType; @@ -174,7 +176,7 @@ public class REntity { ProtocolAPI.broadcastPacket(getHeadRotationPacket()); } - private static final Class animationPacket = Reflection.getClass("{nms}.PacketPlayOutAnimation"); + private static final Class animationPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutAnimation"); private static final Reflection.ConstructorInvoker animationConstructor = Reflection.getConstructor(animationPacket); private static final Reflection.FieldAccessor animationEntity = Reflection.getField(animationPacket, int.class, 0); private static final Reflection.FieldAccessor animationAnimation = Reflection.getField(animationPacket, int.class, 1); @@ -185,7 +187,7 @@ public class REntity { ProtocolAPI.broadcastPacket(packet); } - private static final Class velocityPacket = Reflection.getClass("{nms}.PacketPlayOutEntityVelocity"); + private static final Class velocityPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutEntityVelocity"); private static final Reflection.ConstructorInvoker velocityConstructor = Reflection.getConstructor(velocityPacket); private static final Reflection.FieldAccessor velocityEntity = Reflection.getField(velocityPacket, int.class, 0); private static final Reflection.FieldAccessor velocityX = Reflection.getField(velocityPacket, int.class, 1); @@ -200,7 +202,7 @@ public class REntity { ProtocolAPI.broadcastPacket(packet); } - private static final Class statusPacket = Reflection.getClass("{nms}.PacketPlayOutEntityStatus"); + private static final Class statusPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutEntityStatus"); private static final Reflection.ConstructorInvoker statusConstructor = Reflection.getConstructor(statusPacket); private static final Reflection.FieldAccessor statusEntity = Reflection.getField(statusPacket, int.class, 0); private static final Reflection.FieldAccessor statusStatus = Reflection.getField(statusPacket, byte.class, 0); @@ -248,9 +250,16 @@ public class REntity { entities.remove(internalId); } - private static final Class destroyPacket = Reflection.getClass("{nms}.PacketPlayOutEntityDestroy"); + private static final Class destroyPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutEntityDestroy"); private static final Reflection.ConstructorInvoker destroyConstructor = Reflection.getConstructor(destroyPacket); - private static final Reflection.FieldAccessor destroyEntities = Reflection.getField(destroyPacket, int[].class, 0); + private static final Reflection.FieldAccessor destroyEntities; + static { + if(Core.getVersion() > 15) + destroyEntities = Reflection.getField(destroyPacket, IntList.class, 0); + else + destroyEntities = Reflection.getField(destroyPacket, int[].class, 0); + } + private void broadcastDeath(){ if(entityType == EntityType.PLAYER){ ProtocolAPI.broadcastPacket(Fight.playerInfoPacket(Fight.removePlayer, new GameProfile(uuid, name), Fight.creative)); @@ -258,7 +267,7 @@ public class REntity { } Object packet = destroyConstructor.invoke(); - destroyEntities.set(packet, new int[]{entityId}); + destroyEntities.set(packet, Core.getVersion() > 15 ? new IntArrayList(new int[]{entityId}) : new int[]{entityId}); ProtocolAPI.broadcastPacket(packet); } @@ -266,7 +275,7 @@ public class REntity { return (int)(Math.max(-3.9, Math.min(value, 3.9)) * 8000); } - private static final Class metadataPacket = Reflection.getClass("{nms}.PacketPlayOutEntityMetadata"); + private static final Class metadataPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutEntityMetadata"); private static final Reflection.ConstructorInvoker metadataConstructor = Reflection.getConstructor(metadataPacket); private static final Reflection.FieldAccessor metadataEntity = Reflection.getField(metadataPacket, int.class, 0); private static final Reflection.FieldAccessor metadataMetadata = Reflection.getField(metadataPacket, List.class, 0); @@ -277,7 +286,7 @@ public class REntity { return packet; } - public static final Class teleportPacket = Reflection.getClass("{nms}.PacketPlayOutEntityTeleport"); + public static final Class teleportPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutEntityTeleport"); private static final Reflection.ConstructorInvoker teleportConstructor = Reflection.getConstructor(teleportPacket); private static final Reflection.FieldAccessor teleportEntity = Reflection.getField(teleportPacket, int.class, 0); private static final Reflection.FieldAccessor teleportYaw = Reflection.getField(teleportPacket, byte.class, 0); @@ -291,7 +300,7 @@ public class REntity { return packet; } - private static final Class headRotationPacket = Reflection.getClass("{nms}.PacketPlayOutEntityHeadRotation"); + private static final Class headRotationPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutEntityHeadRotation"); private static final Reflection.ConstructorInvoker headRotationConstructor = Reflection.getConstructor(headRotationPacket); private static final Reflection.FieldAccessor headRotationEntity = Reflection.getField(headRotationPacket, int.class, 0); private static final Reflection.FieldAccessor headRotationYaw = Reflection.getField(headRotationPacket, byte.class, 0); @@ -302,7 +311,7 @@ public class REntity { return packet; } - public static final Class spawnPacket = Reflection.getClass("{nms}.PacketPlayOutSpawnEntity"); + public static final Class spawnPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutSpawnEntity"); private static final Reflection.ConstructorInvoker spawnConstructor = Reflection.getConstructor(spawnPacket); private static final Reflection.FieldAccessor spawnEntity = Reflection.getField(spawnPacket, int.class, 0); private Object getSpawnEntityPacket(){ @@ -313,11 +322,11 @@ public class REntity { return packet; } - public static final Class equipmentPacket = Reflection.getClass("{nms}.PacketPlayOutEntityEquipment"); + public static final Class equipmentPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutEntityEquipment"); private static final Reflection.ConstructorInvoker equipmentConstructor = Reflection.getConstructor(equipmentPacket); private static final Reflection.FieldAccessor equipmentEntity = Reflection.getField(equipmentPacket, int.class, 0); private static final Class itemStack = Reflection.getClass("{nms}.ItemStack"); - private static final Reflection.FieldAccessor equipmentStack = Reflection.getField(equipmentPacket, itemStack, 0); + private static final Reflection.FieldAccessor equipmentStack = Reflection.getField(equipmentPacket, itemStack, 0); //TODO: Changed in 1.18 private static final Class craftItemStack = Reflection.getClass("{obc}.inventory.CraftItemStack"); private static final Reflection.MethodInvoker asNMSCopy = Reflection.getTypedMethod(craftItemStack, "asNMSCopy", itemStack, ItemStack.class); private Object getEquipmentPacket(String slot, ItemStack stack){ @@ -332,7 +341,7 @@ public class REntity { return Fight.playerInfoPacket(Fight.addPlayer, new GameProfile(uuid, name), Fight.creative); } - public static final Class namedSpawnPacket = Reflection.getClass("{nms}.PacketPlayOutNamedEntitySpawn"); + public static final Class namedSpawnPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutNamedEntitySpawn"); private static final Reflection.ConstructorInvoker namedSpawnConstructor = Reflection.getConstructor(namedSpawnPacket); private static final Reflection.FieldAccessor namedSpawnEntity = Reflection.getField(namedSpawnPacket, int.class, 0); private static final Reflection.FieldAccessor namedSpawnUUID = Reflection.getField(namedSpawnPacket, UUID.class, 0);