9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-19 15:09:15 +00:00

修复剔除点

This commit is contained in:
XiaoMoMi
2025-12-04 22:16:12 +08:00
parent be84b0292a
commit af592e4287
10 changed files with 191 additions and 53 deletions

View File

@@ -31,6 +31,7 @@ import net.momirealms.craftengine.core.world.WorldPosition;
import net.momirealms.craftengine.core.world.collision.AABB;
import net.momirealms.sparrow.nbt.CompoundTag;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.World;
import java.nio.file.Path;
@@ -119,6 +120,9 @@ public class FurnitureItemBehavior extends ItemBehavior {
// 检查方块、实体阻挡
if (!aabbs.isEmpty()) {
if (!FastNMS.INSTANCE.checkEntityCollision(context.getLevel().serverWorld(), aabbs.stream().map(it -> FastNMS.INSTANCE.constructor$AABB(it.minX, it.minY, it.minZ, it.maxX, it.maxY, it.maxZ)).toList())) {
if (player != null && player.enableFurnitureDebug() && VersionHelper.isPaper()) {
// bukkitPlayer.getWorld().spawnParticle(Particle.FLAME, , List.of(bukkitPlayer), );
}
return InteractionResult.FAIL;
}
}

View File

@@ -30,11 +30,11 @@ public class SetEntityViewDistanceScaleCommand extends BukkitCommandFeature<Comm
.required("scale", DoubleParser.doubleParser(0.125, 8))
.handler(context -> {
if (!Config.enableEntityCulling()) {
context.sender().sendMessage(Component.text("Entity culling is not enabled on this server").color(NamedTextColor.RED));
plugin().senderFactory().wrap(context.sender()).sendMessage(Component.text("Entity culling is not enabled on this server").color(NamedTextColor.RED));
return;
}
if (Config.entityCullingViewDistance() <= 0) {
context.sender().sendMessage(Component.text("View distance is not enabled on this server").color(NamedTextColor.RED));
plugin().senderFactory().wrap(context.sender()).sendMessage(Component.text("View distance is not enabled on this server").color(NamedTextColor.RED));
return;
}
Player player = context.get("player");

View File

@@ -32,7 +32,7 @@ public class ToggleEntityCullingCommand extends BukkitCommandFeature<CommandSend
.optional("state", BooleanParser.booleanParser())
.handler(context -> {
if (!Config.enableEntityCulling()) {
context.sender().sendMessage(Component.text("Entity culling is not enabled on this server").color(NamedTextColor.RED));
plugin().senderFactory().wrap(context.sender()).sendMessage(Component.text("Entity culling is not enabled on this server").color(NamedTextColor.RED));
return;
}
Player player = context.get("player");

View File

@@ -1,5 +1,6 @@
package net.momirealms.craftengine.bukkit.plugin.network;
import com.destroystokyo.paper.ParticleBuilder;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.gson.JsonElement;

View File

@@ -1480,6 +1480,14 @@ public class BukkitServerPlayer extends Player {
return LocationUtils.toWorldPosition(this.getEyeLocation());
}
@Override
public void playParticle(Key particleId, double x, double y, double z) {
Particle particle = Registry.PARTICLE_TYPE.get(KeyUtils.toNamespacedKey(particleId));
if (particle != null) {
platformPlayer().getWorld().spawnParticle(particle, List.of(platformPlayer()), null, x, y, z, 1, 0, 0,0, 0, null, false);
}
}
public Location getEyeLocation() {
org.bukkit.entity.Player player = platformPlayer();
Location eyeLocation = player.getEyeLocation();