diff --git a/src/main/java/com/almostreliable/lootjs/core/entry/AbstractSimpleLootEntry.java b/src/main/java/com/almostreliable/lootjs/core/entry/AbstractSimpleLootEntry.java index 66fba10..421b583 100644 --- a/src/main/java/com/almostreliable/lootjs/core/entry/AbstractSimpleLootEntry.java +++ b/src/main/java/com/almostreliable/lootjs/core/entry/AbstractSimpleLootEntry.java @@ -2,6 +2,7 @@ import com.almostreliable.lootjs.loot.LootConditionList; import com.almostreliable.lootjs.loot.LootFunctionList; +import com.almostreliable.lootjs.util.DebugInfo; import net.minecraft.world.level.storage.loot.entries.LootPoolEntryType; import net.minecraft.world.level.storage.loot.entries.LootPoolSingletonContainer; @@ -71,4 +72,12 @@ public void setQuality(int quality) { public int getQuality() { return vanillaEntry.quality; } + + @Override + public void collectDebugInfo(DebugInfo info) { + info.push(); + when(conditions -> conditions.collectDebugInfo(info)); + getFunctions().collectDebugInfo(info); + info.pop(); + } } diff --git a/src/main/java/com/almostreliable/lootjs/core/entry/CompositeLootEntry.java b/src/main/java/com/almostreliable/lootjs/core/entry/CompositeLootEntry.java index d71724c..b744485 100644 --- a/src/main/java/com/almostreliable/lootjs/core/entry/CompositeLootEntry.java +++ b/src/main/java/com/almostreliable/lootjs/core/entry/CompositeLootEntry.java @@ -73,7 +73,7 @@ public LootConditionList getConditions() { @Override public void collectDebugInfo(DebugInfo info) { - info.add(getType().toString()); + info.add("% Composite: " + getType()); info.push(); entries(entries -> entries.collectDebugInfo(info)); when(conditions -> conditions.collectDebugInfo(info)); diff --git a/src/main/java/com/almostreliable/lootjs/core/entry/EmptyLootEntry.java b/src/main/java/com/almostreliable/lootjs/core/entry/EmptyLootEntry.java index f449d5e..4a2dfdf 100644 --- a/src/main/java/com/almostreliable/lootjs/core/entry/EmptyLootEntry.java +++ b/src/main/java/com/almostreliable/lootjs/core/entry/EmptyLootEntry.java @@ -1,7 +1,6 @@ package com.almostreliable.lootjs.core.entry; -import com.almostreliable.lootjs.loot.LootConditionList; -import com.almostreliable.lootjs.loot.LootFunctionList; +import com.almostreliable.lootjs.util.DebugInfo; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.entries.EmptyLootItem; @@ -36,4 +35,10 @@ public ItemStack create(LootContext context) { return ItemStack.EMPTY; } + + @Override + public void collectDebugInfo(DebugInfo info) { + info.add("% Empty"); + super.collectDebugInfo(info); + } } diff --git a/src/main/java/com/almostreliable/lootjs/core/entry/ItemLootEntry.java b/src/main/java/com/almostreliable/lootjs/core/entry/ItemLootEntry.java index 0362891..52090c0 100644 --- a/src/main/java/com/almostreliable/lootjs/core/entry/ItemLootEntry.java +++ b/src/main/java/com/almostreliable/lootjs/core/entry/ItemLootEntry.java @@ -1,8 +1,8 @@ package com.almostreliable.lootjs.core.entry; import com.almostreliable.lootjs.core.filters.ItemFilter; -import com.almostreliable.lootjs.loot.LootConditionList; -import com.almostreliable.lootjs.loot.LootFunctionList; +import com.almostreliable.lootjs.util.DebugInfo; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -95,4 +95,10 @@ public ItemStack create(LootContext context) { public boolean test(ItemFilter filter) { return filter.test(new ItemStack(getItem())); } + + @Override + public void collectDebugInfo(DebugInfo info) { + info.add("% Item: " + BuiltInRegistries.ITEM.getKey(getItem())); + super.collectDebugInfo(info); + } } diff --git a/src/main/java/com/almostreliable/lootjs/core/entry/LootEntry.java b/src/main/java/com/almostreliable/lootjs/core/entry/LootEntry.java index fd0f132..d70de25 100644 --- a/src/main/java/com/almostreliable/lootjs/core/entry/LootEntry.java +++ b/src/main/java/com/almostreliable/lootjs/core/entry/LootEntry.java @@ -140,7 +140,6 @@ default void collectDebugInfo(DebugInfo info) { } - default boolean isItem() { return getVanillaType() == LootPoolEntries.ITEM; } diff --git a/src/main/java/com/almostreliable/lootjs/core/entry/TableReferenceLootEntry.java b/src/main/java/com/almostreliable/lootjs/core/entry/TableReferenceLootEntry.java index 8992bbc..56c4710 100644 --- a/src/main/java/com/almostreliable/lootjs/core/entry/TableReferenceLootEntry.java +++ b/src/main/java/com/almostreliable/lootjs/core/entry/TableReferenceLootEntry.java @@ -1,5 +1,6 @@ package com.almostreliable.lootjs.core.entry; +import com.almostreliable.lootjs.util.DebugInfo; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.storage.loot.entries.LootPoolSingletonContainer; import net.minecraft.world.level.storage.loot.entries.LootTableReference; @@ -24,4 +25,10 @@ public ResourceLocation getLocation() { public void setLocation(ResourceLocation reference) { vanillaEntry.name = reference; } + + @Override + public void collectDebugInfo(DebugInfo info) { + info.add("% Table: " + vanillaEntry.name); + super.collectDebugInfo(info); + } } diff --git a/src/main/java/com/almostreliable/lootjs/core/entry/TagLootEntry.java b/src/main/java/com/almostreliable/lootjs/core/entry/TagLootEntry.java index cafbb97..928e825 100644 --- a/src/main/java/com/almostreliable/lootjs/core/entry/TagLootEntry.java +++ b/src/main/java/com/almostreliable/lootjs/core/entry/TagLootEntry.java @@ -1,7 +1,6 @@ package com.almostreliable.lootjs.core.entry; -import com.almostreliable.lootjs.loot.LootConditionList; -import com.almostreliable.lootjs.loot.LootFunctionList; +import com.almostreliable.lootjs.util.DebugInfo; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; @@ -87,4 +86,10 @@ public ItemStack create(LootContext context) { return null; } + + @Override + public void collectDebugInfo(DebugInfo info) { + info.add("% Tag: " + getTag()); + super.collectDebugInfo(info); + } } diff --git a/src/main/java/com/almostreliable/lootjs/loot/LootEntryList.java b/src/main/java/com/almostreliable/lootjs/loot/LootEntryList.java index b8da3ad..ab50adc 100644 --- a/src/main/java/com/almostreliable/lootjs/loot/LootEntryList.java +++ b/src/main/java/com/almostreliable/lootjs/loot/LootEntryList.java @@ -63,10 +63,14 @@ public void collectDebugInfo(DebugInfo info) { info.add("% Entries: ["); info.push(); + info.add("{"); + info.push(); for (LootEntry entry : this) { entry.collectDebugInfo(info); } info.pop(); + info.add("}"); + info.pop(); info.add("]"); } diff --git a/src/main/java/com/almostreliable/lootjs/loot/LootFunctionList.java b/src/main/java/com/almostreliable/lootjs/loot/LootFunctionList.java index 2a69563..d2889ab 100644 --- a/src/main/java/com/almostreliable/lootjs/loot/LootFunctionList.java +++ b/src/main/java/com/almostreliable/lootjs/loot/LootFunctionList.java @@ -4,14 +4,11 @@ import com.almostreliable.lootjs.util.DebugInfo; import com.almostreliable.lootjs.util.ListHolder; import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.functions.LootItemFunction; import net.minecraft.world.level.storage.loot.functions.LootItemFunctionType; -import net.minecraft.world.level.storage.loot.functions.LootItemFunctions; -import net.minecraft.world.level.storage.loot.providers.number.NumberProvider; import java.util.Iterator; import java.util.List; @@ -49,23 +46,6 @@ public LootFunctionList addFunction(LootItemFunction function) { return this; } - @Override - public LootFunctionList setCount(NumberProvider numberProvider) { - LootItemFunction sc = LootFunction.setCount(numberProvider); - replace(LootItemFunctions.SET_COUNT, sc); - return this; - } - - public LootFunctionList setNbt(CompoundTag nbt) { - LootItemFunction sc = LootFunction.setNbt(nbt); - replace(LootItemFunctions.SET_NBT, sc); - return this; - } - - public LootFunctionList setNBT(CompoundTag nbt) { - return setNbt(nbt); - } - public void collectDebugInfo(DebugInfo info) { if (this.isEmpty()) return; @@ -73,7 +53,11 @@ public void collectDebugInfo(DebugInfo info) { info.push(); for (var entry : this) { ResourceLocation key = BuiltInRegistries.LOOT_FUNCTION_TYPE.getKey(entry.getType()); - if (key == null) continue; + if (key == null) { + info.add(entry.getClass().getSimpleName()); + continue; + } + info.add(key.toString()); }