9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-25 01:49:30 +00:00

修复低版本碰撞

This commit is contained in:
XiaoMoMi
2025-04-01 04:38:59 +08:00
parent cf53e4b243
commit fdbf744bec
3 changed files with 4 additions and 4 deletions

View File

@@ -134,7 +134,7 @@ public class LoadedFurniture {
double z1 = z - offset1.z();
double z2 = z - offset2.z();
Object aabb = FastNMS.INSTANCE.constructor$AABB(x1, y1, z1, x2, y2, z2);
CollisionEntity entity = FastNMS.INSTANCE.createCollisionEntity(world, aabb, x, y, z, true, collider.canBeHitByProjectile());
CollisionEntity entity = FastNMS.INSTANCE.createCollisionEntity(world, aabb, x, y, z, collider.canBeHitByProjectile());
FastNMS.INSTANCE.method$LevelWriter$addFreshEntity(world, entity);
this.collisionEntities[i] = entity;
}

View File

@@ -28,7 +28,7 @@ public class TestCommand extends BukkitCommandFeature<CommandSender> {
Object level = Reflections.field$CraftWorld$ServerLevel.get(player.getWorld());
Object aabb = FastNMS.INSTANCE.constructor$AABB(location.getBlockX(), location.getBlockY(), location.getBlockZ(),
location.getBlockX() + 1, location.getBlockY() + 1, location.getBlockZ() + 1);
CollisionEntity nmsEntity = FastNMS.INSTANCE.createCollisionEntity(level, aabb, location.getBlockX() + 0.5, location.getBlockY(), location.getBlockZ() + 0.5, true, false);
CollisionEntity nmsEntity = FastNMS.INSTANCE.createCollisionEntity(level, aabb, location.getBlockX() + 0.5, location.getBlockY(), location.getBlockZ() + 0.5, false);
FastNMS.INSTANCE.method$LevelWriter$addFreshEntity(level, nmsEntity);
} catch (Exception e) {
e.printStackTrace();

View File

@@ -77,7 +77,7 @@ public class PacketConsumers {
try {
if (user.clientModEnabled()) {
BukkitServerPlayer player = (BukkitServerPlayer) user;
Object chunkData = Reflections.field$ClientboundLevelChunkWithLightPacket$chunkData.get(packet);
Object chunkData = FastNMS.INSTANCE.field$ClientboundLevelChunkWithLightPacket$chunkData(packet);
byte[] buffer = (byte[]) Reflections.field$ClientboundLevelChunkPacketData$buffer.get(chunkData);
ByteBuf buf = Unpooled.copiedBuffer(buffer);
FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(buf);
@@ -107,7 +107,7 @@ public class PacketConsumers {
Reflections.field$ClientboundLevelChunkPacketData$buffer.set(chunkData, newBuf.array());
} else {
BukkitServerPlayer player = (BukkitServerPlayer) user;
Object chunkData = Reflections.field$ClientboundLevelChunkWithLightPacket$chunkData.get(packet);
Object chunkData = FastNMS.INSTANCE.field$ClientboundLevelChunkWithLightPacket$chunkData(packet);
byte[] buffer = (byte[]) Reflections.field$ClientboundLevelChunkPacketData$buffer.get(chunkData);
ByteBuf buf = Unpooled.copiedBuffer(buffer);
FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(buf);