Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server crashes if enchantment is removed with datapacks #11623

Open
david85258 opened this issue Nov 17, 2024 · 1 comment
Open

Server crashes if enchantment is removed with datapacks #11623

david85258 opened this issue Nov 17, 2024 · 1 comment
Labels

Comments

@david85258
Copy link

Stack trace

[03:06:39 ERROR]: Encountered an unexpected exception
java.lang.ExceptionInInitializerError: null
        at net.minecraft.world.inventory.EnchantmentMenu.lambda$slotsChanged$0(EnchantmentMenu.java:168) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.world.inventory.ContainerLevelAccess.lambda$execute$0(ContainerLevelAccess.java:85) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.world.inventory.ContainerLevelAccess$2.evaluate(ContainerLevelAccess.java:72) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.world.inventory.ContainerLevelAccess.execute(ContainerLevelAccess.java:84) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.world.inventory.EnchantmentMenu.slotsChanged(EnchantmentMenu.java:125) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.world.inventory.EnchantmentMenu$1.setChanged(EnchantmentMenu.java:70) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.world.SimpleContainer.setItem(SimpleContainer.java:226) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.world.inventory.Slot.set(Slot.java:66) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.world.inventory.Slot.setByPlayer(Slot.java:62) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.world.inventory.Slot.setByPlayer(Slot.java:58) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.world.inventory.EnchantmentMenu.quickMoveStack(EnchantmentMenu.java:371) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.world.inventory.AbstractContainerMenu.doClick(AbstractContainerMenu.java:576) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.world.inventory.AbstractContainerMenu.clicked(AbstractContainerMenu.java:419) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.handleContainerClick(ServerGamePacketListenerImpl.java:3258) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.network.protocol.game.ServerboundContainerClickPacket.handle(ServerboundContainerClickPacket.java:69) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.network.protocol.game.ServerboundContainerClickPacket.handle(ServerboundContainerClickPacket.java:33) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:55) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:154) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1576) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:207) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:128) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1553) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1546) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:138) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.server.MinecraftServer.managedBlock(MinecraftServer.java:1497) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1507) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1343) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:339) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
Caused by: java.lang.IllegalArgumentException: No ResourceKey[minecraft:root / minecraft:enchantment] registry entry found for key minecraft:power.
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:445) ~[guava-32.1.2-jre.jar:?]
        at org.bukkit.craftbukkit.CraftRegistry.getOrThrow(CraftRegistry.java:224) ~[paper-1.21.3.jar:1.21.3-29-be886cf]
        at org.bukkit.enchantments.Enchantment.getEnchantment(Enchantment.java:232) ~[paper-api-1.21.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.enchantments.Enchantment.<clinit>(Enchantment.java:132) ~[paper-api-1.21.3-R0.1-SNAPSHOT.jar:?]
        ... 31 more

Plugin and Datapack List

plugins
[03:07:43 INFO]: Server Plugins (0):
datapack list
[03:07:48 INFO]: There are 4 data pack(s) enabled: [vanilla (built-in)], [file/Data Pack (world)], [file/bukkit (world)], [paper (built-in)]
[03:07:48 INFO]: There are no more data packs available

Actions to reproduce (if known)

  1. Have a data pack that removes vanilla enchantments.
  2. Turn on the server and put an item on the enchanting table.

Example Data Pack: Data Pack.zip (The data pack remove some enchantments of bow)

Paper version

version
[03:10:10 INFO]: Checking version, please wait...
[03:10:10 INFO]: This server is running Paper version 1.21.3-29-master@be886cf (2024-11-15T09:07:14Z) (Implementing API version 1.21.3-R0.1-SNAPSHOT)
You are running the latest version

Other

In vanilla works fine.

@papermc-sniffer papermc-sniffer bot added the version: 1.21.3 Game version 1.21.3 label Nov 17, 2024
@Doc94
Copy link
Contributor

Doc94 commented Nov 17, 2024

Looks like the same issue than Tags... CraftBukkit expect the vanilla Registry or things cannot be deleted (before all the datadriven thing) then remove a enchantment make the "load" of the Enchantment interface (old enum) throw this...
Like in tag the solution by the moment its just make this can have null values and mention in docs you need check for avoid another issues....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants