diff --git a/bukkit/compatibility/src/main/java/net/momirealms/craftengine/bukkit/compatibility/BukkitCompatibilityManager.java b/bukkit/compatibility/src/main/java/net/momirealms/craftengine/bukkit/compatibility/BukkitCompatibilityManager.java index 8e4f5785e..c4ca0328e 100644 --- a/bukkit/compatibility/src/main/java/net/momirealms/craftengine/bukkit/compatibility/BukkitCompatibilityManager.java +++ b/bukkit/compatibility/src/main/java/net/momirealms/craftengine/bukkit/compatibility/BukkitCompatibilityManager.java @@ -20,7 +20,6 @@ import net.momirealms.craftengine.bukkit.compatibility.worldedit.WorldEditBlockR import net.momirealms.craftengine.bukkit.font.BukkitFontManager; import net.momirealms.craftengine.bukkit.item.BukkitItemManager; import net.momirealms.craftengine.bukkit.plugin.BukkitCraftEngine; -import net.momirealms.craftengine.bukkit.util.KeyUtils; import net.momirealms.craftengine.core.entity.furniture.ExternalModel; import net.momirealms.craftengine.core.entity.player.Player; import net.momirealms.craftengine.core.loot.LootConditions; @@ -33,7 +32,6 @@ import net.momirealms.craftengine.core.util.Key; import net.momirealms.craftengine.core.util.VersionHelper; import net.momirealms.craftengine.core.world.WorldManager; import org.bukkit.Bukkit; -import org.bukkit.Registry; import org.bukkit.plugin.Plugin; import java.util.*; @@ -252,8 +250,6 @@ public class BukkitCompatibilityManager implements CompatibilityManager { weBlockRegister.register(newBlockId); } } catch (Exception e) { - // 检查是不是有插件干预了注册表 - if (Registry.MATERIAL.get(KeyUtils.toNamespacedKey(BukkitBlockManager.instance().blockRegisterOrder().getFirst())) != null) return; this.plugin.logger().warn("Failed to initialize world edit hook", e); } } diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/injector/BlockStateGenerator.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/injector/BlockStateGenerator.java index 9281595d8..148fa9e3d 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/injector/BlockStateGenerator.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/plugin/injector/BlockStateGenerator.java @@ -243,14 +243,14 @@ public final class BlockStateGenerator { @RuntimeType public boolean intercept(@This Object thisObj, @AllArguments Object[] args) { - DelegatingBlockState customState = (DelegatingBlockState) thisObj; - ImmutableBlockState thisState = customState.blockState(); - if (thisState == null) return false; - CustomBlock thisBlock = thisState.owner().value(); Object block = FastNMS.INSTANCE.method$Holder$value(args[0]); if (!(block instanceof DelegatingBlock delegatingBlock)) return false; BlockBehavior behavior = delegatingBlock.behaviorDelegate().value(); if (behavior == null) return false; + DelegatingBlockState customState = (DelegatingBlockState) thisObj; + ImmutableBlockState thisState = customState.blockState(); + if (thisState == null) return false; + CustomBlock thisBlock = thisState.owner().value(); return behavior.block().equals(thisBlock); } } @@ -260,16 +260,16 @@ public final class BlockStateGenerator { @RuntimeType public boolean intercept(@This Object thisObj, @AllArguments Object[] args) { - DelegatingBlockState customState = (DelegatingBlockState) thisObj; - ImmutableBlockState thisState = customState.blockState(); - if (thisState == null) return false; - CustomBlock thisBlock = thisState.owner().value(); Object block = FastNMS.INSTANCE.method$HolderGetter$getResourceKey(MBuiltInRegistries.BLOCK, args[0]) .map(FastNMS.INSTANCE::method$Holder$value) .orElse(null); if (!(block instanceof DelegatingBlock delegatingBlock)) return false; BlockBehavior behavior = delegatingBlock.behaviorDelegate().value(); if (behavior == null) return false; + DelegatingBlockState customState = (DelegatingBlockState) thisObj; + ImmutableBlockState thisState = customState.blockState(); + if (thisState == null) return false; + CustomBlock thisBlock = thisState.owner().value(); return behavior.block().equals(thisBlock); } }