mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-21 12:42:50 +00:00
Added a "Preventing Decay" entry to the Miscellaneous section. Something seems a bit off with it though.
This commit is contained in:
1 parent
e5d2500374
commit
fab5e0350e
10 files changed
+83
-4
No files matched your search
@@ -27,6 +27,7 @@ import vazkii.botania.common.lib.LibMisc;
|
||||
public final class PersistentVariableHelper {
|
||||
|
||||
private static final String TAG_FIRST_LOAD = "firstLoad";
|
||||
private static final String TAG_DOG = "dog";
|
||||
private static final String TAG_BOOKMARK_COUNT = "bookmarkCount";
|
||||
private static final String TAG_BOOKMARK_PREFIX = "bookmark";
|
||||
private static final String TAG_BOOKMARKS = "bookmarks";
|
||||
@@ -37,6 +38,7 @@ public final class PersistentVariableHelper {
|
||||
private static File cacheFile;
|
||||
|
||||
public static boolean firstLoad = true;
|
||||
public static boolean dog = true;
|
||||
public static String lastBotaniaVersion = "";
|
||||
|
||||
public static void save() throws IOException {
|
||||
@@ -68,6 +70,7 @@ public final class PersistentVariableHelper {
|
||||
cmp.setTag(TAG_LEXICON_NOTES, notesCmp);
|
||||
|
||||
cmp.setBoolean(TAG_FIRST_LOAD, firstLoad);
|
||||
cmp.setBoolean(TAG_DOG, dog);
|
||||
cmp.setString(TAG_LAST_BOTANIA_VERSION, lastBotaniaVersion);
|
||||
|
||||
injectNBTToFile(cmp, getCacheFile());
|
||||
@@ -109,6 +112,8 @@ public final class PersistentVariableHelper {
|
||||
firstLoad = cmp.hasKey(TAG_FIRST_LOAD) ? cmp.getBoolean(TAG_FIRST_LOAD) : firstLoad;
|
||||
if(firstLoad)
|
||||
lastBotaniaVersion = LibMisc.VERSION;
|
||||
|
||||
dog = cmp.getBoolean(TAG_DOG);
|
||||
}
|
||||
|
||||
public static void saveSafe() {
|
||||
|
||||
@@ -36,6 +36,7 @@ import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonBack;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonInvisible;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonPage;
|
||||
import vazkii.botania.common.lexicon.DLexiconEntry;
|
||||
|
||||
public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
|
||||
@@ -143,6 +144,9 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
button.displayStack = entry.getIcon();
|
||||
if(entry == tutEntry)
|
||||
tutPage = page;
|
||||
|
||||
if(entry instanceof DLexiconEntry)
|
||||
button.dog = true;
|
||||
} else button.displayString = "";
|
||||
}
|
||||
}
|
||||
@@ -287,8 +291,12 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
ClientTickHandler.notifyPageChange();
|
||||
break;
|
||||
default :
|
||||
int index = par1GuiButton.id + page * 12;
|
||||
openEntry(index);
|
||||
if(par1GuiButton instanceof GuiButtonInvisible && ((GuiButtonInvisible) par1GuiButton).dog)
|
||||
((GuiButtonInvisible) par1GuiButton).click();
|
||||
else {
|
||||
int index = par1GuiButton.id + page * 12;
|
||||
openEntry(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
|
||||
@@ -15,28 +15,56 @@ import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.core.handler.PersistentVariableHelper;
|
||||
import vazkii.botania.client.core.helper.FontHelper;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexiconIndex;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
public class GuiButtonInvisible extends GuiButtonLexicon {
|
||||
|
||||
private static final ResourceLocation dogResource = new ResourceLocation(LibResources.GUI_DOG);
|
||||
|
||||
GuiLexiconIndex gui;
|
||||
public ItemStack displayStack = null;
|
||||
public boolean dog = false;
|
||||
float timeHover = 0;
|
||||
|
||||
boolean enableDog = false;
|
||||
double dogPos = 0;
|
||||
|
||||
public GuiButtonInvisible(GuiLexiconIndex gui, int par1, int par2, int par3, int par4, int par5, String par6Str) {
|
||||
super(par1, par2, par3, par4, par5, par6Str);
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
|
||||
public void click() {
|
||||
enableDog = true;
|
||||
PersistentVariableHelper.dog = true;
|
||||
PersistentVariableHelper.saveSafe();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if(enableDog) {
|
||||
dogPos += ClientTickHandler.delta * 10;
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(dogResource);
|
||||
float f = 1F / 64F;
|
||||
GL11.glTranslated(dogPos, 0, 0);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
vazkii.botania.client.core.helper.RenderHelper.drawTexturedModalRect(0, yPosition, zLevel + 10, (dogPos % 100 < 50) ? 23 : 0, 0, 23, 19, f, f);
|
||||
xPosition = (int) Math.max(xPosition, dogPos + 10);
|
||||
|
||||
GL11.glTranslated(-dogPos, 0, 0);
|
||||
}
|
||||
|
||||
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
boolean showStack = displayStack != null && !displayString.isEmpty();
|
||||
|
||||
@@ -47,6 +47,7 @@ public final class LibResources {
|
||||
public static final String GUI_BAUBLE_BOX = PREFIX_GUI + "baubleBox.png";
|
||||
public static final String GUI_HUD_ICONS = PREFIX_GUI + "hudIcons.png";
|
||||
public static final String GUI_STENCIL = PREFIX_GUI + "stencil.png";
|
||||
public static final String GUI_DOG = PREFIX_GUI + "dog.png";
|
||||
|
||||
public static final String ENTRY_FLOWERS = PREFIX_ENTRIES + "flowers.png";
|
||||
public static final String ENTRY_APOTHECARY = PREFIX_ENTRIES + "apothecary.png";
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [16/12/2015, 20:38:33 (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.lexicon;
|
||||
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.client.core.handler.PersistentVariableHelper;
|
||||
|
||||
public class DLexiconEntry extends BLexiconEntry {
|
||||
|
||||
public DLexiconEntry(String unlocalizedName, LexiconCategory category) {
|
||||
super(unlocalizedName, category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return !PersistentVariableHelper.dog;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -287,6 +287,7 @@ public final class LexiconData {
|
||||
public static LexiconEntry challenges;
|
||||
public static LexiconEntry cacophonium;
|
||||
public static LexiconEntry pavement;
|
||||
public static LexiconEntry preventingDecay;
|
||||
|
||||
public static LexiconEntry tcIntegration;
|
||||
public static LexiconEntry bcIntegration;
|
||||
@@ -1081,6 +1082,9 @@ public final class LexiconData {
|
||||
pavement = new BLexiconEntry(LibLexicon.MISC_PAVEMENT, categoryMisc);
|
||||
pavement.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipesPavement));
|
||||
|
||||
preventingDecay = new DLexiconEntry(LibLexicon.MISC_PRENTING_DECAY, categoryMisc);
|
||||
preventingDecay.setLexiconPages(new PageText("0")).setIcon(new ItemStack(Blocks.deadbush));
|
||||
|
||||
if(Botania.bcTriggersLoaded) {
|
||||
bcIntegration = new CLexiconEntry(LibLexicon.MISC_BC_INTEGRATION, categoryMisc, "BuildCraft");
|
||||
bcIntegration.setLexiconPages(new PageText("0")).setIcon(new ItemStack(Items.redstone));
|
||||
|
||||
@@ -258,6 +258,7 @@ public final class LibLexicon {
|
||||
public static final String MISC_CHALLENGES = "challenges";
|
||||
public static final String MISC_CACOPHONIUM = "cacophonium";
|
||||
public static final String MISC_PAVEMENT = "pavement";
|
||||
public static final String MISC_PRENTING_DECAY = "preventingDecay";
|
||||
|
||||
public static final String MISC_TC_INTEGRATION = "tcIntegration";
|
||||
public static final String MISC_BC_INTEGRATION = "bcIntegration";
|
||||
|
||||
Reference in new issue
Block a user