Skip to content

Commit 7c98b7e

Browse files
authored
feat: add support for components (#22)
1 parent b5c3fb1 commit 7c98b7e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/main/java/pl/szczurowsky/loottableparser/util/paper/HandleFunctionUtil.java

+7
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ public static void handleFunction(ItemStack itemStack, LootEntry lootEntry) {
6060
if (add) itemStack.setDurability((short) (itemStack.getDurability() + damage));
6161
else itemStack.setDurability((short) damage);
6262
}
63+
case "minecraft:set_components" -> {
64+
JsonObject components = jsonObject.getAsJsonObject("components");
65+
NBT.modify(itemStack, nbt -> {
66+
nbt.mergeCompound(NBT.parseNBT(components.toString()));
67+
});
68+
69+
}
6370
case "minecraft:set_nbt" -> {
6471
String tag = jsonObject.get("tag").getAsString();
6572
NBT.modify(itemStack, nbt -> {

0 commit comments

Comments
 (0)