mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-09-10 01:28:19 +02:00
Reenable attribute packets, fix modded entities
This commit is contained in:
parent
f3d5f7efc3
commit
e3300e7ef9
@ -50,8 +50,7 @@ public class PacketHandlerAttributes implements IPacketHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip if its 1.16, PL can't handle it atm
|
||||
if (disguise.isMiscDisguise() || NmsVersion.v1_16.isSupported()) {
|
||||
if (disguise.isMiscDisguise()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ public class PacketHandlerSpawn implements IPacketHandler {
|
||||
Disguise disguise = packets.getDisguise();
|
||||
|
||||
if (DisguiseConfig.isMiscDisguisesForLivingEnabled()) {
|
||||
if (disguise.getWatcher() instanceof LivingWatcher && !NmsVersion.v1_16.isSupported()) {
|
||||
if (disguise.getWatcher() instanceof LivingWatcher) {
|
||||
ArrayList<WrappedAttribute> attributes = new ArrayList<>();
|
||||
|
||||
WrappedAttribute.Builder builder = WrappedAttribute.newBuilder().attributeKey("generic.maxHealth");
|
||||
|
@ -14,6 +14,8 @@ import io.netty.buffer.Unpooled;
|
||||
import io.netty.handler.codec.DecoderException;
|
||||
import me.libraryaddict.disguise.LibsDisguises;
|
||||
import me.libraryaddict.disguise.utilities.modded.ModdedManager;
|
||||
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
|
||||
import net.minecraft.server.v1_16_R1.PacketDataSerializer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@ -140,21 +142,25 @@ public class PacketListenerModdedClient extends PacketAdapter {
|
||||
PacketContainer packet1 = new PacketContainer(PacketType.Login.Server.CUSTOM_PAYLOAD);
|
||||
packet1.getIntegers().write(0, packetId1);
|
||||
packet1.getMinecraftKeys().write(0, new com.comphenix.protocol.wrappers.MinecraftKey("fml", "handshake"));
|
||||
// packet1.getModifier()
|
||||
// .write(2, new PacketDataSerializer(Unpooled.wrappedBuffer(ModdedManager.getFmlHandshake())));
|
||||
|
||||
PacketContainer packet2 = new PacketContainer(PacketType.Login.Server.CUSTOM_PAYLOAD);
|
||||
packet2.getIntegers().write(0, packetId2);
|
||||
packet2.getMinecraftKeys().write(0, new MinecraftKey("fml", "handshake"));
|
||||
// packet2.getModifier()
|
||||
// .write(2, new PacketDataSerializer(Unpooled.wrappedBuffer(ModdedManager.getFmlRegistries())));
|
||||
|
||||
//TODO
|
||||
try {
|
||||
Object obj1 = ReflectionManager.getNmsConstructor("PacketDataSerializer", ByteBuf.class)
|
||||
.newInstance(Unpooled.wrappedBuffer(ModdedManager.getFmlHandshake()));
|
||||
|
||||
packet1.getModifier().write(2, obj1);
|
||||
|
||||
PacketContainer packet2 = new PacketContainer(PacketType.Login.Server.CUSTOM_PAYLOAD);
|
||||
packet2.getIntegers().write(0, packetId2);
|
||||
packet2.getMinecraftKeys().write(0, new MinecraftKey("fml", "handshake"));
|
||||
Object obj2 = ReflectionManager.getNmsConstructor("PacketDataSerializer", ByteBuf.class)
|
||||
.newInstance(Unpooled.wrappedBuffer(ModdedManager.getFmlRegistries()));
|
||||
|
||||
packet2.getModifier().write(2, obj2);
|
||||
|
||||
ProtocolLibrary.getProtocolManager().sendServerPacket(event.getPlayer(), packet1);
|
||||
ProtocolLibrary.getProtocolManager().sendServerPacket(event.getPlayer(), packet2);
|
||||
}
|
||||
catch (InvocationTargetException e) {
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user