Fix REntity for 1.15.2-1.21.3

<1.15.2: Untested
This commit is contained in:
2024-12-01 11:39:23 +01:00
parent 41233b7710
commit 7927a195d6
15 changed files with 127 additions and 73 deletions
@@ -25,6 +25,7 @@ import net.md_5.bungee.api.chat.BaseComponent;
import net.minecraft.server.v1_8_R3.ChatComponentText;
import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
@@ -70,11 +71,15 @@ public class BountifulWrapper8 implements BountifulWrapper.IBountifulWrapper {
Reflection.FieldAccessor<Integer> posX = Reflection.getField(packetClass, int.class, fieldOffset);
Reflection.FieldAccessor<Integer> posY = Reflection.getField(packetClass, int.class, fieldOffset +1);
Reflection.FieldAccessor<Integer> posZ = Reflection.getField(packetClass, int.class, fieldOffset +2);
Reflection.FieldAccessor<Byte> lookPitch = Reflection.getField(packetClass, byte.class, 0);
Reflection.FieldAccessor<Byte> lookYaw = Reflection.getField(packetClass, byte.class, 1);
return (packet, x, y, z) -> {
return (packet, x, y, z, pitch, yaw) -> {
posX.set(packet, MathHelper.floor(x * 32));
posY.set(packet, MathHelper.floor(y * 32));
posZ.set(packet, MathHelper.floor(z * 32));
lookPitch.set(packet, (byte)(pitch * 256 / 360));
lookYaw.set(packet, (byte)(yaw * 256 / 360));
};
}
@@ -83,11 +88,15 @@ public class BountifulWrapper8 implements BountifulWrapper.IBountifulWrapper {
Reflection.FieldAccessor<?> moveX = Reflection.getField(packetClass, "b", byte.class);
Reflection.FieldAccessor<?> moveY = Reflection.getField(packetClass, "c", byte.class);
Reflection.FieldAccessor<?> moveZ = Reflection.getField(packetClass, "d", byte.class);
Reflection.FieldAccessor<Byte> lookYaw = Reflection.getField(packetClass, "e", byte.class);
Reflection.FieldAccessor<Byte> lookPitch = Reflection.getField(packetClass, "f", byte.class);
return (packet, x, y, z) -> {
return (packet, x, y, z, pitch, yaw) -> {
moveX.set(packet, (byte)(x*32));
moveY.set(packet, (byte)(y*32));
moveZ.set(packet, (byte)(z*32));
lookYaw.set(packet, (byte)(yaw*256/360));
lookPitch.set(packet, (byte)(pitch*256/360));
};
}