media cube no longer lies about granting all knowledge
This commit is contained in:
parent
b79392bc20
commit
4df5f443a0
1 changed files with 16 additions and 11 deletions
|
@ -5,6 +5,7 @@ import at.petrak.hexcasting.api.item.MediaHolderItem;
|
|||
import at.petrak.hexcasting.api.misc.DiscoveryHandlers;
|
||||
import at.petrak.hexcasting.api.misc.MediaConstants;
|
||||
import at.petrak.hexcasting.api.utils.NBTHelper;
|
||||
import at.petrak.hexcasting.common.items.ItemLoreFragment;
|
||||
import at.petrak.hexcasting.common.lib.HexItems;
|
||||
import at.petrak.hexcasting.common.lib.HexSounds;
|
||||
import net.minecraft.ChatFormatting;
|
||||
|
@ -214,7 +215,10 @@ public class ItemCreativeUnlocker extends Item implements MediaHolderItem {
|
|||
@Override
|
||||
public ItemStack finishUsingItem(ItemStack stack, Level level, LivingEntity consumer) {
|
||||
if (level instanceof ServerLevel slevel && consumer instanceof ServerPlayer player) {
|
||||
var rootAdv = slevel.getServer().getAdvancements().getAdvancement(modLoc("root"));
|
||||
var names = new ArrayList<>(ItemLoreFragment.NAMES);
|
||||
names.add(0, modLoc("root"));
|
||||
for (var name : names) {
|
||||
var rootAdv = slevel.getServer().getAdvancements().getAdvancement(name);
|
||||
if (rootAdv != null) {
|
||||
var children = new ArrayList<Advancement>();
|
||||
children.add(rootAdv);
|
||||
|
@ -232,6 +236,7 @@ public class ItemCreativeUnlocker extends Item implements MediaHolderItem {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack copy = stack.copy();
|
||||
super.finishUsingItem(stack, level, consumer);
|
||||
|
|
Loading…
Reference in a new issue