Merge branch 'main' into MojMapReflections

# Conflicts:
#	SpigotCore/SpigotCore_8/src/de/steamwar/core/BountifulWrapper8.java
#	SpigotCore/SpigotCore_9/src/de/steamwar/core/BountifulWrapper9.java
#	SpigotCore/SpigotCore_Main/src/de/steamwar/core/events/PartialChunkFixer.java
This commit is contained in:
Lixfel
2025-01-06 10:06:28 +01:00
61 changed files with 426 additions and 467 deletions
-2
View File
@@ -26,6 +26,4 @@ dependencies {
compileOnly(project(":SpigotCore:SpigotCore_8", "default"))
compileOnly(libs.nms9)
compileOnly(libs.viaapi)
}
@@ -20,7 +20,6 @@
package de.steamwar.core;
import de.steamwar.Reflection;
import com.viaversion.viaversion.api.Via;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.BaseComponent;
import org.bukkit.Sound;
@@ -37,7 +36,7 @@ public class BountifulWrapper9 implements BountifulWrapper.IBountifulWrapper {
@Override
public void sendMessage(Player player, ChatMessageType type, BaseComponent... msg) {
if(type == ChatMessageType.CHAT && Via.getAPI().getPlayerVersion(player.getUniqueId()) >= 759)
if(type == ChatMessageType.CHAT)
type = ChatMessageType.SYSTEM;
player.spigot().sendMessage(type, msg);
@@ -66,19 +65,19 @@ public class BountifulWrapper9 implements BountifulWrapper.IBountifulWrapper {
Reflection.Field<Double> posZ = Reflection.getField(packetClass, double.class, fieldOffset+2);
boolean isByteClass = packetClass.getSimpleName().contains("PacketPlayOutEntityTeleport") || packetClass.getSimpleName().contains("PacketPlayOutNamedEntitySpawn");
Class<?> pitchYawType = isByteClass ? byte.class : int.class;
Reflection.Field<?> lookPitch = Reflection.getField(packetClass, pitchYawType, isByteClass ? 0 : 1);
Reflection.Field<?> lookYaw = Reflection.getField(packetClass, pitchYawType, isByteClass ? 1 : 2);
Reflection.Field<?> lookYaw = Reflection.getField(packetClass, pitchYawType, isByteClass ? 0 : 1);
Reflection.Field<?> lookPitch = Reflection.getField(packetClass, pitchYawType, isByteClass ? 1 : 2);
return (packet, x, y, z, pitch, yaw) -> {
posX.set(packet, x);
posY.set(packet, y);
posZ.set(packet, z);
if (isByteClass) {
lookPitch.set(packet, (byte) (pitch*256/360));
lookYaw.set(packet, (byte) (yaw*256/360));
lookPitch.set(packet, (byte) (pitch*256/360));
} else {
lookPitch.set(packet, (int) (pitch*256/360));
lookYaw.set(packet, (int) (yaw*256/360));
lookPitch.set(packet, (int) (pitch*256/360));
}
};
}
@@ -89,15 +88,15 @@ public class BountifulWrapper9 implements BountifulWrapper.IBountifulWrapper {
Reflection.Field<?> moveX = Reflection.getField(packetClass, "b", type);
Reflection.Field<?> moveY = Reflection.getField(packetClass, "c", type);
Reflection.Field<?> moveZ = Reflection.getField(packetClass, "d", type);
Reflection.Field<Byte> movePitch = Reflection.getField(packetClass, "e", byte.class);
Reflection.Field<Byte> moveYaw = Reflection.getField(packetClass, "f", byte.class);
Reflection.Field<Byte> moveYaw = Reflection.getField(packetClass, "e", byte.class);
Reflection.Field<Byte> movePitch = Reflection.getField(packetClass, "f", byte.class);
return (packet, x, y, z, pitch, yaw) -> {
moveX.set(packet, (short)(x*4096));
moveY.set(packet, (short)(y*4096));
moveZ.set(packet, (short)(z*4096));
movePitch.set(packet, (byte)(pitch*256/360));
moveYaw.set(packet, (byte)(yaw*256/360));
movePitch.set(packet, (byte)(pitch*256/360));
};
}