mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 03:15:07 +00:00
Make an advancement of elven knowledge. Code side is super messy mix of old and new systems right now, but we can clean it up later.
This commit is contained in:
1 parent
f1d38877d9
commit
be6d7f610e
72 files changed
+91
-40
No files matched your search
@@ -156,7 +156,7 @@ public class LexiconEntry implements Comparable<LexiconEntry> {
|
||||
if(advancement != null)
|
||||
entry.put("advancement", advancement.toString());
|
||||
} else if(this instanceof AlfheimLexiconEntry) {
|
||||
// entry.put("advancement", ); TODO pick/make advancement for elven entries
|
||||
entry.put("advancement", "botania:main/elf_lexicon_pickup");
|
||||
} else if(this instanceof CompatLexiconEntry) {
|
||||
entry.put("flag", "|debug,mod:" + ((CompatLexiconEntry) this).mod.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@@ -246,11 +246,9 @@ public class TileAlfPortal extends TileMod implements ITickableTileEntity {
|
||||
private void resolveRecipes() {
|
||||
int i = 0;
|
||||
for(ItemStack stack : stacksIn) {
|
||||
if(!stack.isEmpty() && stack.getItem() instanceof ILexicon) {
|
||||
ILexicon lexicon = (ILexicon) stack.getItem();
|
||||
if (!lexicon.isKnowledgeUnlocked(stack, BotaniaAPI.elvenKnowledge)) {
|
||||
lexicon.unlockKnowledge(stack, BotaniaAPI.elvenKnowledge);
|
||||
ItemLexicon.setForcedPage(stack, LexiconData.elvenMessage.getUnlocalizedName());
|
||||
if(!stack.isEmpty() && stack.getItem() == ModItems.lexicon) {
|
||||
if (!stack.getOrCreateTag().getBoolean(ItemLexicon.TAG_ELVEN_UNLOCK)) {
|
||||
stack.getTag().putBoolean(ItemLexicon.TAG_ELVEN_UNLOCK, true);
|
||||
spawnItem(stack);
|
||||
stacksIn.remove(i);
|
||||
return;
|
||||
|
||||
@@ -70,6 +70,7 @@ import java.util.List;
|
||||
|
||||
public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem {
|
||||
|
||||
public static final String TAG_ELVEN_UNLOCK = "botania:elven_unlock";
|
||||
private static final String TAG_KNOWLEDGE_PREFIX = "knowledge.";
|
||||
private static final String TAG_FORCED_MESSAGE = "forcedMessage";
|
||||
private static final String TAG_QUEUE_TICKS = "queueTicks";
|
||||
@@ -84,43 +85,12 @@ public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem {
|
||||
return BookRegistry.INSTANCE.books.get(ModItems.lexicon.getRegistryName());
|
||||
}
|
||||
|
||||
/*
|
||||
@Nonnull
|
||||
@Override
|
||||
public ActionResultType onItemUse(ItemUseContext ctx) {
|
||||
PlayerEntity player = ctx.getPlayer();
|
||||
if(player == null)
|
||||
return ActionResultType.PASS;
|
||||
|
||||
World world = ctx.getWorld();
|
||||
BlockPos pos = ctx.getPos();
|
||||
if(player.isSneaking()) {
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
|
||||
if(block instanceof ILexiconable) {
|
||||
ItemStack stack = ctx.getItem();
|
||||
LexiconEntry entry = ((ILexiconable) block).getEntry(world, pos, player, stack);
|
||||
if(entry != null && isKnowledgeUnlocked(stack, entry.getKnowledgeType())) {
|
||||
Botania.proxy.setEntryToOpen(entry);
|
||||
Botania.proxy.setLexiconStack(stack);
|
||||
|
||||
openBook(player, stack, world, false);
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
} else if(world.isRemote) {
|
||||
BlockRayTraceResult mop = new BlockRayTraceResult(ctx.getHitVec(), ctx.getFace(), pos, ctx.func_221533_k());
|
||||
return Botania.proxy.openWikiPage(world, block, mop) ? ActionResultType.SUCCESS : ActionResultType.FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillItemGroup(@Nonnull ItemGroup tab, @Nonnull NonNullList<ItemStack> list) {
|
||||
if(isInGroup(tab)) {
|
||||
list.add(new ItemStack(this));
|
||||
ItemStack creative = new ItemStack(this);
|
||||
creative.getOrCreateTag().putBoolean(TAG_ELVEN_UNLOCK, true);
|
||||
for(String s : BotaniaAPI.knowledgeTypes.keySet()) {
|
||||
KnowledgeType type = BotaniaAPI.knowledgeTypes.get(s);
|
||||
unlockKnowledge(creative, type);
|
||||
@@ -128,7 +98,6 @@ public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem {
|
||||
list.add(creative);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -260,6 +229,6 @@ public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem {
|
||||
|
||||
@Override
|
||||
public boolean isElvenItem(ItemStack stack) {
|
||||
return isKnowledgeUnlocked(stack, BotaniaAPI.elvenKnowledge);
|
||||
return stack.hasTag() && stack.getTag().getBoolean(TAG_ELVEN_UNLOCK);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user