diff --git a/src/api/java/vazkii/botania/api/internal/IGuiLexiconEntry.java b/src/api/java/vazkii/botania/api/internal/IGuiLexiconEntry.java index c8bf6da..6e3fa38 100644 --- a/src/api/java/vazkii/botania/api/internal/IGuiLexiconEntry.java +++ b/src/api/java/vazkii/botania/api/internal/IGuiLexiconEntry.java @@ -11,6 +11,9 @@ */ package vazkii.botania.api.internal; +import java.util.List; + +import net.minecraft.client.gui.GuiButton; import vazkii.botania.api.lexicon.LexiconEntry; /** @@ -54,4 +57,26 @@ public interface IGuiLexiconEntry { * Gets the GUI's Z level for rendering. */ public float getZLevel(); + + /** + * Gets the list of buttons in this gui. + */ + public List getButtonList(); + + /** + * Gets the total amount of ticks (+ partial ticks) the player + * has been in this gui. + */ + public float getElapsedTicks(); + + /** + * Gets the current partial ticks. + */ + public float getPartialTicks(); + + /** + * Gets the delta (1F = 1 tick) between this render call + * and the last one. + */ + public float getTickDelta(); } diff --git a/src/api/java/vazkii/botania/api/lexicon/LexiconCategory.java b/src/api/java/vazkii/botania/api/lexicon/LexiconCategory.java index 7627341..b92d1f4 100644 --- a/src/api/java/vazkii/botania/api/lexicon/LexiconCategory.java +++ b/src/api/java/vazkii/botania/api/lexicon/LexiconCategory.java @@ -14,10 +14,13 @@ package vazkii.botania.api.lexicon; import java.util.ArrayList; import java.util.List; -public final class LexiconCategory { +import net.minecraft.util.ResourceLocation; + +public class LexiconCategory { public final String unlocalizedName; public final List entries = new ArrayList(); + private ResourceLocation icon; /** * @param unlocalizedName The unlocalized name of this category. This will be localized by the client display. @@ -29,4 +32,13 @@ public final class LexiconCategory { public String getUnlocalizedName() { return unlocalizedName; } + + public LexiconCategory setIcon(ResourceLocation icon) { + this.icon = icon; + return this; + } + + public ResourceLocation getIcon() { + return icon; + } } diff --git a/src/api/java/vazkii/botania/api/lexicon/LexiconPage.java b/src/api/java/vazkii/botania/api/lexicon/LexiconPage.java index f17f0c5..08f089f 100644 --- a/src/api/java/vazkii/botania/api/lexicon/LexiconPage.java +++ b/src/api/java/vazkii/botania/api/lexicon/LexiconPage.java @@ -11,6 +11,7 @@ */ package vazkii.botania.api.lexicon; +import net.minecraft.client.gui.GuiButton; import vazkii.botania.api.internal.IGuiLexiconEntry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -34,13 +35,48 @@ public abstract class LexiconPage { public abstract void renderScreen(IGuiLexiconEntry gui, int mx, int my); /** - * Called per update tick. + * Called per update tick. Non gui-sensitive version, kept for backwards compatibility only. */ @SideOnly(Side.CLIENT) public void updateScreen() { // NO-OP } + /** + * Called per update tick. Feel free to override fully, the + * call to updateScreen() is for backwards compatibility. + */ + @SideOnly(Side.CLIENT) + public void updateScreen(IGuiLexiconEntry gui) { + updateScreen(); + } + + /** + * Called when this page is opened, be it via initGui() or when the player changes page. + * You can add buttons and whatever you'd do on initGui() here. + */ + @SideOnly(Side.CLIENT) + public void onOpened(IGuiLexiconEntry gui) { + // NO-OP + } + + /** + * Called when this page is opened, be it via closing the gui or when the player changes page. + * Make sure to dispose of anything you don't use any more, such as buttons in the gui's buttonList. + */ + @SideOnly(Side.CLIENT) + public void onClosed(IGuiLexiconEntry gui) { + // NO-OP + } + + /** + * Called when a button is pressed, equivalent to GuiScreen.actionPerformed. + */ + @SideOnly(Side.CLIENT) + public void onActionPerformed(IGuiLexiconEntry gui, GuiButton button) { + // NO-OP + } + /** * Called when a key is pressed. */ diff --git a/src/api/java/vazkii/botania/api/package-info.java b/src/api/java/vazkii/botania/api/package-info.java index 82da263..30df733 100644 --- a/src/api/java/vazkii/botania/api/package-info.java +++ b/src/api/java/vazkii/botania/api/package-info.java @@ -1,4 +1,4 @@ -@API(owner = "Botania", apiVersion = "18", provides = "BotaniaAPI") +@API(owner = "Botania", apiVersion = "19", provides = "BotaniaAPI") package vazkii.botania.api; import cpw.mods.fml.common.API; diff --git a/src/api/java/vazkii/botania/api/subtile/signature/BasicSignature.java b/src/api/java/vazkii/botania/api/subtile/signature/BasicSignature.java index f72cb09..0848030 100644 --- a/src/api/java/vazkii/botania/api/subtile/signature/BasicSignature.java +++ b/src/api/java/vazkii/botania/api/subtile/signature/BasicSignature.java @@ -52,7 +52,7 @@ public class BasicSignature extends SubTileSignature { } private String unlocalizedName(String end) { - return "tile." + SubTileSignature.SPECIAL_FLOWER_PREFIX + name + end; + return "tile.botania:" + SubTileSignature.SPECIAL_FLOWER_PREFIX + name + end; } } diff --git a/src/main/java/fox/spiteful/forbidden/compat/Compat.java b/src/main/java/fox/spiteful/forbidden/compat/Compat.java index b55f123..b9aaf0b 100644 --- a/src/main/java/fox/spiteful/forbidden/compat/Compat.java +++ b/src/main/java/fox/spiteful/forbidden/compat/Compat.java @@ -2,6 +2,7 @@ package fox.spiteful.forbidden.compat; import fox.spiteful.forbidden.*; import fox.spiteful.forbidden.tiles.SubTileEuclidaisy; +import fox.spiteful.forbidden.tiles.SubTileWhisperweed; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -32,6 +33,7 @@ import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; import vazkii.botania.api.lexicon.LexiconCategory; import vazkii.botania.api.lexicon.LexiconPage; +import vazkii.botania.api.recipe.RecipePetals; import java.lang.reflect.Constructor; import java.util.List; @@ -266,9 +268,24 @@ public class Compat { tag.setString("type", "euclidaisy"); euclidaisy.setTagCompound(tag); - InfusionRecipe euclid = ThaumcraftApi.addInfusionCraftingRecipe("EUCLIDAISY", euclidaisy, 8, (new AspectList()).add(Aspect.AURA, 8).add(Aspect.ELDRITCH, 10).add(Aspect.MAGIC, 8), new ItemStack(flower, 1, 6), new ItemStack[] { new ItemStack(ConfigItems.itemResource, 1, 14), new ItemStack(resource, 1, 8), new ItemStack(resource, 1, 6), new ItemStack(manaPetal, 1, 6), new ItemStack(manaPetal, 1, 6), new ItemStack(rune, 1, 12), new ItemStack(rune, 1, 11) }); + InfusionRecipe euclid = ThaumcraftApi.addInfusionCraftingRecipe("EUCLIDAISY", euclidaisy, 8, (new AspectList()).add(Aspect.AURA, 8).add(Aspect.ELDRITCH, 10).add(Aspect.MAGIC, 8), new ItemStack(flower, 1, 6), new ItemStack[] { new ItemStack(ConfigItems.itemResource, 1, 14), new ItemStack(resource, 1, 1), new ItemStack(resource, 1, 6), new ItemStack(manaPetal, 1, 6), new ItemStack(manaPetal, 1, 6), new ItemStack(rune, 1, 12), new ItemStack(rune, 1, 11) }); (new DarkResearchItem("EUCLIDAISY", "FORBIDDEN", "[B]", (new AspectList()).add(Aspect.PLANT, 8).add(Aspect.MAGIC, 4).add(Aspect.AURA, 12), -7, 5, 3, euclidaisy)).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.EUCLIDAISY.1"), new ResearchPage(euclid) }).setParents(new String[] { "INFAUXSION" }).setConcealed().registerResearchItem(); + BotaniaAPI.registerSubTile("whisperweed", SubTileWhisperweed.class); + BotaniaAPI.registerSubTileSignature(SubTileWhisperweed.class, new DarkSignature("whisperweed")); + BotaniaAPI.addSubTileToCreativeMenu("whisperweed"); + + SubTileWhisperweed.lexicon = new ForbiddenLexicon("whisperweed", functional); + + SubTileWhisperweed.lexicon.addPage(BotaniaAPI.internalHandler.textPage("forbidden.lexicon.whisperweed.0")); + + ItemStack whisperweed = new ItemStack(specialFlower, 1, 0); + NBTTagCompound wtag = new NBTTagCompound(); + wtag.setString("type", "whisperweed"); + whisperweed.setTagCompound(wtag); + RecipePetals whispercraft = BotaniaAPI.registerPetalRecipe(whisperweed, new ItemStack(resource, 1, 2), new ItemStack(resource, 1, 6), new ItemStack(ConfigItems.itemResource, 1, 9), new ItemStack(manaPetal, 1, 7), new ItemStack(manaPetal, 1, 10), new ItemStack(rune, 1, 14), new ItemStack(ConfigItems.itemResource, 1, 6)); + SubTileWhisperweed.lexicon.addPage(BotaniaAPI.internalHandler.petalRecipePage("forbidden.lexicon.whisperweed.1", whispercraft)); + } catch (Throwable e) { LogHandler.log(Level.INFO, e, "Forbidden Magic: Botania? Do you wanna build a snowman?"); botan = false; diff --git a/src/main/java/fox/spiteful/forbidden/compat/DarkSignature.java b/src/main/java/fox/spiteful/forbidden/compat/DarkSignature.java index 1874da9..38fcc1b 100644 --- a/src/main/java/fox/spiteful/forbidden/compat/DarkSignature.java +++ b/src/main/java/fox/spiteful/forbidden/compat/DarkSignature.java @@ -1,9 +1,9 @@ package fox.spiteful.forbidden.compat; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import vazkii.botania.api.subtile.signature.SubTileSignature; + import net.minecraft.client.renderer.texture.IIconRegister; + import net.minecraft.item.ItemStack; + import net.minecraft.util.IIcon; + import vazkii.botania.api.subtile.signature.SubTileSignature; public class DarkSignature extends SubTileSignature { String name; @@ -25,11 +25,11 @@ public class DarkSignature extends SubTileSignature { @Override public String getUnlocalizedNameForStack(ItemStack item){ - return "tile.darkflower." + name + ".name"; + return "darkflower." + name; } @Override public String getUnlocalizedLoreTextForStack(ItemStack item){ return "tile.darkflower." + name + ".lore"; } -} +} \ No newline at end of file diff --git a/src/main/java/fox/spiteful/forbidden/tiles/SubTileEuclidaisy.java b/src/main/java/fox/spiteful/forbidden/tiles/SubTileEuclidaisy.java index 162c93d..43e5f17 100644 --- a/src/main/java/fox/spiteful/forbidden/tiles/SubTileEuclidaisy.java +++ b/src/main/java/fox/spiteful/forbidden/tiles/SubTileEuclidaisy.java @@ -1,5 +1,6 @@ package fox.spiteful.forbidden.tiles; +import fox.spiteful.forbidden.compat.DarkSignature; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; @@ -9,6 +10,7 @@ import thaumcraft.api.aspects.AspectList; import thaumcraft.common.Thaumcraft; import thaumcraft.common.config.ConfigItems; import thaumcraft.common.items.ItemWispEssence; +import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.lexicon.LexiconEntry; import vazkii.botania.api.subtile.SubTileFunctional; @@ -69,4 +71,9 @@ public class SubTileEuclidaisy extends SubTileFunctional { public LexiconEntry getEntry(){ return lexicon; } + + @Override + public IIcon getIcon(){ + return ((DarkSignature)(BotaniaAPI.getSignatureForName("euclidaisy"))).getIconForStack(null); + } } diff --git a/src/main/java/fox/spiteful/forbidden/tiles/SubTileWhisperweed.java b/src/main/java/fox/spiteful/forbidden/tiles/SubTileWhisperweed.java new file mode 100644 index 0000000..deacdb8 --- /dev/null +++ b/src/main/java/fox/spiteful/forbidden/tiles/SubTileWhisperweed.java @@ -0,0 +1,81 @@ +package fox.spiteful.forbidden.tiles; + +import fox.spiteful.forbidden.compat.DarkSignature; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.common.Thaumcraft; +import thaumcraft.common.lib.network.PacketHandler; +import thaumcraft.common.lib.network.playerdata.PacketAspectPool; +import thaumcraft.common.lib.network.playerdata.PacketSyncWarp; +import thaumcraft.common.lib.network.playerdata.PacketWarpMessage; +import vazkii.botania.api.BotaniaAPI; +import vazkii.botania.api.lexicon.LexiconEntry; +import vazkii.botania.api.subtile.SubTileFunctional; + +import java.util.List; + +public class SubTileWhisperweed extends SubTileFunctional { + private static final int cost = 1500; + private final static int range = 3; + public static LexiconEntry lexicon; + + @Override + public void onUpdate(){ + super.onUpdate(); + + if(redstoneSignal > 0) + return; + + if(!supertile.getWorldObj().isRemote && mana >= cost && supertile.getWorldObj().getTotalWorldTime() % 300 == 0) { + List players = supertile.getWorldObj().getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord - range, supertile.zCoord - range, supertile.xCoord + range + 1, supertile.yCoord + range + 1, supertile.zCoord + range + 1)); + if(players.size() > 0) { + EntityPlayer player = players.get(supertile.getWorldObj().rand.nextInt(players.size())); + int amt = 1 + player.worldObj.rand.nextInt(3); + if(player.worldObj.rand.nextInt(10) < 2){ + amt += 1 + player.worldObj.rand.nextInt(3); + Thaumcraft.addWarpToPlayer(player, 1 + player.worldObj.rand.nextInt(5), true); + } + + for(int a = 0; a < amt; ++a) { + Aspect aspect; + if(player.worldObj.rand.nextInt(25) > 2) + aspect = (Aspect)Aspect.getPrimalAspects().get(player.worldObj.rand.nextInt(6)); + else + aspect = (Aspect)Aspect.getCompoundAspects().get(player.worldObj.rand.nextInt(Aspect.getCompoundAspects().size())); + Thaumcraft.proxy.playerKnowledge.addAspectPool(player.getCommandSenderName(), aspect, (short)1); + PacketHandler.INSTANCE.sendTo(new PacketAspectPool(aspect.getTag(), (short)1, Short.valueOf(Thaumcraft.proxy.playerKnowledge.getAspectPoolFor(player.getCommandSenderName(), aspect))), (EntityPlayerMP)player); + } + mana -= cost; + } + + } + } + + @Override + public int getColor(){ + return 0x745380; + } + + @Override + public int getMaxMana() { + return cost; + } + + @Override + public boolean acceptsRedstone() { + return true; + } + + @Override + public LexiconEntry getEntry(){ + return lexicon; + } + + @Override + public IIcon getIcon(){ + return ((DarkSignature)(BotaniaAPI.getSignatureForName("whisperweed"))).getIconForStack(null); + } +} diff --git a/src/main/resources/assets/forbidden/lang/en_US.lang b/src/main/resources/assets/forbidden/lang/en_US.lang index bd3a9fa..c2b106a 100644 --- a/src/main/resources/assets/forbidden/lang/en_US.lang +++ b/src/main/resources/assets/forbidden/lang/en_US.lang @@ -80,7 +80,8 @@ tile.InkFlower.name=Umbral Rose tile.WrathCage.name=Wrath Cage tile.StarBlock.name=Nether Star Block tile.blackRoseBush.name=Umbral Rose Bush -tile.darkflower.euclidaisy.name=Euclidaisy +darkflower.euclidaisy.name=Euclidaisy +darkflower.whisperweed.name=Whisperweed # # Enchantments enchantment.cluster=Fiery Core @@ -99,8 +100,6 @@ potion.blood_seal=Blood Seal itemGroup.forbidden=Forbidden Magic itemGroup.mobcrystal=Imprinting Crystals tc.research_category.FORBIDDEN=Apocrypha -forbidden.lexicon.euclidaisy=Euclidaisy -forbidden.lexicon.euclidaisy.0=The eerie, pink &1Euclidaisy&0 is an oddity. It uses large amounts of mana to conjure some sort of ethereal substance that only seems useful to thaumaturges.
The method of creating one doesn't appear to be common knowledge. Try consulting a Thaumonomicon? # # Research forbidden.research_name.NETHERSHARDS=Nether Shards @@ -268,4 +267,10 @@ forbidden.research_page.HELLFIRE.1=Getting stranded in the Nether is the worst. forbidden.research_name.EUCLIDAISY=Euclidaisy forbidden.research_text.EUCLIDAISY=Mai waifu's power level is over 9000 in the name of the moon! Believe it! forbidden.research_page.EUCLIDAISY.1=Ethereal Essences are extremely useful sources of essentia and are a very important ingredient in Thaumaturge's Salt. Unfortunately, it can be very difficult to come by. Wisps aren't exactly common, and no self-respecting thaumaturge wants to stoop to smashing open a node.

By combining thaumaturgy and hedge magic, you've created a flower that can use mana to rip open the fabric of reality. The rip isn't stable enough to form a node, but it does stay open long enough to drop a single wispy strand of essence. Applying a redstone signal to the flower causes it to stop. -# \ No newline at end of file +# +# Lexicon +forbidden.lexicon.euclidaisy=Euclidaisy +forbidden.lexicon.euclidaisy.0=The eerie, pink &1Euclidaisy&0 is an oddity. It uses large amounts of mana to conjure some sort of ethereal substance that only seems useful to thaumaturges.
The method of creating one doesn't appear to be common knowledge. Try consulting a Thaumonomicon? +forbidden.lexicon.whisperweed=Whisperweed +forbidden.lexicon.whisperweed.0=The &1Whisperweed&0 is an unpleasant plant that whispers secrets into the ears of anyone who'll listen. There doesn't seem to be much point to the plant, since the secrets aren't even relevant to botany.
Some of the whispers are too disturbing for the mortal mind... +forbidden.lexicon.whisperweed.1=&oMore secrets than Wan Shi Tong&r. \ No newline at end of file diff --git a/src/main/resources/assets/forbidden/textures/blocks/whisperweed.png b/src/main/resources/assets/forbidden/textures/blocks/whisperweed.png new file mode 100644 index 0000000..48e2eef Binary files /dev/null and b/src/main/resources/assets/forbidden/textures/blocks/whisperweed.png differ