Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c5c51e6fa | ||
|
|
37379acd3d | ||
|
|
3f62d4b8fe | ||
|
|
2257f1648c | ||
|
|
cefdfd7ca6 | ||
|
|
c802a448e4 | ||
|
|
daae5de075 | ||
|
|
abd62c1076 | ||
|
|
8e709b0190 | ||
|
|
a16181c480 | ||
|
|
9f9c413b48 | ||
|
|
31eb7b3516 | ||
|
|
d213b7bf0a | ||
|
|
c168882a48 | ||
|
|
073ae658b5 | ||
|
|
0e88bd8a9c | ||
|
|
9d1709dd74 | ||
|
|
ffdce1834c | ||
|
|
3fa2240e61 | ||
|
|
ec99a884b6 | ||
|
|
944aec7441 | ||
|
|
9d677e7734 | ||
|
|
0852f91ba7 | ||
|
|
38845602a9 | ||
|
|
4878e88fce | ||
|
|
fa850857e8 | ||
|
|
e0a0b1ec53 | ||
|
|
d42076af69 | ||
|
|
610dad28b7 |
No files matched your search
@@ -0,0 +1,17 @@
|
||||
name: Optimize images
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, main, release/** ]
|
||||
paths:
|
||||
- "**/*.png"
|
||||
|
||||
push:
|
||||
branches: [ master, main, release/** ]
|
||||
paths:
|
||||
- "**/*.png"
|
||||
|
||||
jobs:
|
||||
optimize-images:
|
||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.yml@master
|
||||
secrets: inherit
|
||||
@@ -1,40 +0,0 @@
|
||||
Hey there. Looks like you want to contribute with an issue. Great. Here's what you have to do:
|
||||
* Have a look through the [Botania FAQ](http://botaniamod.net/faq.php), to see if your issue has been solved already;
|
||||
* Read through the steps on [Bug Reporting 101](http://vazkii.us/br101/) (You may skip this if you're already familiar with reporting issues, but it's good for newcomers);
|
||||
* Note the following points:
|
||||
* Issues regarding MCPC+/Cauldron that are not reproducible with forge only are **not accepted**;
|
||||
* Issues regarding outdated versions of the mod are **not accepted**;
|
||||
* Unless you manually update every mod on the pack to the latest, issues regarding any public modpack that is not officially maintained or supported by the botania developers (the ones in the modpack section of the website are not) are **not accepted**;
|
||||
* Duplicate issues or issues that have been solved already (use the search feature!) will be closed without asking.
|
||||
* Do not tag your issues' names. "Something Broke" is prefered to "[Bug] Something Broke" because there's a proper label system in place.
|
||||
* Suggestions are **not** accepted here. Post them on the forums or reddit instead. If there's any still open they're old ones before this rule was added.
|
||||
|
||||
The following "bugs" are not accepted:
|
||||
* Intended Behaviour
|
||||
* Double tall flowers need be harvested with shears to not clutter the inventory
|
||||
* Already fixed but people keep reporting it for some reason
|
||||
* Wearing a Ring of Loki or Ring of the Aesir shows a wireframe below bedrock
|
||||
* Not a botania problem/Not fixable
|
||||
* Crash on startup with ChromatiCraft installed (update CC)
|
||||
* Crash on startup with Blocks3D Mod installed
|
||||
* Crash on opening the Lexica Botania with Enchiridion installed (update Enchiridion)
|
||||
* Flowers don't render (Optifine issue)
|
||||
* Mana Bursts get destroyed on Cauldron by the ClearLagg plugin (add botania:manaBurst to the ClearLagg blacklist)
|
||||
* Force Relays destroy blocks when used very fast (Can't fix due to the nature of the block)
|
||||
* Terrasteel crafting won't start (make sure your checkerboard is correct, there's Livingrock under the plate)
|
||||
* The Horn of the Canopy doesn't break Thaumcraft leaves (Thaumcraft doesn't use the typical class or material)
|
||||
* Some Baubles don't work properly on LAN (Baubles bug)
|
||||
|
||||
[Report the Issue](https://github.com/Vazkii/Botania/issues)!
|
||||
|
||||
You can find me at most times on [#vazkii @ irc.esper.net](http://webchat.esper.net/?channels=vazkii), if you need to speak with me about the issue you would report. Just make sure to use common sense and read what the bot tells you.
|
||||
|
||||
---
|
||||
|
||||
If you want to make a Pull Request keep these in mind:
|
||||
* Do NOT use the github editor. Test your damn PRs before you submit them.
|
||||
* I'm very strict when it comes to syntax. Make sure your PR's syntax matches the syntax of the rest of the code. That includes spacing after if/for/(etc), proper bracket usage, camel casing and copyleft headers on new classes.
|
||||
* If your pull request edits very small chunks of code and isn't flawless I'll close it as it'll probably take less time to fix it myself rather than pull yours and change the code.
|
||||
* Unless you have a very good reason for it, keep your PRs all in one commit. You can do it with [rebase](https://git-scm.com/docs/git-rebase).
|
||||
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:Baubles-Expanded:2.2.6-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:GTNHLib:0.8.44:dev')
|
||||
api('com.github.GTNewHorizons:Baubles-Expanded:2.2.21-GTNH:dev')
|
||||
implementation('com.github.GTNewHorizons:GTNHLib:0.11.35:dev')
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.48:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.7.2:dev') {transitive=false}
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.48-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.17.12:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.2.5-GTNH:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.63:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.7.11:dev') {transitive=false}
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.118-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.17.30:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.2.26-GTNH:api') {transitive=false}
|
||||
compileOnly('curse.maven:cofh-lib-220333:2388748')
|
||||
compileOnly('curse.maven:minefactory-reloaded-66672:2366150')
|
||||
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
compileOnly("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
|
||||
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:StructureLib:1.4.25:dev")
|
||||
compileOnly("com.github.GTNewHorizons:StructureLib:1.4.42:dev")
|
||||
}
|
||||
|
||||
@@ -39,14 +39,34 @@ remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/co
|
||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||
developmentEnvironmentUserName = Developer
|
||||
|
||||
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
||||
# See https://github.com/bsideup/jabel for details on how this works.
|
||||
enableModernJavaSyntax = true
|
||||
# Enables modern Java syntax support. Valid values:
|
||||
# - false: No modern syntax, Java 8 only
|
||||
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
|
||||
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
|
||||
# - modern: Native modern Java bytecode, no downgrading
|
||||
enableModernJavaSyntax = jvmDowngrader
|
||||
|
||||
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
|
||||
# and should *not* be used in most situations. -1 disables this.
|
||||
# forceToolchainVersion = -1
|
||||
|
||||
# Target JVM version for JVM Downgrader bytecode downgrading.
|
||||
# Only used when enableModernJavaSyntax = jvmDowngrader
|
||||
# downgradeTargetVersion = 8
|
||||
|
||||
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
|
||||
# Classes will be available in META-INF/versions/N/ for each version N in this list.
|
||||
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
|
||||
# jvmDowngraderMultiReleaseVersions = 21,25
|
||||
|
||||
# Specifies how JVM Downgrader API stubs are provided. Options:
|
||||
# - shade: Shade minimized stubs into the jar
|
||||
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
|
||||
# - external: Another dependency provides stubs (no constraint, no warning)
|
||||
# - (empty): Warning reminding you to configure stubs
|
||||
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
|
||||
jvmDowngraderStubsProvider = gtnhlib
|
||||
|
||||
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
||||
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||
enableGenericInjection = true
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/b41931cf1e70bc8e08d7dd19c343ef00/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/b41931cf1e70bc8e08d7dd19c343ef00/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/46949723aaa20c7b64d7ecfed7207034/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/d6690dfd71c4c91e08577437b5b2beb0/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/b41931cf1e70bc8e08d7dd19c343ef00/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/3cd7045fca9a72cd9bc7d14a385e594c/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/552c7bffe0370c66410a51c55985b511/redirect
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/97d46b5ff4df0bf61e95652a190a5567/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/9ef54a08e06b0754cee9fc95ed3a3134/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/97d46b5ff4df0bf61e95652a190a5567/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/9ef54a08e06b0754cee9fc95ed3a3134/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1df82b76031285ef2e6a4f59ffe9299d/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/c7d5be6a02945ac2e045048ee54a7d32/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/97d46b5ff4df0bf61e95652a190a5567/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/9ef54a08e06b0754cee9fc95ed3a3134/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/643f404f769811f5f265fd66f7af5d89/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/38256085a73e137cb4937ea9c4807fec/redirect
|
||||
toolchainVersion=25
|
||||
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
|
||||
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.10'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.27'
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,12 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
||||
/**
|
||||
* The class for a Brew definition, each one is a singleton.
|
||||
* A type of brew that can be created in the Botanical Brewery.
|
||||
*
|
||||
* <p>
|
||||
* Each instance of this class represents a single <i>type</i> of brew that can be created in the brewery, similarly
|
||||
* to how {@link net.minecraft.item.Item} and {@link net.minecraft.block.Block} work.
|
||||
* </p>
|
||||
*/
|
||||
public class Brew {
|
||||
|
||||
@@ -31,11 +36,12 @@ public class Brew {
|
||||
boolean canInfuseIncense = true;
|
||||
|
||||
/**
|
||||
* @param key The key for this brew, used in NBT and the global map.
|
||||
* @param name The unlocalized name of this potion.
|
||||
* @param color The color for the potion to be rendered in the bottle, note that it will get
|
||||
* changed a bit when it renders (for more or less brightness) to give a fancy effect.
|
||||
* @param cost The cost, in Mana for this brew.
|
||||
* @param effects A list of effects to apply to the player when they drink it.
|
||||
* @param color The color for the potion to be rendered in the bottle. Note that it will get
|
||||
* changed a bit when it renders (for more or less brightness) to give a fancy effect.
|
||||
* @param cost The cost, in Mana for this brew. Must be positive.
|
||||
* @param effects A list of potion effects to apply to the player when they drink it.
|
||||
*/
|
||||
public Brew(String key, String name, int color, int cost, PotionEffect... effects) {
|
||||
this.key = key;
|
||||
@@ -101,14 +107,14 @@ public class Brew {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the insensitive unlocalized mana cost. This is used for the lexicon.
|
||||
* Get the item-insensitive mana cost. This is used for the lexicon and for crafting costs.
|
||||
*/
|
||||
public int getManaCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the mana cost for the ItemStack passed in.
|
||||
* Gets the mana cost for the ItemStack passed in. In standard Botania, this is used only by the Cursed Blood Pendant.
|
||||
*/
|
||||
public int getManaCost(ItemStack stack) {
|
||||
return getManaCost();
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package vazkii.botania.api.brew;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
/**
|
||||
* Utility methods for checking the properties of {@link ItemStack}s related to Brews.
|
||||
*/
|
||||
public final class BrewUtilities {
|
||||
|
||||
/**
|
||||
* Check if an {@link ItemStack} represents a filled Brew.
|
||||
*
|
||||
* @param stack The stack to check
|
||||
* @return Whether this item contains a Brew.
|
||||
*/
|
||||
public static boolean isFilledBrew(ItemStack stack) {
|
||||
if (!(stack.getItem() instanceof IBrewItem brewItem)) return false;
|
||||
final Brew brew = brewItem.getBrew(stack);
|
||||
return brew != null && brew != BotaniaAPI.fallbackBrew;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an {@link ItemStack} is an empty Brew Container - an item that can go on the middle pedestal of the Botanical Brewery.
|
||||
*
|
||||
* @param stack The stack to check
|
||||
* @return Whether this item is a Brew Container that does not contain a Brew.
|
||||
*/
|
||||
public static boolean isEmptyBrewContainer(ItemStack stack) {
|
||||
return stack.getItem() instanceof IBrewContainer && !isFilledBrew(stack);
|
||||
}
|
||||
}
|
||||
@@ -10,26 +10,32 @@
|
||||
*/
|
||||
package vazkii.botania.api.brew;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* An Item that implements this counts as a Brew Container, by which
|
||||
* it can be used a center item for brew recipes and can contain
|
||||
* a brew.
|
||||
* An {@link Item} that implements this counts as a Brew Container, which allows it to be used a center item in the Botanical Brewery.
|
||||
*/
|
||||
public interface IBrewContainer {
|
||||
|
||||
/**
|
||||
* Returs an ItemStack that should be an item that has the brew
|
||||
* passed in.
|
||||
* Fills an {@link ItemStack} of this container with a {@link Brew}.
|
||||
* If the brew cannot be applied to this container, returns null instead.
|
||||
*
|
||||
* @param brew The brew which may or may not be applicable to this container.
|
||||
* @param stack The stack of this item which is being filled. This stack is not mutated.
|
||||
* @return A <i>new</i> {@link ItemStack} containing an {@link IBrewItem}, or null if this brew is not applicable.
|
||||
* @apiNote The returned stack does not necessarily have to be the same {@link Item} as the empty container.
|
||||
*/
|
||||
public ItemStack getItemForBrew(Brew brew, ItemStack stack);
|
||||
ItemStack getItemForBrew(Brew brew, ItemStack stack);
|
||||
|
||||
/**
|
||||
* Gets the cost to add this brew onto this container. Return -1
|
||||
* to not allow for the brew to be added. Normally you'd
|
||||
* use brew.getManaCost(stack);
|
||||
* Gets the cost to add this brew onto this container. The cost must be a positive number.
|
||||
*
|
||||
* @param brew The brew being applied, which must be applicable to this container. {@link IBrewContainer#getItemForBrew(Brew, ItemStack)} can be used to determine whether the brew is applicable.
|
||||
* @param stack A stack of this empty container. This stack is not mutated.
|
||||
* @return The mana cost for this recipe, which is a positive number.
|
||||
*/
|
||||
public int getManaCost(Brew brew, ItemStack stack);
|
||||
int getManaCost(Brew brew, ItemStack stack);
|
||||
|
||||
}
|
||||
@@ -10,15 +10,26 @@
|
||||
*/
|
||||
package vazkii.botania.api.brew;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
/**
|
||||
* An Item that implements this is a Brew item, by which it contains
|
||||
* a brew. This is only used in vanilla to prevent the brew item
|
||||
* from going back into the brewery but other mods might use it for whatever.
|
||||
* An {@link Item} that implements this is an item which can contain a {@link Brew}.
|
||||
* <p>
|
||||
* This is used in standard Botania to prevent finished brews from going back into the brewery & to enable NEI searches.
|
||||
* However, other mods might use it for other purposes.
|
||||
* </p>
|
||||
*/
|
||||
public interface IBrewItem {
|
||||
|
||||
public Brew getBrew(ItemStack brew);
|
||||
/**
|
||||
* Get the brew contained within a stack of this item.
|
||||
*
|
||||
* @param brew A stack of this item whose contents are being queried.
|
||||
* @return The brew within this container, or {@link BotaniaAPI#fallbackBrew} or null if the stack does not contain
|
||||
* a valid brew.
|
||||
*/
|
||||
Brew getBrew(ItemStack brew);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package vazkii.botania.api.mana;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public interface ITieredManaTooltipDisplay extends IManaTooltipDisplay {
|
||||
/**
|
||||
* Returns the text to use for the top-left side of the mana bar
|
||||
* @param stack the item being rendered
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Nonnull
|
||||
String getLeftManaLabel(@Nonnull ItemStack stack);
|
||||
|
||||
/**
|
||||
* Returns the text to use for the top-right side of the mana bar
|
||||
* @param stack the item being rendered
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Nonnull
|
||||
String getRightManaLabel(@Nonnull ItemStack stack);
|
||||
|
||||
/**
|
||||
* Should the mana bar use the rainbow effect
|
||||
* @param stack the item being rendered
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
boolean isRainbowEffect(@Nonnull ItemStack stack);
|
||||
|
||||
/**
|
||||
* Indicate the mana level boundaries for this item.
|
||||
*/
|
||||
@Nonnull
|
||||
int[] getManaTiers(@Nonnull ItemStack stack);
|
||||
}
|
||||
@@ -32,7 +32,9 @@ import vazkii.botania.common.core.helper.MathHelper;
|
||||
public final class BossBarHandler {
|
||||
|
||||
public static final ResourceLocation defaultBossBar = new ResourceLocation(LibResources.GUI_BOSS_BAR);
|
||||
static IBotaniaBoss currentBoss;
|
||||
private static IBotaniaBoss currentBoss;
|
||||
private static Entity lastBossEntity;
|
||||
private static String lastBossName;
|
||||
|
||||
private static final BarCallback barUniformCallback = new BarCallback();
|
||||
|
||||
@@ -47,7 +49,13 @@ public final class BossBarHandler {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Rectangle bgRect = currentBoss.getBossBarTextureRect();
|
||||
Rectangle fgRect = currentBoss.getBossBarHPTextureRect();
|
||||
String name = currentBoss.func_145748_c_().getFormattedText();
|
||||
Entity e = (Entity) currentBoss;
|
||||
String name;
|
||||
if(lastBossEntity != e) {
|
||||
name = currentBoss.func_145748_c_().getFormattedText();
|
||||
lastBossEntity = e;
|
||||
lastBossName = name;
|
||||
} else name = lastBossName;
|
||||
int c = res.getScaledWidth() / 2;
|
||||
int x = c - bgRect.width / 2;
|
||||
int y = 20;
|
||||
@@ -66,7 +74,6 @@ public final class BossBarHandler {
|
||||
mc.fontRenderer.drawStringWithShadow(name, tx, y - 10, 0xA2018C);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
Entity e = (Entity) currentBoss;
|
||||
EntityPlayer p = mc.thePlayer;
|
||||
if(e.isDead || !p.worldObj.loadedEntityList.contains(e) || MathHelper.pointDistanceSpace(e.posX, e.posY, e.posZ, p.posX, p.posY, p.posZ) > 32)
|
||||
currentBoss = null;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
@@ -30,13 +31,16 @@ import org.lwjgl.input.Keyboard;
|
||||
|
||||
import vazkii.botania.api.corporea.CorporeaHelper;
|
||||
import vazkii.botania.common.lib.LibObfuscation;
|
||||
import vazkii.botania.utils.ReflectionUtils;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
public class CorporeaAutoCompleteHandler {
|
||||
|
||||
private static final Field COMPLETE_FLAG = ReflectionUtils.findField(GuiChat.class, LibObfuscation.COMPLETE_FLAG);
|
||||
private static final Field INPUT_FIELD = ReflectionUtils.findField(GuiChat.class, LibObfuscation.INPUT_FIELD);
|
||||
|
||||
boolean isAutoCompleted = false;
|
||||
String originalString = "";
|
||||
List<CompletionData> completions = new ArrayList<>();
|
||||
@@ -83,7 +87,7 @@ public class CorporeaAutoCompleteHandler {
|
||||
}
|
||||
GuiChat chat = (GuiChat) screen;
|
||||
if(isAutoCompleted) {
|
||||
boolean valid = ReflectionHelper.getPrivateValue(GuiChat.class, chat, LibObfuscation.COMPLETE_FLAG);
|
||||
boolean valid = ReflectionUtils.getBoolean(COMPLETE_FLAG, chat);
|
||||
if(!valid)
|
||||
isAutoCompleted = false;
|
||||
}
|
||||
@@ -99,7 +103,7 @@ public class CorporeaAutoCompleteHandler {
|
||||
if(!CorporeaHelper.shouldAutoComplete())
|
||||
return;
|
||||
|
||||
GuiTextField inputField = ReflectionHelper.getPrivateValue(GuiChat.class, chat, LibObfuscation.INPUT_FIELD);
|
||||
GuiTextField inputField = (GuiTextField) ReflectionUtils.getObject(INPUT_FIELD, chat);
|
||||
if(!isAutoCompleted)
|
||||
buildAutoCompletes(inputField, chat);
|
||||
if(isAutoCompleted && !completions.isEmpty())
|
||||
@@ -127,7 +131,7 @@ public class CorporeaAutoCompleteHandler {
|
||||
if(completions.isEmpty())
|
||||
return;
|
||||
position = -1;
|
||||
ReflectionHelper.setPrivateValue(GuiChat.class, chat, true, LibObfuscation.COMPLETE_FLAG);
|
||||
ReflectionUtils.setBoolean(COMPLETE_FLAG, chat, true);
|
||||
StringBuilder stringbuilder = new StringBuilder();
|
||||
CompletionData data;
|
||||
for(Iterator<CompletionData> iterator = completions.iterator(); iterator.hasNext(); stringbuilder.append(data.string)) {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
@@ -50,7 +51,6 @@ import vazkii.botania.api.wiki.IWikiProvider;
|
||||
import vazkii.botania.api.wiki.WikiHooks;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.TileAltar;
|
||||
import vazkii.botania.common.block.tile.TileRuneAltar;
|
||||
@@ -65,15 +65,18 @@ import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemMonocle;
|
||||
import vazkii.botania.common.lib.LibObfuscation;
|
||||
import vazkii.botania.utils.ReflectionUtils;
|
||||
import baubles.common.container.InventoryBaubles;
|
||||
import baubles.common.lib.PlayerHandler;
|
||||
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
public final class HUDHandler {
|
||||
|
||||
public static final ResourceLocation manaBar = new ResourceLocation(LibResources.GUI_MANA_HUD);
|
||||
|
||||
private static final Field REMAINING_HIGHLIGHT_TICKS = ReflectionUtils.findField(GuiIngame.class, LibObfuscation.REMAINING_HIGHLIGHT_TICKS);
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||
public void onDrawScreenPre(RenderGameOverlayEvent.Pre event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
@@ -128,7 +131,7 @@ public final class HUDHandler {
|
||||
renderCrystalCubeHUD(event.resolution, (TileCorporeaCrystalCube) tile);
|
||||
}
|
||||
|
||||
if(!TileCorporeaIndex.InputHandler.getNearbyIndexes(mc.thePlayer).isEmpty() && mc.currentScreen != null && mc.currentScreen instanceof GuiChat) {
|
||||
if(mc.currentScreen != null && mc.currentScreen instanceof GuiChat && TileCorporeaIndex.InputHandler.hasNearbyIndexes(mc.thePlayer)) {
|
||||
profiler.startSection("nearIndex");
|
||||
renderNearIndexDisplay(event.resolution);
|
||||
profiler.endSection();
|
||||
@@ -159,21 +162,23 @@ public final class HUDHandler {
|
||||
profiler.endSection();
|
||||
}*/
|
||||
|
||||
if(Botania.proxy.isClientPlayerWearingMonocle()) {
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player);
|
||||
|
||||
if(ItemMonocle.hasMonocle(baubles)) {
|
||||
profiler.startSection("monocle");
|
||||
ItemMonocle.renderHUD(event.resolution, mc.thePlayer);
|
||||
ItemMonocle.renderHUD(event.resolution, player);
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
profiler.startSection("manaBar");
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
int totalMana = 0;
|
||||
int totalMaxMana = 0;
|
||||
boolean anyRequest = false;
|
||||
boolean creative = false;
|
||||
|
||||
IInventory mainInv = player.inventory;
|
||||
IInventory baublesInv = PlayerHandler.getPlayerBaubles(player);
|
||||
IInventory baublesInv = baubles;
|
||||
|
||||
int invSize = mainInv.getSizeInventory();
|
||||
int size = invSize;
|
||||
@@ -221,7 +226,7 @@ public final class HUDHandler {
|
||||
Profiler profiler = mc.mcProfiler;
|
||||
|
||||
profiler.startSection("wandMode");
|
||||
int ticks = ReflectionHelper.getPrivateValue(GuiIngame.class, mc.ingameGUI, LibObfuscation.REMAINING_HIGHLIGHT_TICKS);
|
||||
int ticks = ReflectionUtils.getInt(REMAINING_HIGHLIGHT_TICKS, mc.ingameGUI);
|
||||
ticks -= 15;
|
||||
if(ticks > 0) {
|
||||
int alpha = Math.min(255, (int) (ticks * 256.0F / 10.0F));
|
||||
@@ -257,8 +262,8 @@ public final class HUDHandler {
|
||||
else return;
|
||||
}
|
||||
|
||||
Color color = new Color(Color.HSBtoRGB(0.55F, (float) Math.min(1F, Math.sin(System.currentTimeMillis() / 200D) * 0.5 + 1F), 1F));
|
||||
GL11.glColor4ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) (255 - color.getRed()));
|
||||
int rgb = Color.HSBtoRGB(0.55F, (float) Math.min(1F, Math.sin(System.currentTimeMillis() / 200D) * 0.5 + 1F), 1F);
|
||||
GL11.glColor4ub((byte) (rgb >> 16), (byte) (rgb >> 8), (byte) rgb, (byte) (255 - (rgb >> 16)));
|
||||
mc.renderEngine.bindTexture(manaBar);
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
@@ -480,8 +485,7 @@ public final class HUDHandler {
|
||||
|
||||
RenderHelper.drawTexturedModalRect(x + 1, y + 1, 0, 0, 5, 100, 3);
|
||||
|
||||
Color color_ = new Color(color);
|
||||
GL11.glColor4ub((byte) color_.getRed(), (byte) color_.getGreen(),(byte) color_.getBlue(), (byte) (255F * alpha));
|
||||
GL11.glColor4ub((byte) (color >> 16), (byte) (color >> 8), (byte) color, (byte) (255F * alpha));
|
||||
RenderHelper.drawTexturedModalRect(x + 1, y + 1, 0, 0, 5, Math.min(100, manaPercentage), 3);
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@ public final class ItemsRemainingRenderHandler {
|
||||
|
||||
private static ItemStack stack;
|
||||
private static int ticks, count;
|
||||
private static String cachedText;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void render(ScaledResolution resolution, float partTicks) {
|
||||
@@ -62,17 +63,7 @@ public final class ItemsRemainingRenderHandler {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
String text = EnumChatFormatting.GREEN + stack.getDisplayName();
|
||||
if(count >= 0) {
|
||||
int max = stack.getMaxStackSize();
|
||||
int stacks = count / max;
|
||||
int rem = count % max;
|
||||
|
||||
if(stacks == 0)
|
||||
text = "" + count;
|
||||
else text = count + " (" + EnumChatFormatting.AQUA + stacks + EnumChatFormatting.RESET + "*" + EnumChatFormatting.GRAY + max + EnumChatFormatting.RESET + "+" + EnumChatFormatting.YELLOW + rem + EnumChatFormatting.RESET + ")";
|
||||
} else if(count == -1)
|
||||
text = "\u221E";
|
||||
String text = cachedText;
|
||||
|
||||
int color = 0x00FFFFFF | (int) (alpha * 0xFF) << 24;
|
||||
mc.fontRenderer.drawStringWithShadow(text, x + 20, y + 6, color);
|
||||
@@ -92,6 +83,22 @@ public final class ItemsRemainingRenderHandler {
|
||||
ItemsRemainingRenderHandler.stack = stack;
|
||||
ItemsRemainingRenderHandler.count = count;
|
||||
ticks = stack == null ? 0 : maxTicks;
|
||||
|
||||
cachedText = "";
|
||||
if(stack != null) {
|
||||
String text = EnumChatFormatting.GREEN + stack.getDisplayName();
|
||||
if(count >= 0) {
|
||||
int max = stack.getMaxStackSize();
|
||||
int stacks = count / max;
|
||||
int rem = count % max;
|
||||
|
||||
if(stacks == 0)
|
||||
text = "" + count;
|
||||
else text = count + " (" + EnumChatFormatting.AQUA + stacks + EnumChatFormatting.RESET + "*" + EnumChatFormatting.GRAY + max + EnumChatFormatting.RESET + "+" + EnumChatFormatting.YELLOW + rem + EnumChatFormatting.RESET + ")";
|
||||
} else if(count == -1)
|
||||
text = "\u221E";
|
||||
cachedText = text;
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(EntityPlayer player, ItemStack displayStack, Pattern pattern) {
|
||||
|
||||
@@ -2,15 +2,14 @@
|
||||
* This class was created by <Vazkii/ChickenBones>. 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 @ [Feb 3, 2014, 9:05:38 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
@@ -51,10 +50,11 @@ public class LightningHandler {
|
||||
static double interpPosY;
|
||||
static double interpPosZ;
|
||||
|
||||
private static Vector3 getRelativeViewVector(Vector3 pos) {
|
||||
Entity renderEntity = Minecraft.getMinecraft().renderViewEntity;
|
||||
return new Vector3((float) renderEntity.posX - pos.x, (float) renderEntity.posY + renderEntity.getEyeHeight() - pos.y, (float) renderEntity.posZ - pos.z);
|
||||
}
|
||||
private final Vector3 scratchView = new Vector3();
|
||||
private final Vector3 scratchPoint = new Vector3();
|
||||
private final Vector3 scratchDiff1 = new Vector3();
|
||||
private final Vector3 scratchDiff2 = new Vector3();
|
||||
private final Vector3 scratchRound = new Vector3();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRenderWorldLast(RenderWorldLastEvent event) {
|
||||
@@ -67,12 +67,14 @@ public class LightningHandler {
|
||||
profiler.endStartSection("lightning");
|
||||
|
||||
float frame = event.partialTicks;
|
||||
Entity entity = Minecraft.getMinecraft().thePlayer;
|
||||
TextureManager render = Minecraft.getMinecraft().renderEngine;
|
||||
|
||||
interpPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * frame;
|
||||
interpPosY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * frame;
|
||||
interpPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * frame;
|
||||
Entity viewEntity = Minecraft.getMinecraft().renderViewEntity;
|
||||
interpPosX = viewEntity.lastTickPosX + (viewEntity.posX - viewEntity.lastTickPosX) * frame;
|
||||
interpPosY = viewEntity.lastTickPosY + (viewEntity.posY - viewEntity.lastTickPosY) * frame;
|
||||
interpPosZ = viewEntity.lastTickPosZ + (viewEntity.posZ - viewEntity.lastTickPosZ) * frame;
|
||||
|
||||
scratchView.set(viewEntity.posX, viewEntity.posY + viewEntity.getEyeHeight(), viewEntity.posZ);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(-interpPosX, -interpPosY, -interpPosZ);
|
||||
@@ -130,22 +132,23 @@ public class LightningHandler {
|
||||
int renderstart = (int) ((expandTime / 2 - bolt.particleMaxAge + bolt.particleAge) / (float) (expandTime / 2) * bolt.numsegments0);
|
||||
int renderend = (int) ((bolt.particleAge + expandTime) / (float) expandTime * bolt.numsegments0);
|
||||
|
||||
for(Segment rendersegment : bolt.segments) {
|
||||
for(int i = 0; i < bolt.segments.size(); i++) {
|
||||
Segment rendersegment = bolt.segments.get(i);
|
||||
if(rendersegment.segmentno < renderstart || rendersegment.segmentno > renderend)
|
||||
continue;
|
||||
|
||||
Vector3 playervec = getRelativeViewVector(rendersegment.startpoint.point).multiply(-1);
|
||||
Vector3 playervec = scratchPoint.set(rendersegment.startpoint.point).subtract(scratchView);
|
||||
|
||||
double width = 0.025F * (playervec.mag() / 5 + 1) * (1 + rendersegment.light) * 0.5F;
|
||||
|
||||
Vector3 diff1 = playervec.copy().crossProduct(rendersegment.prevdiff).normalize().multiply(width / rendersegment.sinprev);
|
||||
Vector3 diff2 = playervec.copy().crossProduct(rendersegment.nextdiff).normalize().multiply(width / rendersegment.sinnext);
|
||||
Vector3 diff1 = scratchDiff1.set(playervec).crossProduct(rendersegment.prevdiff).normalize().multiply(width / rendersegment.sinprev);
|
||||
Vector3 diff2 = scratchDiff2.set(playervec).crossProduct(rendersegment.nextdiff).normalize().multiply(width / rendersegment.sinnext);
|
||||
|
||||
Vector3 startvec = rendersegment.startpoint.point;
|
||||
Vector3 endvec = rendersegment.endpoint.point;
|
||||
|
||||
int color = inner ? bolt.colorInner : bolt.colorOuter;
|
||||
tessellator.setColorRGBA_I(color, (int) (mainalpha * rendersegment.light * new Color(color).getAlpha()));
|
||||
tessellator.setColorRGBA_I(color, (int) (mainalpha * rendersegment.light * 255));
|
||||
|
||||
tessellator.addVertexWithUV(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z, 0.5, 0);
|
||||
tessellator.addVertexWithUV(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z, 0.5, 0);
|
||||
@@ -153,7 +156,7 @@ public class LightningHandler {
|
||||
tessellator.addVertexWithUV(endvec.x + diff2.x, endvec.y + diff2.y, endvec.z + diff2.z, 0.5, 1);
|
||||
|
||||
if(rendersegment.next == null) {
|
||||
Vector3 roundend = rendersegment.endpoint.point.copy().add(rendersegment.diff.copy().normalize().multiply(width));
|
||||
Vector3 roundend = scratchRound.set(rendersegment.diff).normalize().multiply(width).add(rendersegment.endpoint.point);
|
||||
|
||||
tessellator.addVertexWithUV(roundend.x - diff2.x, roundend.y - diff2.y, roundend.z - diff2.z, 0, 0);
|
||||
tessellator.addVertexWithUV(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z, 0.5, 0);
|
||||
@@ -162,7 +165,7 @@ public class LightningHandler {
|
||||
}
|
||||
|
||||
if(rendersegment.prev == null) {
|
||||
Vector3 roundend = rendersegment.startpoint.point.copy().subtract(rendersegment.diff.copy().normalize().multiply(width));
|
||||
Vector3 roundend = scratchRound.set(rendersegment.diff).normalize().multiply(width).multiply(-1).add(rendersegment.startpoint.point);
|
||||
|
||||
tessellator.addVertexWithUV(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z, 0.5, 0);
|
||||
tessellator.addVertexWithUV(roundend.x - diff1.x, roundend.y - diff1.y, roundend.z - diff1.z, 0, 0);
|
||||
@@ -223,9 +226,9 @@ public class LightningHandler {
|
||||
|
||||
@Override
|
||||
public int compare(Segment o1, Segment o2) {
|
||||
int comp = Integer.valueOf(o1.splitno).compareTo(o2.splitno);
|
||||
int comp = o1.splitno - o2.splitno;
|
||||
if(comp == 0)
|
||||
return Integer.valueOf(o1.segmentno).compareTo(o2.segmentno);
|
||||
return o1.segmentno - o2.segmentno;
|
||||
else return comp;
|
||||
}
|
||||
}
|
||||
@@ -497,4 +500,4 @@ public class LightningHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -25,7 +26,6 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -34,16 +34,18 @@ import vazkii.botania.api.lexicon.ILexicon;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings.EntryData;
|
||||
import vazkii.botania.api.mana.IManaTooltipDisplay;
|
||||
import vazkii.botania.api.mana.ITieredManaTooltipDisplay;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.item.ItemLexicon;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.equipment.tool.terrasteel.ItemTerraPick;
|
||||
import vazkii.botania.common.lib.LibObfuscation;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import vazkii.botania.utils.ReflectionUtils;
|
||||
|
||||
public final class TooltipAdditionDisplayHandler {
|
||||
|
||||
private static final Field THE_SLOT = ReflectionUtils.findField(GuiContainer.class, LibObfuscation.THE_SLOT);
|
||||
|
||||
private static float lexiconLookupTime = 0F;
|
||||
|
||||
public static void render() {
|
||||
@@ -51,7 +53,7 @@ public final class TooltipAdditionDisplayHandler {
|
||||
GuiScreen gui = mc.currentScreen;
|
||||
if(gui != null && gui instanceof GuiContainer && mc.thePlayer != null && mc.thePlayer.inventory.getItemStack() == null) {
|
||||
GuiContainer container = (GuiContainer) gui;
|
||||
Slot slot = ReflectionHelper.getPrivateValue(GuiContainer.class, container, LibObfuscation.THE_SLOT);
|
||||
Slot slot = (Slot) ReflectionUtils.getObject(THE_SLOT, container);
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
if(stack != null) {
|
||||
@@ -83,10 +85,10 @@ public final class TooltipAdditionDisplayHandler {
|
||||
if(offscreen)
|
||||
offx = -13 - width;
|
||||
|
||||
if(stack.getItem() instanceof ItemTerraPick)
|
||||
drawTerraPick(stack, mouseX, mouseY, offx, offy, width, height, font);
|
||||
else if(stack.getItem() instanceof IManaTooltipDisplay)
|
||||
drawManaBar(stack, (IManaTooltipDisplay) stack.getItem(), mouseX, mouseY, offx, offy, width, height);
|
||||
if(stack.getItem() instanceof ITieredManaTooltipDisplay tieredItem)
|
||||
drawTieredManaBar(stack, tieredItem, mouseX, mouseY, offx, offy, width, height, font);
|
||||
else if(stack.getItem() instanceof IManaTooltipDisplay manaItem)
|
||||
drawManaBar(stack, manaItem, mouseX, mouseY, offx, offy, width, height);
|
||||
|
||||
EntryData data = LexiconRecipeMappings.getDataForStack(stack);
|
||||
if(data != null) {
|
||||
@@ -169,33 +171,37 @@ public final class TooltipAdditionDisplayHandler {
|
||||
} else lexiconLookupTime = 0F;
|
||||
}
|
||||
|
||||
private static void drawTerraPick(ItemStack stack, int mouseX, int mouseY, int offx, int offy, int width, int height, FontRenderer font) {
|
||||
int level = ItemTerraPick.getLevel(stack);
|
||||
int max = ItemTerraPick.LEVELS[Math.min(ItemTerraPick.LEVELS.length - 1, level + 1)];
|
||||
boolean ss = level >= ItemTerraPick.LEVELS.length - 1;
|
||||
int curr = ItemTerraPick.getMana_(stack);
|
||||
float percent = level == 0 ? 0F : (float) curr / (float) max;
|
||||
int rainbowWidth = Math.min(width - (ss ? 0 : 1), (int) (width * percent));
|
||||
float huePer = width == 0 ? 0F : 1F / width;
|
||||
float hueOff = (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.01F;
|
||||
private static void drawTieredManaBar(ItemStack stack, ITieredManaTooltipDisplay item, int mouseX, int mouseY, int offx, int offy, int width, int height, FontRenderer font) {
|
||||
float percent = item.getManaFractionForDisplay(stack);
|
||||
int manaBarWidth = Math.min(width - (percent == 1 ? 0 : 1), (int) (width * percent));
|
||||
float huePer = width == 0 ? 0F : 1F / width;
|
||||
float hueOff = (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.01F;
|
||||
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
Gui.drawRect(mouseX + offx - 1, mouseY - offy - height - 1, mouseX + offx + width + 1, mouseY - offy, 0xFF000000);
|
||||
for(int i = 0; i < rainbowWidth; i++)
|
||||
Gui.drawRect(mouseX + offx + i, mouseY - offy - height, mouseX + offx + i + 1, mouseY - offy, Color.HSBtoRGB(hueOff + huePer * i, 1F, 1F));
|
||||
Gui.drawRect(mouseX + offx + rainbowWidth, mouseY - offy - height, mouseX + offx + width, mouseY - offy, 0xFF555555);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
Gui.drawRect(mouseX + offx - 1, mouseY - offy - height - 1, mouseX + offx + width + 1, mouseY - offy, 0xFF000000);
|
||||
if (item.isRainbowEffect(stack)) {
|
||||
for (int i = 0; i < manaBarWidth; i++) {
|
||||
Gui.drawRect(mouseX + offx + i, mouseY - offy - height, mouseX + offx + i + 1, mouseY - offy, Color.HSBtoRGB(hueOff + huePer * i, 1F, 1F));
|
||||
}
|
||||
} else {
|
||||
Gui.drawRect(mouseX + offx, mouseY - offy - height, mouseX + offx + manaBarWidth, mouseY - offy, Color.HSBtoRGB(0.528F, ((float) Math.sin((ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.2) + 1F) * 0.3F + 0.4F, 1F));
|
||||
}
|
||||
Gui.drawRect(mouseX + offx + manaBarWidth, mouseY - offy - height, mouseX + offx + width, mouseY - offy, 0xFF555555);
|
||||
|
||||
String rank = StatCollector.translateToLocal("botania.rank" + level).replaceAll("&", "\u00a7");
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
font.drawStringWithShadow(rank, mouseX + offx, mouseY - offy - 12, 0xFFFFFF);
|
||||
if(!ss) {
|
||||
rank = StatCollector.translateToLocal("botania.rank" + (level + 1)).replaceAll("&", "\u00a7");
|
||||
font.drawStringWithShadow(rank, mouseX + offx + width - font.getStringWidth(rank), mouseY - offy - 12, 0xFFFFFF);
|
||||
}
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
String leftRank = item.getLeftManaLabel(stack).replaceAll("&", "\u00a7");
|
||||
if (!leftRank.isEmpty()) {
|
||||
font.drawStringWithShadow(leftRank, mouseX + offx, mouseY - offy - 12, 0xFFFFFF);
|
||||
}
|
||||
String rightRank = item.getRightManaLabel(stack).replaceAll("&", "\u00a7");
|
||||
if (!rightRank.isEmpty()) {
|
||||
font.drawStringWithShadow(rightRank, mouseX + offx + width - font.getStringWidth(rightRank), mouseY - offy - 12, 0xFFFFFF);
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
private static void drawManaBar(ItemStack stack, IManaTooltipDisplay display, int mouseX, int mouseY, int offx, int offy, int width, int height) {
|
||||
float fraction = display.getManaFractionForDisplay(stack);
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package vazkii.botania.client.core.helper;
|
||||
|
||||
import codechicken.nei.ItemList;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.brew.BrewUtilities;
|
||||
import vazkii.botania.api.brew.IBrewContainer;
|
||||
import vazkii.botania.common.Botania;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public final class BrewHelper {
|
||||
|
||||
public static List<ItemStack> getBrewContainers() {
|
||||
class Cache {
|
||||
private static final List<ItemStack> BREW_CONTAINERS = List.copyOf(scanBrewContainers());
|
||||
}
|
||||
|
||||
return Cache.BREW_CONTAINERS;
|
||||
}
|
||||
|
||||
private static List<ItemStack> scanBrewContainers() {
|
||||
ArrayList<ItemStack> containers = new ArrayList<>();
|
||||
|
||||
if (Botania.neiLoaded) {
|
||||
for (ItemStack item : ItemList.items) {
|
||||
if (item != null && BrewUtilities.isEmptyBrewContainer(item)) {
|
||||
containers.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (containers.isEmpty()) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final Iterable<Item> itemRegistry = Item.itemRegistry;
|
||||
|
||||
ArrayList<ItemStack> potentialContainers = new ArrayList<>();
|
||||
for (Item item : itemRegistry) {
|
||||
if (item instanceof IBrewContainer) {
|
||||
item.getSubItems(item, item.getCreativeTab(), potentialContainers);
|
||||
|
||||
for (ItemStack maybeContainer : potentialContainers) {
|
||||
if (maybeContainer != null && BrewUtilities.isEmptyBrewContainer(maybeContainer)) {
|
||||
containers.add(maybeContainer);
|
||||
}
|
||||
}
|
||||
|
||||
potentialContainers.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return containers;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -381,24 +381,38 @@ public class ClientProxy extends CommonProxy {
|
||||
@Override
|
||||
public void setExtraReach(EntityLivingBase entity, float reach) {
|
||||
super.setExtraReach(entity, reach);
|
||||
IExtendedPlayerController controller = getReachController(entity);
|
||||
if(controller != null)
|
||||
controller.setReachDistanceExtension(Math.max(0, controller.getReachDistanceExtension() + reach));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClientExtraReach(EntityLivingBase entity, float reach) {
|
||||
IExtendedPlayerController controller = getReachController(entity);
|
||||
if(controller != null)
|
||||
controller.setReachDistanceExtension(Math.max(0, reach));
|
||||
}
|
||||
|
||||
private IExtendedPlayerController getReachController(EntityLivingBase entity) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
// Player object might have changed, need to check the UUID.
|
||||
if(entity.worldObj.isRemote && entity.getUniqueID().equals(player.getUniqueID())) {
|
||||
if(!(mc.playerController instanceof IExtendedPlayerController)) {
|
||||
GameType type = ReflectionHelper.getPrivateValue(PlayerControllerMP.class, mc.playerController, LibObfuscation.CURRENT_GAME_TYPE);
|
||||
NetHandlerPlayClient net = ReflectionHelper.getPrivateValue(PlayerControllerMP.class, mc.playerController, LibObfuscation.NET_CLIENT_HANDLER);
|
||||
BotaniaPlayerController controller = new BotaniaPlayerController(mc, net);
|
||||
boolean isFlying = player.capabilities.isFlying;
|
||||
boolean allowFlying = player.capabilities.allowFlying;
|
||||
controller.setGameType(type);
|
||||
player.capabilities.isFlying = isFlying;
|
||||
player.capabilities.allowFlying = allowFlying;
|
||||
mc.playerController = controller;
|
||||
}
|
||||
if(!entity.worldObj.isRemote || !entity.getUniqueID().equals(player.getUniqueID()))
|
||||
return null;
|
||||
|
||||
((IExtendedPlayerController) mc.playerController).setReachDistanceExtension(Math.max(0, ((IExtendedPlayerController) mc.playerController).getReachDistanceExtension() + reach));
|
||||
if(!(mc.playerController instanceof IExtendedPlayerController)) {
|
||||
GameType type = ReflectionHelper.getPrivateValue(PlayerControllerMP.class, mc.playerController, LibObfuscation.CURRENT_GAME_TYPE);
|
||||
NetHandlerPlayClient net = ReflectionHelper.getPrivateValue(PlayerControllerMP.class, mc.playerController, LibObfuscation.NET_CLIENT_HANDLER);
|
||||
BotaniaPlayerController controller = new BotaniaPlayerController(mc, net);
|
||||
boolean isFlying = player.capabilities.isFlying;
|
||||
boolean allowFlying = player.capabilities.allowFlying;
|
||||
controller.setGameType(type);
|
||||
player.capabilities.isFlying = isFlying;
|
||||
player.capabilities.allowFlying = allowFlying;
|
||||
mc.playerController = controller;
|
||||
}
|
||||
|
||||
return (IExtendedPlayerController) mc.playerController;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -68,16 +68,20 @@ public class FXSparkle extends EntityFX {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(ConfigHandler.matrixMode ? ObfuscationHelper.getParticleTexture() : particles);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
for(FXSparkle sparkle : queuedRenders)
|
||||
sparkle.renderQueued(tessellator);
|
||||
if(!queuedRenders.isEmpty()) {
|
||||
for(FXSparkle sparkle : queuedRenders)
|
||||
sparkle.renderQueued(tessellator);
|
||||
}
|
||||
tessellator.draw();
|
||||
|
||||
ShaderHelper.useShader(ShaderHelper.filmGrain);
|
||||
tessellator.startDrawingQuads();
|
||||
for(FXSparkle sparkle : queuedCorruptRenders)
|
||||
sparkle.renderQueued(tessellator);
|
||||
tessellator.draw();
|
||||
ShaderHelper.releaseShader();
|
||||
if(!queuedCorruptRenders.isEmpty()) {
|
||||
ShaderHelper.useShader(ShaderHelper.filmGrain);
|
||||
tessellator.startDrawingQuads();
|
||||
for(FXSparkle sparkle : queuedCorruptRenders)
|
||||
sparkle.renderQueued(tessellator);
|
||||
tessellator.draw();
|
||||
ShaderHelper.releaseShader();
|
||||
}
|
||||
|
||||
queuedRenders.clear();
|
||||
queuedCorruptRenders.clear();
|
||||
|
||||
@@ -28,6 +28,14 @@ public final class ParticleRenderDispatcher {
|
||||
// Called from LightningHandler.onRenderWorldLast since that was
|
||||
// already registered. /shrug
|
||||
public static void dispatch() {
|
||||
if(FXSparkle.queuedRenders.isEmpty() && FXSparkle.queuedCorruptRenders.isEmpty() && FXWisp.queuedRenders.isEmpty() && FXWisp.queuedDepthIgnoringRenders.isEmpty()) {
|
||||
sparkleFxCount = 0;
|
||||
fakeSparkleFxCount = 0;
|
||||
wispFxCount = 0;
|
||||
depthIgnoringWispFxCount = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
Profiler profiler = Minecraft.getMinecraft().mcProfiler;
|
||||
|
||||
@@ -22,6 +22,6 @@ public class GuiFlowerBag extends GuiMagicPlantBag {
|
||||
|
||||
@Override
|
||||
protected String getLocalizedNameKey() {
|
||||
return "item.botania:flowerBag.name";
|
||||
return "botania.gui.flowerBag.title";
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,6 @@ public class GuiShroomBag extends GuiMagicPlantBag {
|
||||
|
||||
@Override
|
||||
protected String getLocalizedNameKey() {
|
||||
return "item.botania:shroomBag.name";
|
||||
return "botania.gui.shroomBag.title";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package vazkii.botania.client.integration.nei;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class NEIHelper {
|
||||
public static final RenderItem renderItem = new RenderItem();
|
||||
public static final Minecraft mc = Minecraft.getMinecraft();
|
||||
public static final TextureManager textureManager = mc.getTextureManager();
|
||||
public static final FontRenderer font = mc.fontRenderer;
|
||||
|
||||
public static void renderItemIntoGUI(ItemStack stack, int x, int y) {
|
||||
renderItem.renderItemIntoGUI(font, textureManager, stack, x, y);
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public class NEIInputHandler implements IContainerInputHandler {
|
||||
@Override
|
||||
public boolean keyTyped(GuiContainer gui, char c, int i) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if(TileCorporeaIndex.InputHandler.getNearbyIndexes(mc.thePlayer).isEmpty())
|
||||
if(!TileCorporeaIndex.InputHandler.hasNearbyIndexes(mc.thePlayer))
|
||||
return false;
|
||||
|
||||
int bind = NEIClientConfig.getKeyBinding(NEIBotaniaConfig.CORPOREA_KEY);
|
||||
|
||||
@@ -3,6 +3,7 @@ package vazkii.botania.client.integration.nei.recipe;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
@@ -11,10 +12,15 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.brew.Brew;
|
||||
import vazkii.botania.api.brew.BrewUtilities;
|
||||
import vazkii.botania.api.brew.IBrewContainer;
|
||||
import vazkii.botania.api.brew.IBrewItem;
|
||||
import vazkii.botania.api.recipe.RecipeBrew;
|
||||
import vazkii.botania.client.core.handler.HUDHandler;
|
||||
import vazkii.botania.client.core.helper.BrewHelper;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.block.tile.mana.TilePool;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
@@ -23,118 +29,149 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
public class RecipeHandlerBrewery extends TemplateRecipeHandler {
|
||||
|
||||
public class CachedBreweryRecipe extends CachedRecipe {
|
||||
public static final String OVERLAY = "botania.brewery";
|
||||
|
||||
public List<PositionedStack> inputs = new ArrayList<>();
|
||||
public PositionedStack output;
|
||||
public int mana;
|
||||
public class CachedBreweryRecipe extends CachedRecipe {
|
||||
|
||||
public CachedBreweryRecipe(RecipeBrew recipe, ItemStack vial) {
|
||||
if(recipe == null)
|
||||
return;
|
||||
public List<PositionedStack> inputs = new ArrayList<>();
|
||||
public PositionedStack output;
|
||||
public int mana;
|
||||
|
||||
setIngredients(recipe.getInputs());
|
||||
ItemStack toVial;
|
||||
if (vial == null)
|
||||
toVial = new ItemStack(ModItems.vial);
|
||||
else
|
||||
toVial = vial.copy();
|
||||
toVial.stackSize = 1;
|
||||
inputs.add(new PositionedStack(toVial, 39, 42));
|
||||
public CachedBreweryRecipe(RecipeBrew recipe, ItemStack vial) {
|
||||
if (recipe == null) return;
|
||||
|
||||
output = new PositionedStack(recipe.getOutput(toVial), 87, 42);
|
||||
}
|
||||
setIngredients(recipe.getInputs());
|
||||
ItemStack toVial;
|
||||
if (vial == null) {
|
||||
toVial = new ItemStack(ModItems.vial);
|
||||
} else {
|
||||
toVial = vial.copy();
|
||||
toVial.stackSize = 1;
|
||||
}
|
||||
inputs.add(new PositionedStack(toVial, 39, 42));
|
||||
|
||||
public CachedBreweryRecipe(RecipeBrew recipe) {
|
||||
this(recipe, null);
|
||||
}
|
||||
output = new PositionedStack(recipe.getOutput(toVial), 87, 42);
|
||||
mana = ((IBrewContainer) toVial.getItem()).getManaCost(recipe.getBrew(), toVial);
|
||||
}
|
||||
|
||||
public void setIngredients(List<Object> inputs) {
|
||||
int left = 96 - inputs.size() * 18 / 2;
|
||||
public CachedBreweryRecipe(RecipeBrew recipe) {
|
||||
this(recipe, null);
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
for (Object o : inputs) {
|
||||
if (o instanceof String)
|
||||
this.inputs.add(new PositionedStack(OreDictionary.getOres((String) o), left + i * 18, 6));
|
||||
else
|
||||
this.inputs.add(new PositionedStack(o, left + i * 18, 6));
|
||||
public void setIngredients(List<Object> inputs) {
|
||||
int left = 96 - inputs.size() * 18 / 2;
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < inputs.size(); i++) {
|
||||
Object o = inputs.get(i);
|
||||
if (o instanceof String oreName) {
|
||||
o = OreDictionary.getOres(oreName);
|
||||
}
|
||||
this.inputs.add(new PositionedStack(o, left + i * 18, 6));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return getCycledIngredients(cycleticks / 20, inputs);
|
||||
}
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return inputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return output;
|
||||
}
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return output;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("botania.nei.brewery");
|
||||
}
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("botania.nei.brewery");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return LibResources.GUI_NEI_BREWERY;
|
||||
}
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return OVERLAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(87, 25, 15, 14), "botania.brewery"));
|
||||
}
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return LibResources.GUI_NEI_BREWERY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipe) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GuiDraw.changeTexture(getGuiTexture());
|
||||
GuiDraw.drawTexturedModalRect(0, 0, 0, 0, 166, 65);
|
||||
}
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(87, 25, 15, 14), getOverlayIdentifier()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if(outputId.equals("botania.brewery"))
|
||||
for(RecipeBrew recipe : BotaniaAPI.brewRecipes)
|
||||
arecipes.add(new CachedBreweryRecipe(recipe));
|
||||
else super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
@Override
|
||||
public void drawBackground(int recipe) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
if(result.getItem() instanceof IBrewItem)
|
||||
for(RecipeBrew recipe : BotaniaAPI.brewRecipes) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
// Arrows
|
||||
GuiDraw.changeTexture(getGuiTexture());
|
||||
GuiDraw.drawTexturedModalRect(0, 0, 0, 0, 166, 65);
|
||||
|
||||
if(((IBrewItem) result.getItem()).getBrew(result) == recipe.getBrew())
|
||||
arecipes.add(new CachedBreweryRecipe(recipe));
|
||||
}
|
||||
}
|
||||
// Mana Bar
|
||||
HUDHandler.renderManaBar(32, 67, 0x0000FF, 0.75F, ((CachedBreweryRecipe) arecipes.get(recipe)).mana, TilePool.MAX_MANA / 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
if(ingredient.getItem() instanceof IBrewContainer) {
|
||||
for(RecipeBrew recipe : BotaniaAPI.brewRecipes) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals(getOverlayIdentifier())) {
|
||||
for (RecipeBrew recipe : BotaniaAPI.brewRecipes) {
|
||||
arecipes.add(new CachedBreweryRecipe(recipe));
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
if(recipe.getOutput(ingredient) != null)
|
||||
arecipes.add(new CachedBreweryRecipe(recipe, ingredient));
|
||||
}
|
||||
} else for(RecipeBrew recipe : BotaniaAPI.brewRecipes) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
if (!(result.getItem() instanceof IBrewItem brew)) return;
|
||||
final Brew targetBrew = brew.getBrew(result);
|
||||
if (targetBrew == null || targetBrew == BotaniaAPI.fallbackBrew) return;
|
||||
|
||||
CachedBreweryRecipe crecipe = new CachedBreweryRecipe(recipe);
|
||||
if(ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.inputs, ingredient))
|
||||
arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
// Find the container(s) that can be filled to produce this result
|
||||
for (RecipeBrew recipe : BotaniaAPI.brewRecipes) {
|
||||
if (recipe == null || targetBrew != recipe.getBrew()) continue;
|
||||
|
||||
for (ItemStack emptyContainer : BrewHelper.getBrewContainers()) {
|
||||
final ItemStack filledContainer = recipe.getOutput(emptyContainer);
|
||||
if (filledContainer != null && result.isItemEqual(filledContainer) && Objects.equals(result.stackTagCompound, filledContainer.stackTagCompound)) {
|
||||
arecipes.add(new CachedBreweryRecipe(recipe, emptyContainer));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
if (BrewUtilities.isFilledBrew(ingredient)) {
|
||||
// Filled brews cannot be inserted into a Botanical Brewery.
|
||||
return;
|
||||
}
|
||||
|
||||
if (ingredient.getItem() instanceof IBrewContainer) {
|
||||
// Show all possible brews that can fill this empty container
|
||||
for (RecipeBrew recipe : BotaniaAPI.brewRecipes) {
|
||||
if (recipe != null && recipe.getOutput(ingredient) != null) {
|
||||
arecipes.add(new CachedBreweryRecipe(recipe, ingredient));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Show all brew recipes that can use this ingredient
|
||||
for (RecipeBrew recipe : BotaniaAPI.brewRecipes) {
|
||||
if (recipe == null) continue;
|
||||
CachedBreweryRecipe crecipe = new CachedBreweryRecipe(recipe);
|
||||
if (ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.inputs, ingredient)) {
|
||||
arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeHeight(int recipe) {
|
||||
return 80;
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,8 @@ import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -26,144 +26,122 @@ import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
|
||||
public class RecipeHandlerElvenTrade extends TemplateRecipeHandler {
|
||||
|
||||
public class CachedElvenTradeRecipe extends CachedRecipe {
|
||||
public static final String OVERLAY = "botania.elvenTrade";
|
||||
|
||||
public List<PositionedStack> inputs = new ArrayList<>();
|
||||
public PositionedStack output;
|
||||
public class CachedElvenTradeRecipe extends CachedRecipe {
|
||||
|
||||
public CachedElvenTradeRecipe(RecipeElvenTrade recipe) {
|
||||
if(recipe == null)
|
||||
return;
|
||||
public List<PositionedStack> inputs = new ArrayList<>();
|
||||
public PositionedStack output;
|
||||
|
||||
setIngredients(recipe.getInputs());
|
||||
output = new PositionedStack(recipe.getOutput(), 107, 46);
|
||||
}
|
||||
public CachedElvenTradeRecipe(RecipeElvenTrade recipe) {
|
||||
if (recipe == null) return;
|
||||
setIngredients(recipe.getInputs());
|
||||
output = new PositionedStack(recipe.getOutput(), 107, 46);
|
||||
}
|
||||
|
||||
public void setIngredients(List<Object> inputs) {
|
||||
int i = 0;
|
||||
for(Object o : inputs) {
|
||||
if(o instanceof String)
|
||||
this.inputs.add(new PositionedStack(OreDictionary.getOres((String) o), 60 + i * 18, 6));
|
||||
else this.inputs.add(new PositionedStack(o, 60 + i * 18, 6));
|
||||
public void setIngredients(List<Object> inputs) {
|
||||
for (int i = 0; i < inputs.size(); i++) {
|
||||
Object o = inputs.get(i);
|
||||
if (o instanceof String oreName) {
|
||||
o = OreDictionary.getOres(oreName);
|
||||
}
|
||||
this.inputs.add(new PositionedStack(o, 60 + i * 18, 6));
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return inputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return getCycledIngredients(cycleticks / 20, inputs);
|
||||
}
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return output;
|
||||
}
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("botania.nei.elvenTrade");
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return OVERLAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("botania.nei.elvenTrade");
|
||||
}
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return LibResources.GUI_NEI_BLANK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return LibResources.GUI_NEI_BLANK;
|
||||
}
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(35, 30, 48, 48), getOverlayIdentifier()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(35, 30, 48, 48), "botania.elvenTrade"));
|
||||
}
|
||||
@Override
|
||||
public void drawBackground(int recipe) {
|
||||
super.drawBackground(recipe);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.7F);
|
||||
GuiDraw.changeTexture(LibResources.GUI_ELVEN_TRADE_OVERLAY);
|
||||
GuiDraw.drawTexturedModalRect(30, 10, 17, 17, 100, 80);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GuiDraw.changeTexture(TextureMap.locationBlocksTexture);
|
||||
RenderItem.getInstance().renderIcon(35, 29, BlockAlfPortal.portalTex, 48, 48);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int recipiesPerPage() {
|
||||
return 1;
|
||||
}
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals(getOverlayIdentifier())) {
|
||||
for (RecipeElvenTrade recipe : filteredElvenTradeRecipes()) {
|
||||
arecipes.add(new CachedElvenTradeRecipe(recipe));
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipe) {
|
||||
super.drawBackground(recipe);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.7F);
|
||||
GuiDraw.changeTexture(LibResources.GUI_ELVEN_TRADE_OVERLAY);
|
||||
GuiDraw.drawTexturedModalRect(30, 10, 17, 17, 100, 80);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GuiDraw.changeTexture(TextureMap.locationBlocksTexture);
|
||||
RenderItem.getInstance().renderIcon(35, 29, BlockAlfPortal.portalTex, 48, 48);
|
||||
}
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (RecipeElvenTrade recipe : filteredElvenTradeRecipes()) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result)) {
|
||||
arecipes.add(new CachedElvenTradeRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean hasElvenKnowledge() {
|
||||
/*EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
if (player != null) {
|
||||
for (ItemStack stack : player.inventory.mainInventory) {
|
||||
if (stack != null && stack.getItem() instanceof ILexicon) {
|
||||
ILexicon lexicon = (ILexicon) stack.getItem();
|
||||
if (lexicon.isKnowledgeUnlocked(stack, BotaniaAPI.elvenKnowledge)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;*/
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for (RecipeElvenTrade recipe : filteredElvenTradeRecipes()) {
|
||||
CachedElvenTradeRecipe crecipe = new CachedElvenTradeRecipe(recipe);
|
||||
if (crecipe.contains(crecipe.inputs, ingredient)) {
|
||||
arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if(outputId.equals("botania.elvenTrade") && hasElvenKnowledge()) {
|
||||
if(hasElvenKnowledge()) {
|
||||
for(RecipeElvenTrade recipe : filteredElvenTradeRecipes()) {
|
||||
arecipes.add(new CachedElvenTradeRecipe(recipe));
|
||||
}
|
||||
}
|
||||
} else super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
private Iterable<RecipeElvenTrade> filteredElvenTradeRecipes() {
|
||||
return Iterables.filter(
|
||||
BotaniaAPI.elvenTradeRecipes,
|
||||
recipe -> recipe != null
|
||||
&& (recipe.getInputs().size() != 1
|
||||
|| !stackSame(recipe.getOutput(), recipe.getInputs().getFirst())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
if(hasElvenKnowledge()) {
|
||||
for(RecipeElvenTrade recipe : filteredElvenTradeRecipes()) {
|
||||
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result))
|
||||
arecipes.add(new CachedElvenTradeRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
if(hasElvenKnowledge()) {
|
||||
for(RecipeElvenTrade recipe : filteredElvenTradeRecipes()) {
|
||||
CachedElvenTradeRecipe crecipe = new CachedElvenTradeRecipe(recipe);
|
||||
if(crecipe.contains(crecipe.inputs, ingredient))
|
||||
arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// hide dummy recipes
|
||||
private List<RecipeElvenTrade> filteredElvenTradeRecipes() {
|
||||
return BotaniaAPI.elvenTradeRecipes
|
||||
.stream()
|
||||
.filter(recipe -> {
|
||||
if (recipe == null) {
|
||||
return false;
|
||||
}
|
||||
if (recipe.getInputs().size() == 1) {
|
||||
return !stackSame(recipe.getOutput(), recipe.getInputs().get(0));
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private boolean stackSame(ItemStack stack, Object obj) {
|
||||
if (obj instanceof String) {
|
||||
return OreDictionary.getOres((String) obj).stream().anyMatch(s -> ItemNBTHelper.areStacksSameTypeCraftingWithNBT(stack, s));
|
||||
} else {
|
||||
return Arrays.stream(NEIServerUtils.extractRecipeItems(obj)).anyMatch(s -> ItemNBTHelper.areStacksSameTypeCraftingWithNBT(stack, s));
|
||||
}
|
||||
}
|
||||
private boolean stackSame(ItemStack stack, Object obj) {
|
||||
if (obj instanceof String oreName) {
|
||||
return Iterables.any(
|
||||
OreDictionary.getOres(oreName),
|
||||
s -> ItemNBTHelper.areStacksSameTypeCraftingWithNBT(stack, s)
|
||||
);
|
||||
} else {
|
||||
return Iterables.any(
|
||||
Arrays.asList(NEIServerUtils.extractRecipeItems(obj)),
|
||||
s -> ItemNBTHelper.areStacksSameTypeCraftingWithNBT(stack, s)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,65 +17,70 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
public class RecipeHandlerFloatingFlowers extends TemplateRecipeHandler {
|
||||
|
||||
public class CachedFloatingFlowerRecipe extends CachedRecipe {
|
||||
public class CachedFloatingFlowerRecipe extends CachedRecipe {
|
||||
|
||||
public List<PositionedStack> inputs = new ArrayList<>();
|
||||
public PositionedStack output;
|
||||
public List<PositionedStack> inputs = new ArrayList<>();
|
||||
public PositionedStack output;
|
||||
|
||||
public CachedFloatingFlowerRecipe(ItemStack floatingFlower, ItemStack specialFlower, ItemStack output) {
|
||||
inputs.add(new PositionedStack(floatingFlower, 25, 6));
|
||||
inputs.add(new PositionedStack(specialFlower, 43, 6));
|
||||
this.output = new PositionedStack(output, 119, 24);
|
||||
this.output.setMaxSize(1);
|
||||
}
|
||||
public CachedFloatingFlowerRecipe(ItemStack floatingFlower, ItemStack specialFlower, ItemStack output) {
|
||||
inputs.add(new PositionedStack(floatingFlower, 25, 6));
|
||||
inputs.add(new PositionedStack(specialFlower, 43, 6));
|
||||
this.output = new PositionedStack(output, 119, 24);
|
||||
this.output.setMaxSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return getCycledIngredients(cycleticks / 20, inputs);
|
||||
}
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return inputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return output;
|
||||
}
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return output;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("botania.nei.floatingFlowers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("botania.nei.floatingFlowers");
|
||||
public String getOverlayIdentifier() {
|
||||
return "crafting2x2";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting"));
|
||||
}
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return "textures/gui/container/crafting_table.png";
|
||||
}
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return "textures/gui/container/crafting_table.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
if(Block.getBlockFromItem(result.getItem()) instanceof BlockFloatingSpecialFlower) {
|
||||
ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower, 1, OreDictionary.WILDCARD_VALUE);
|
||||
ItemStack specialFlower = new ItemStack(ModBlocks.specialFlower);
|
||||
specialFlower.setTagCompound((NBTTagCompound) result.getTagCompound().copy());
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
if (Block.getBlockFromItem(result.getItem()) instanceof BlockFloatingSpecialFlower) {
|
||||
ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower, 1, OreDictionary.WILDCARD_VALUE);
|
||||
ItemStack specialFlower = new ItemStack(ModBlocks.specialFlower);
|
||||
specialFlower.setTagCompound((NBTTagCompound) result.getTagCompound().copy());
|
||||
|
||||
arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower, specialFlower, result.copy()));
|
||||
}
|
||||
}
|
||||
arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower, specialFlower, result.copy()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
if(Block.getBlockFromItem(ingredient.getItem()) instanceof BlockSpecialFlower) {
|
||||
ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower, 1, OreDictionary.WILDCARD_VALUE);
|
||||
ItemStack result = new ItemStack(ModBlocks.floatingSpecialFlower);
|
||||
result.setTagCompound((NBTTagCompound) ingredient.getTagCompound().copy());
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
if (Block.getBlockFromItem(ingredient.getItem()) instanceof BlockSpecialFlower) {
|
||||
ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower, 1, OreDictionary.WILDCARD_VALUE);
|
||||
ItemStack result = new ItemStack(ModBlocks.floatingSpecialFlower);
|
||||
result.setTagCompound((NBTTagCompound) ingredient.getTagCompound().copy());
|
||||
|
||||
arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower, ingredient.copy(), result));
|
||||
}
|
||||
}
|
||||
arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower, ingredient.copy(), result));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,21 +2,19 @@
|
||||
* 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
|
||||
*
|
||||
* <p>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* <p>
|
||||
* File Created @ [12/12/2015, 23:25:47 (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.integration.nei.recipe;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
@@ -26,129 +24,149 @@ import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.KnowledgeType;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
|
||||
import vazkii.botania.client.integration.nei.NEIHelper;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.lib.LibColorUtils;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lexicon.page.PageText;
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
public class RecipeHandlerLexicaBotania extends TemplateRecipeHandler {
|
||||
private static final ItemStack LEXICA = new ItemStack(ModItems.lexicon);
|
||||
|
||||
public class CachedLexicaBotaniaRecipe extends CachedRecipe {
|
||||
public class CachedLexicaBotaniaRecipe extends CachedRecipe {
|
||||
|
||||
public LexiconEntry entry;
|
||||
public PositionedStack item;
|
||||
public List<PositionedStack> otherStacks = new ArrayList<>();
|
||||
public LexiconEntry entry;
|
||||
public PositionedStack item;
|
||||
|
||||
public CachedLexicaBotaniaRecipe(ItemStack stack, LexiconEntry entry) {
|
||||
otherStacks.add(new PositionedStack(new ItemStack(ModItems.lexicon), 51, 5));
|
||||
item = new PositionedStack(stack, 91, 5);
|
||||
this.entry = entry;
|
||||
}
|
||||
public CachedLexicaBotaniaRecipe(ItemStack stack, LexiconEntry entry) {
|
||||
item = new PositionedStack(stack, 91, 5);
|
||||
this.entry = entry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return otherStacks;
|
||||
}
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return item;
|
||||
}
|
||||
@Override
|
||||
public boolean contains(Collection<PositionedStack> ingredients, ItemStack ingredient) {
|
||||
return ingredient.getItem() == ModItems.lexicon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getOtherStacks() {
|
||||
return otherStacks;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Collection<PositionedStack> ingredients, ItemStack ingredient) {
|
||||
return ingredient.getItem() == ModItems.lexicon;
|
||||
}
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("botania.nei.lexica");
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return "botania.lexica";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("botania.nei.lexica");
|
||||
}
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return LibResources.GUI_NEI_BLANK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return LibResources.GUI_NEI_BLANK;
|
||||
}
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(50, 4, 18, 18), getOverlayIdentifier()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int recipiesPerPage() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(50, 4, 18, 18), "botania.lexica"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipe) {
|
||||
super.drawBackground(recipe);
|
||||
|
||||
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
|
||||
CachedLexicaBotaniaRecipe recipeObj = ((CachedLexicaBotaniaRecipe) arecipes.get(recipe));
|
||||
@Override
|
||||
public void drawBackground(int recipe) {
|
||||
super.drawBackground(recipe);
|
||||
|
||||
String s = EnumChatFormatting.UNDERLINE + StatCollector.translateToLocal(recipeObj.entry.getUnlocalizedName());
|
||||
font.drawString(s, 82 - font.getStringWidth(s) / 2, 30, 4210752);
|
||||
|
||||
KnowledgeType type = recipeObj.entry.getKnowledgeType();
|
||||
s = type.color + StatCollector.translateToLocal(type.getUnlocalizedName()).replaceAll("\\&.", "");
|
||||
font.drawString(s, 82 - font.getStringWidth(s) / 2, 42, 4210752);
|
||||
|
||||
s = "\"" + StatCollector.translateToLocal(recipeObj.entry.getTagline()) + "\"";
|
||||
PageText.renderText(5, 42, 160, 200, s);
|
||||
|
||||
String key = LexiconRecipeMappings.stackToString(recipeObj.item.item);
|
||||
String quickInfo = "botania.nei.quickInfo:" + key;
|
||||
String quickInfoLocal = StatCollector.translateToLocal(quickInfo);
|
||||
|
||||
if(GuiScreen.isShiftKeyDown() && GuiScreen.isCtrlKeyDown() && Minecraft.getMinecraft().gameSettings.advancedItemTooltips)
|
||||
s = "name: " + key;
|
||||
else if(quickInfo.equals(quickInfoLocal))
|
||||
s = StatCollector.translateToLocal("botania.nei.lexicaNoInfo");
|
||||
else {
|
||||
s = StatCollector.translateToLocal("botania.nei.lexicaSeparator");
|
||||
font.drawString(s, 82 - font.getStringWidth(s) / 2, 80, 4210752);
|
||||
s = quickInfoLocal;
|
||||
}
|
||||
|
||||
PageText.renderText(5, 80, 160, 200, s);
|
||||
}
|
||||
CachedLexicaBotaniaRecipe recipeObj = ((CachedLexicaBotaniaRecipe) arecipes.get(recipe));
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if(outputId.equals("botania.lexica")) {
|
||||
for(LexiconEntry entry : BotaniaAPI.getAllEntries()) {
|
||||
List<ItemStack> stacks = entry.getDisplayedRecipes();
|
||||
for(ItemStack stack : stacks)
|
||||
arecipes.add(new CachedLexicaBotaniaRecipe(stack, entry));
|
||||
}
|
||||
} else super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
NEIHelper.renderItemIntoGUI(LEXICA, 51, 5);
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for(LexiconEntry entry : BotaniaAPI.getAllEntries()) {
|
||||
List<ItemStack> stacks = entry.getDisplayedRecipes();
|
||||
for(ItemStack stack : stacks) {
|
||||
String key1 = LexiconRecipeMappings.stackToString(stack);
|
||||
String key2 = LexiconRecipeMappings.stackToString(result);
|
||||
if(key1.equals(key2))
|
||||
arecipes.add(new CachedLexicaBotaniaRecipe(stack, entry));
|
||||
}
|
||||
}
|
||||
}
|
||||
GuiDraw.drawStringC(
|
||||
EnumChatFormatting.UNDERLINE + StatCollector.translateToLocal(recipeObj.entry.getUnlocalizedName()),
|
||||
82,
|
||||
30,
|
||||
LibColorUtils.neiHandlerBotaniaLexicaTitle.getColor(),
|
||||
false);
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
// NO-OP
|
||||
}
|
||||
KnowledgeType type = recipeObj.entry.getKnowledgeType();
|
||||
GuiDraw.drawStringC(
|
||||
type.color + StatCollector.translateToLocal(type.getUnlocalizedName()).replaceAll("&[0-9a-fklmnor]", ""),
|
||||
82,
|
||||
42,
|
||||
LibColorUtils.neiHandlerBotaniaLexicaKnowledge.getColor(),
|
||||
false);
|
||||
|
||||
PageText.renderText(
|
||||
5,
|
||||
42,
|
||||
160,
|
||||
200,
|
||||
10,
|
||||
LibColorUtils.neiHandlerBotaniaLexicaTagline.getColor(),
|
||||
"\"" + StatCollector.translateToLocal(recipeObj.entry.getTagline()) + "\"");
|
||||
|
||||
String key = LexiconRecipeMappings.stackToString(recipeObj.item.item);
|
||||
String quickInfo = "botania.nei.quickInfo:" + key;
|
||||
String quickInfoLocal = StatCollector.translateToLocal(quickInfo);
|
||||
|
||||
String s;
|
||||
if (GuiScreen.isShiftKeyDown() && GuiScreen.isCtrlKeyDown() && Minecraft.getMinecraft().gameSettings.advancedItemTooltips)
|
||||
s = "name: " + key;
|
||||
else if (quickInfo.equals(quickInfoLocal))
|
||||
s = StatCollector.translateToLocal("botania.nei.lexicaNoInfo");
|
||||
else {
|
||||
GuiDraw.drawStringC(
|
||||
StatCollector.translateToLocal("botania.nei.lexicaSeparator"),
|
||||
82,
|
||||
80,
|
||||
LibColorUtils.neiHandlerBotaniaLexicaExtraInfo.getColor(),
|
||||
false);
|
||||
s = quickInfoLocal;
|
||||
}
|
||||
|
||||
PageText.renderText(5, 80, 160, 200, 10, LibColorUtils.neiHandlerBotaniaLexicaExtraInfoDesc.getColor(), s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals(getOverlayIdentifier())) {
|
||||
for (LexiconEntry entry : BotaniaAPI.getAllEntries()) {
|
||||
List<ItemStack> stacks = entry.getDisplayedRecipes();
|
||||
for (ItemStack stack : stacks)
|
||||
arecipes.add(new CachedLexicaBotaniaRecipe(stack, entry));
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (LexiconEntry entry : BotaniaAPI.getAllEntries()) {
|
||||
List<ItemStack> stacks = entry.getDisplayedRecipes();
|
||||
for (ItemStack stack : stacks) {
|
||||
String key1 = LexiconRecipeMappings.stackToString(stack);
|
||||
String key2 = LexiconRecipeMappings.stackToString(result);
|
||||
if (key1.equals(key2)) {
|
||||
arecipes.add(new CachedLexicaBotaniaRecipe(stack, entry));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(String outputId, Object... ingredients) {
|
||||
loadCraftingRecipes(outputId, ingredients);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
loadCraftingRecipes(ingredient);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +1,9 @@
|
||||
package vazkii.botania.client.integration.nei.recipe;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
@@ -17,6 +13,7 @@ import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.client.core.handler.HUDHandler;
|
||||
import vazkii.botania.client.integration.nei.NEIHelper;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.client.render.tile.RenderTilePool;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
@@ -28,120 +25,138 @@ import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
|
||||
public class RecipeHandlerManaPool extends TemplateRecipeHandler {
|
||||
|
||||
public class CachedManaPoolRecipe extends CachedRecipe {
|
||||
private static final ItemStack POOL = new ItemStack(ModBlocks.pool);
|
||||
|
||||
public List<PositionedStack> inputs = new ArrayList<>();
|
||||
public PositionedStack output;
|
||||
public List<PositionedStack> otherStacks = new ArrayList<>();
|
||||
public int mana;
|
||||
public class CachedManaPoolRecipe extends CachedRecipe {
|
||||
|
||||
public CachedManaPoolRecipe(RecipeManaInfusion recipe) {
|
||||
if(recipe == null)
|
||||
return;
|
||||
inputs.add(new PositionedStack(new ItemStack(ModBlocks.pool, 1, recipe.getOutput().getItem() == Item.getItemFromBlock(ModBlocks.pool) ? 2 : 0), 71, 37));
|
||||
private static final PositionedStack ALCHEMY = new PositionedStack(new ItemStack(ModBlocks.alchemyCatalyst), 10, 37);
|
||||
private static final PositionedStack CONJURATION = new PositionedStack(new ItemStack(ModBlocks.conjurationCatalyst), 10, 37);
|
||||
public PositionedStack input;
|
||||
public PositionedStack output;
|
||||
public PositionedStack catalyst;
|
||||
public int mana;
|
||||
|
||||
if(recipe.getInput() instanceof String)
|
||||
inputs.add(new PositionedStack(OreDictionary.getOres((String) recipe.getInput()), 42, 37));
|
||||
else inputs.add(new PositionedStack(recipe.getInput(), 42, 37));
|
||||
public CachedManaPoolRecipe(RecipeManaInfusion recipe) {
|
||||
if (recipe == null) return;
|
||||
|
||||
if(recipe.isAlchemy())
|
||||
otherStacks.add(new PositionedStack(new ItemStack(ModBlocks.alchemyCatalyst), 10, 37));
|
||||
else if (recipe.isConjuration())
|
||||
otherStacks.add(new PositionedStack(new ItemStack(ModBlocks.conjurationCatalyst), 10, 37));
|
||||
Object o = recipe.getInput();
|
||||
if (o instanceof String oreName) {
|
||||
o = OreDictionary.getOres(oreName);
|
||||
}
|
||||
input = new PositionedStack(o, 42, 37);
|
||||
|
||||
output = new PositionedStack(recipe.getOutput(), 101, 37);
|
||||
// This value is where the mana bar is stored initially
|
||||
mana = recipe.getManaToConsume();
|
||||
}
|
||||
if (recipe.isAlchemy()) {
|
||||
catalyst = ALCHEMY;
|
||||
} else if (recipe.isConjuration()) {
|
||||
catalyst = CONJURATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return getCycledIngredients(cycleticks / 20, inputs);
|
||||
}
|
||||
output = new PositionedStack(recipe.getOutput(), 101, 37);
|
||||
mana = recipe.getManaToConsume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return output;
|
||||
}
|
||||
@Override
|
||||
public PositionedStack getIngredient() {
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getOtherStacks() {
|
||||
return otherStacks;
|
||||
}
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return output;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public PositionedStack getOtherStack() {
|
||||
return catalyst;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("botania.nei.manaPool");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return LibResources.GUI_NEI_BLANK;
|
||||
}
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("botania.nei.manaPool");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int recipiesPerPage() {
|
||||
return 1;
|
||||
}
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return "botania.manaPool";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(70, 36, 18, 18), "botania.manaPool"));
|
||||
}
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return LibResources.GUI_NEI_BLANK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipe) {
|
||||
super.drawBackground(recipe);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
|
||||
// Mana infusion is the mana pool, super weird.
|
||||
GuiDraw.changeTexture(LibResources.GUI_MANA_INFUSION_OVERLAY);
|
||||
GuiDraw.drawTexturedModalRect(45, 20, 38, 35, 92, 50);
|
||||
// Below is where the mana bar actually drawn.
|
||||
int tempMana = ((CachedManaPoolRecipe) arecipes.get(recipe)).mana;
|
||||
HUDHandler.renderManaBar(32, 80, 0x0000FF, 0.75F, GuiScreen.isShiftKeyDown() ? tempMana : tempMana * 10, TilePool.MAX_MANA / 10);
|
||||
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
|
||||
String size = GuiScreen.isShiftKeyDown() ? "1x " : "10x ";
|
||||
String localized = StatCollector.translateToLocal("botaniamisc.neiratio");
|
||||
font.drawString(size + localized, 84 - font.getStringWidth(size + localized) / 2, 71, 0x000000);
|
||||
RenderTilePool.forceMana = true;
|
||||
}
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(70, 36, 18, 18), getOverlayIdentifier()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if(outputId.equals("botania.manaPool")) {
|
||||
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
@Override
|
||||
public void drawBackground(int recipe) {
|
||||
super.drawBackground(recipe);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
|
||||
// Arrows
|
||||
GuiDraw.changeTexture(LibResources.GUI_MANA_INFUSION_OVERLAY);
|
||||
GuiDraw.drawTexturedModalRect(45, 20, 38, 35, 92, 50);
|
||||
// Mana bar
|
||||
int tempMana = ((CachedManaPoolRecipe) arecipes.get(recipe)).mana;
|
||||
HUDHandler.renderManaBar(
|
||||
32,
|
||||
80,
|
||||
0x0000FF,
|
||||
0.75F,
|
||||
GuiScreen.isShiftKeyDown() ? tempMana : tempMana * 10,
|
||||
TilePool.MAX_MANA / 10);
|
||||
String size = GuiScreen.isShiftKeyDown() ? "1x" : "10x";
|
||||
String localized = StatCollector.translateToLocalFormatted("botaniamisc.neiratio", size);
|
||||
GuiDraw.drawStringC(localized, 84, 71, 0x000000, false);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
// Mana pool item
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
RenderTilePool.forceMana = true;
|
||||
NEIHelper.renderItemIntoGUI(POOL, 71, 37);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
}
|
||||
|
||||
arecipes.add(new CachedManaPoolRecipe(recipe));
|
||||
}
|
||||
} else super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals(getOverlayIdentifier())) {
|
||||
for (RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
|
||||
if (recipe == null) continue;
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
arecipes.add(new CachedManaPoolRecipe(recipe));
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
if(ItemNBTHelper.areStacksSameTypeCraftingWithNBT(recipe.getOutput(), result))
|
||||
arecipes.add(new CachedManaPoolRecipe(recipe));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
|
||||
if (recipe == null) continue;
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
if (ItemNBTHelper.areStacksSameTypeCraftingWithNBT(recipe.getOutput(), result)) {
|
||||
arecipes.add(new CachedManaPoolRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CachedManaPoolRecipe crecipe = new CachedManaPoolRecipe(recipe);
|
||||
if(ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getIngredients(), ingredient) || ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getOtherStacks(), ingredient))
|
||||
arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for (RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
|
||||
if (recipe == null) continue;
|
||||
|
||||
CachedManaPoolRecipe crecipe = new CachedManaPoolRecipe(recipe);
|
||||
if (ItemNBTHelper.positionedStackContainsWithNBT(crecipe.input, ingredient) ||
|
||||
ItemNBTHelper.positionedStackContainsWithNBT(crecipe.catalyst, ingredient)) {
|
||||
arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
@@ -13,6 +14,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipePetals;
|
||||
import vazkii.botania.client.integration.nei.NEIHelper;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
@@ -22,122 +24,144 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
|
||||
public class RecipeHandlerPetalApothecary extends TemplateRecipeHandler {
|
||||
private static final ItemStack APOTHECARY = new ItemStack(ModBlocks.altar);
|
||||
|
||||
public class CachedPetalApothecaryRecipe extends CachedRecipe {
|
||||
public class CachedPetalApothecaryRecipe extends CachedRecipe {
|
||||
public List<PositionedStack> inputs = new ArrayList<>();
|
||||
public PositionedStack output;
|
||||
|
||||
public List<PositionedStack> inputs = new ArrayList<>();
|
||||
public PositionedStack output;
|
||||
public CachedPetalApothecaryRecipe(RecipePetals recipe, PositionedStack centerItem) {
|
||||
this(recipe);
|
||||
inputs.add(centerItem);
|
||||
}
|
||||
|
||||
public CachedPetalApothecaryRecipe(RecipePetals recipe, boolean addCenterItem) {
|
||||
setIngredients(recipe.getInputs());
|
||||
output = new PositionedStack(recipe.getOutput(), 111, 21);
|
||||
if(addCenterItem)
|
||||
inputs.add(new PositionedStack(new ItemStack(ModBlocks.altar), 73, 55));
|
||||
}
|
||||
public CachedPetalApothecaryRecipe(RecipePetals recipe) {
|
||||
setIngredients(recipe.getInputs());
|
||||
output = new PositionedStack(recipe.getOutput(), 111, 21);
|
||||
}
|
||||
|
||||
public CachedPetalApothecaryRecipe(RecipePetals recipe) {
|
||||
this(recipe, true);
|
||||
}
|
||||
// Kept for Alfheim, which calls super(recipe, false) from its NEI handler.
|
||||
@Deprecated
|
||||
@SuppressWarnings("unused")
|
||||
public CachedPetalApothecaryRecipe(RecipePetals recipe, boolean addCenterItem) {
|
||||
this(recipe);
|
||||
}
|
||||
|
||||
public void setIngredients(List<Object> inputs) {
|
||||
float degreePerInput = 360F / inputs.size();
|
||||
float currentDegree = -90F;
|
||||
public void setIngredients(List<Object> inputs) {
|
||||
float degreePerInput = 360F / inputs.size();
|
||||
float currentDegree = -90F;
|
||||
|
||||
for(Object o : inputs) {
|
||||
int posX = (int) Math.round(73 + Math.cos(currentDegree * Math.PI / 180D) * 32);
|
||||
int posY = (int) Math.round(55 + Math.sin(currentDegree * Math.PI / 180D) * 32);
|
||||
for (Object o : inputs) {
|
||||
int posX = (int) Math.round(73 + Math.cos(currentDegree * Math.PI / 180D) * 32);
|
||||
int posY = (int) Math.round(55 + Math.sin(currentDegree * Math.PI / 180D) * 32);
|
||||
|
||||
if(o instanceof String)
|
||||
this.inputs.add(new PositionedStack(OreDictionary.getOres((String) o), posX, posY));
|
||||
else this.inputs.add(new PositionedStack(o, posX, posY));
|
||||
currentDegree += degreePerInput;
|
||||
}
|
||||
}
|
||||
if (o instanceof String oreName) {
|
||||
o = OreDictionary.getOres(oreName);
|
||||
}
|
||||
this.inputs.add(new PositionedStack(o, posX, posY));
|
||||
currentDegree += degreePerInput;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return getCycledIngredients(cycleticks / 20, inputs);
|
||||
}
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return inputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return output;
|
||||
}
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("botania.nei.petalApothecary");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("botania.nei.petalApothecary");
|
||||
}
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return getRecipeID();
|
||||
}
|
||||
|
||||
public String getRecipeID() {
|
||||
return "botania.petalApothecary";
|
||||
}
|
||||
// Kept for Alfheim, which overrides this instead of getOverlayIdentifier().
|
||||
@Deprecated
|
||||
public String getRecipeID() {
|
||||
return "botania.petalApothecary";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return LibResources.GUI_NEI_BLANK;
|
||||
}
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return LibResources.GUI_NEI_BLANK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(72, 54, 18, 18), getRecipeID()));
|
||||
}
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(73, 56, 16, 16), getOverlayIdentifier()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int recipiesPerPage() {
|
||||
return 1;
|
||||
}
|
||||
@Override
|
||||
public void drawBackground(int recipe) {
|
||||
super.drawBackground(recipe);
|
||||
// Background circle graphic
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
|
||||
GuiDraw.changeTexture(LibResources.GUI_PETAL_OVERLAY);
|
||||
GuiDraw.drawTexturedModalRect(45, 10, 38, 7, 92, 92);
|
||||
// Item
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
NEIHelper.renderItemIntoGUI(getRenderItem(), 73, 55);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipe) {
|
||||
super.drawBackground(recipe);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
|
||||
GuiDraw.changeTexture(LibResources.GUI_PETAL_OVERLAY);
|
||||
GuiDraw.drawTexturedModalRect(45, 10, 38, 7, 92, 92);
|
||||
}
|
||||
protected ItemStack getRenderItem() {
|
||||
return APOTHECARY;
|
||||
}
|
||||
|
||||
public List<? extends RecipePetals> getRecipes() {
|
||||
return BotaniaAPI.petalRecipes;
|
||||
}
|
||||
public List<? extends RecipePetals> getRecipes() {
|
||||
return BotaniaAPI.petalRecipes;
|
||||
}
|
||||
|
||||
public CachedPetalApothecaryRecipe getCachedRecipe(RecipePetals recipe) {
|
||||
return new CachedPetalApothecaryRecipe(recipe);
|
||||
}
|
||||
public CachedPetalApothecaryRecipe getCachedRecipe(RecipePetals recipe) {
|
||||
ItemStack seedStack = new ItemStack(Items.wheat_seeds);
|
||||
seedStack.setStackDisplayName(StatCollector.translateToLocal("botania.nei.anySeed"));
|
||||
return new CachedPetalApothecaryRecipe(recipe, new PositionedStack(seedStack, 73, 39));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if(outputId.equals(getRecipeID())) {
|
||||
for(RecipePetals recipe : getRecipes())
|
||||
if(recipe.getOutput().getItem() != Items.skull)
|
||||
arecipes.add(getCachedRecipe(recipe));
|
||||
} else super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals(getOverlayIdentifier())) {
|
||||
for (RecipePetals recipe : getRecipes())
|
||||
if (recipe.getOutput().getItem() != Items.skull)
|
||||
arecipes.add(getCachedRecipe(recipe));
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for(RecipePetals recipe : getRecipes()){
|
||||
if(recipe == null)
|
||||
continue;
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (RecipePetals recipe : getRecipes()) {
|
||||
if (recipe == null) continue;
|
||||
|
||||
if(recipe.getOutput().stackTagCompound != null && ItemNBTHelper.areStacksSameTypeWithNBT(recipe.getOutput(), result) || recipe.getOutput().stackTagCompound == null && NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result) && recipe.getOutput().getItem() != Items.skull)
|
||||
arecipes.add(getCachedRecipe(recipe));
|
||||
}
|
||||
}
|
||||
if (recipe.getOutput().stackTagCompound != null && ItemNBTHelper.areStacksSameTypeWithNBT(recipe.getOutput(), result) || recipe.getOutput().stackTagCompound == null && NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result) && recipe.getOutput().getItem() != Items.skull) {
|
||||
arecipes.add(getCachedRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for(RecipePetals recipe : getRecipes()) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
|
||||
CachedPetalApothecaryRecipe crecipe = getCachedRecipe(recipe);
|
||||
if(ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.inputs, ingredient) && recipe.getOutput().getItem() != Items.skull)
|
||||
arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for (RecipePetals recipe : getRecipes()) {
|
||||
if (recipe == null) continue;
|
||||
|
||||
CachedPetalApothecaryRecipe crecipe = getCachedRecipe(recipe);
|
||||
if (ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.inputs, ingredient) && recipe.getOutput().getItem() != Items.skull) {
|
||||
arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
package vazkii.botania.client.integration.nei.recipe;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -13,6 +11,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipePureDaisy;
|
||||
import vazkii.botania.client.integration.nei.NEIHelper;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
@@ -23,103 +22,102 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
public class RecipeHandlerPureDaisy extends TemplateRecipeHandler {
|
||||
|
||||
public class CachedPureDaisyRecipe extends CachedRecipe {
|
||||
private static final ItemStack DAISY = ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY);
|
||||
|
||||
public List<PositionedStack> inputs = new ArrayList<>();
|
||||
public PositionedStack output;
|
||||
public List<PositionedStack> otherStacks = new ArrayList<>();
|
||||
public class CachedPureDaisyRecipe extends CachedRecipe {
|
||||
|
||||
public CachedPureDaisyRecipe(RecipePureDaisy recipe) {
|
||||
if(recipe == null)
|
||||
return;
|
||||
inputs.add(new PositionedStack(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY), 71, 23));
|
||||
public PositionedStack inputs;
|
||||
public PositionedStack output;
|
||||
|
||||
if(recipe.getInput() instanceof String)
|
||||
inputs.add(new PositionedStack(OreDictionary.getOres((String) recipe.getInput()), 42, 23));
|
||||
else inputs.add(new PositionedStack(new ItemStack((Block) recipe.getInput()), 42, 23));
|
||||
public CachedPureDaisyRecipe(RecipePureDaisy recipe) {
|
||||
if (recipe == null) return;
|
||||
|
||||
output = new PositionedStack(new ItemStack(recipe.getOutput()), 101, 23);
|
||||
}
|
||||
Object o = recipe.getInput();
|
||||
if (o instanceof String oreName) {
|
||||
o = OreDictionary.getOres(oreName);
|
||||
} else {
|
||||
o = new ItemStack((Block) o);
|
||||
}
|
||||
inputs = new PositionedStack(o, 42, 23);
|
||||
output = new PositionedStack(new ItemStack(recipe.getOutput()), 101, 23);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return getCycledIngredients(cycleticks / 20, inputs);
|
||||
}
|
||||
@Override
|
||||
public PositionedStack getIngredient() {
|
||||
return inputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return output;
|
||||
}
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getOtherStacks() {
|
||||
return otherStacks;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("botania.nei.pureDaisy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("botania.nei.pureDaisy");
|
||||
public String getOverlayIdentifier() {
|
||||
return "botania.pureDaisy";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return LibResources.GUI_NEI_BLANK;
|
||||
}
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return LibResources.GUI_NEI_BLANK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int recipiesPerPage() {
|
||||
return 2;
|
||||
}
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(70, 22, 18, 18), getOverlayIdentifier()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(70, 22, 18, 18), "botania.pureDaisy"));
|
||||
}
|
||||
@Override
|
||||
public void drawBackground(int recipe) {
|
||||
super.drawBackground(recipe);
|
||||
// Arrows
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
|
||||
GuiDraw.changeTexture(LibResources.GUI_PURE_DAISY_OVERLAY);
|
||||
GuiDraw.drawTexturedModalRect(48, 10, 0, 0, 65, 44);
|
||||
// Flower item
|
||||
NEIHelper.renderItemIntoGUI(DAISY, 71, 23);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipe) {
|
||||
super.drawBackground(recipe);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
|
||||
GuiDraw.changeTexture(LibResources.GUI_PURE_DAISY_OVERLAY);
|
||||
GuiDraw.drawTexturedModalRect(45, 10, 0, 0, 65, 44);
|
||||
}
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals(getOverlayIdentifier())) {
|
||||
for (RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
|
||||
if (recipe != null) arecipes.add(new CachedPureDaisyRecipe(recipe));
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if(outputId.equals("botania.pureDaisy")) {
|
||||
for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
|
||||
if (recipe == null) continue;
|
||||
|
||||
arecipes.add(new CachedPureDaisyRecipe(recipe));
|
||||
}
|
||||
} else super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
if (ItemNBTHelper.areStacksSameTypeCraftingWithNBT(new ItemStack(recipe.getOutput()), result)) {
|
||||
arecipes.add(new CachedPureDaisyRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for (RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
|
||||
if (recipe == null) continue;
|
||||
|
||||
if(ItemNBTHelper.areStacksSameTypeCraftingWithNBT(new ItemStack(recipe.getOutput()), result))
|
||||
arecipes.add(new CachedPureDaisyRecipe(recipe));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
|
||||
if(recipe == null)
|
||||
continue;
|
||||
|
||||
CachedPureDaisyRecipe crecipe = new CachedPureDaisyRecipe(recipe);
|
||||
if(ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getIngredients(), ingredient) || ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getOtherStacks(), ingredient))
|
||||
arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
CachedPureDaisyRecipe crecipe = new CachedPureDaisyRecipe(recipe);
|
||||
if (ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getIngredients(), ingredient) || ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getOtherStacks(), ingredient)) {
|
||||
arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,44 +14,48 @@ import codechicken.nei.PositionedStack;
|
||||
|
||||
public class RecipeHandlerRunicAltar extends RecipeHandlerPetalApothecary {
|
||||
|
||||
public class CachedRunicAltarRecipe extends CachedPetalApothecaryRecipe {
|
||||
private static final ItemStack ALTAR = new ItemStack(ModBlocks.runeAltar);
|
||||
private static final PositionedStack LIVINGROCK = new PositionedStack(new ItemStack(ModBlocks.livingrock), 73, 39);
|
||||
|
||||
public int manaUsage;
|
||||
public class CachedRunicAltarRecipe extends CachedPetalApothecaryRecipe {
|
||||
|
||||
public CachedRunicAltarRecipe(RecipeRuneAltar recipe) {
|
||||
super(recipe, false);
|
||||
if(recipe == null)
|
||||
return;
|
||||
manaUsage = recipe.getManaUsage();
|
||||
inputs.add(new PositionedStack(new ItemStack(ModBlocks.runeAltar), 73, 55));
|
||||
}
|
||||
public int manaUsage;
|
||||
|
||||
}
|
||||
public CachedRunicAltarRecipe(RecipeRuneAltar recipe, PositionedStack centerItem) {
|
||||
super(recipe, centerItem);
|
||||
manaUsage = recipe.getManaUsage();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("botania.nei.runicAltar");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return "botania.runicAltar";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipe) {
|
||||
super.drawBackground(recipe);
|
||||
HUDHandler.renderManaBar(32, 113, 0x0000FF, 0.75F, ((CachedRunicAltarRecipe) arecipes.get(recipe)).manaUsage, TilePool.MAX_MANA / 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends RecipePetals> getRecipes() {
|
||||
return BotaniaAPI.runeAltarRecipes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CachedPetalApothecaryRecipe getCachedRecipe(RecipePetals recipe) {
|
||||
return new CachedRunicAltarRecipe((RecipeRuneAltar) recipe, LIVINGROCK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("botania.nei.runicAltar");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "botania.runicAltar";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipe) {
|
||||
super.drawBackground(recipe);
|
||||
HUDHandler.renderManaBar(32, 113, 0x0000FF, 0.75F, ((CachedRunicAltarRecipe) arecipes.get(recipe)).manaUsage, TilePool.MAX_MANA / 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends RecipePetals> getRecipes() {
|
||||
return BotaniaAPI.runeAltarRecipes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CachedPetalApothecaryRecipe getCachedRecipe(RecipePetals recipe) {
|
||||
return new CachedRunicAltarRecipe((RecipeRuneAltar) recipe);
|
||||
}
|
||||
protected ItemStack getRenderItem() {
|
||||
return ALTAR;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,11 +36,11 @@ public class RenderSpecialFlower implements ISimpleBlockRenderingHandler, IMulti
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
return renderCrossedSquares(blockAccess, block, x, y, z, renderer);
|
||||
return renderCrossedSquares(blockAccess, block, x, y, z, 1.0F, true, renderer);
|
||||
}
|
||||
|
||||
// Copied from RenderBlocks
|
||||
public static boolean renderCrossedSquares(IBlockAccess blockAccess, Block block, int x, int y, int z, RenderBlocks render) {
|
||||
public static boolean renderCrossedSquares(IBlockAccess blockAccess, Block block, int x, int y, int z, float scale, boolean doRandomShift, RenderBlocks render) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(blockAccess, x, y, z));
|
||||
float f = 1.0F;
|
||||
@@ -64,16 +64,17 @@ public class RenderSpecialFlower implements ISimpleBlockRenderingHandler, IMulti
|
||||
double d0 = z;
|
||||
long sh;
|
||||
|
||||
sh = x * 3129871 ^ z * 116129781L ^ y;
|
||||
sh = sh * sh * 42317861L + sh * 11L;
|
||||
d1 += ((sh >> 16 & 15L) / 15.0F - 0.5D) * 0.3D;
|
||||
d2 += (sh >> 32 & 15L) / 15.0F * -0.15D;
|
||||
d0 += ((sh >> 24 & 15L) / 15.0F - 0.5D) * 0.3D;
|
||||
|
||||
if (doRandomShift) {
|
||||
sh = x * 3129871 ^ z * 116129781L ^ y;
|
||||
sh = sh * sh * 42317861L + sh * 11L;
|
||||
d1 += ((sh >> 16 & 15L) / 15.0F - 0.5D) * 0.3D;
|
||||
d2 += (sh >> 32 & 15L) / 15.0F * -0.15D;
|
||||
d0 += ((sh >> 24 & 15L) / 15.0F - 0.5D) * 0.3D;
|
||||
}
|
||||
|
||||
// Only change here, to use xyz rather than side/meta
|
||||
IIcon icon = render.getBlockIcon(block, blockAccess, x, y, z, 0);
|
||||
drawCrossedSquares(blockAccess, block, icon, x, y, z, d1, d2, d0, 1.0F, render);
|
||||
drawCrossedSquares(blockAccess, block, icon, x, y, z, d1, d2, d0, scale, render);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
*/
|
||||
package vazkii.botania.client.render.item;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -20,10 +22,13 @@ import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.common.lib.LibObfuscation;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import vazkii.botania.utils.ReflectionUtils;
|
||||
|
||||
public class RenderBow implements IItemRenderer {
|
||||
|
||||
private static final Field ITEM_IN_USE = ReflectionUtils.findField(EntityPlayer.class, LibObfuscation.ITEM_IN_USE);
|
||||
private static final Field ITEM_IN_USE_COUNT = ReflectionUtils.findField(EntityPlayer.class, LibObfuscation.ITEM_IN_USE_COUNT);
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type != ItemRenderType.INVENTORY;
|
||||
@@ -62,8 +67,11 @@ public class RenderBow implements IItemRenderer {
|
||||
int dmg = item.getItemDamage();
|
||||
IIcon icon = item.getItem().getIconFromDamageForRenderPass(dmg, 0);
|
||||
if(player != null) {
|
||||
ItemStack using = ReflectionHelper.getPrivateValue(EntityPlayer.class, player, LibObfuscation.ITEM_IN_USE);
|
||||
int time = ReflectionHelper.getPrivateValue(EntityPlayer.class, player, LibObfuscation.ITEM_IN_USE_COUNT);
|
||||
ItemStack using = (ItemStack) ReflectionUtils.getObject(ITEM_IN_USE, player);
|
||||
int time = 0;
|
||||
Object timeObj = ReflectionUtils.getObject(ITEM_IN_USE_COUNT, player);
|
||||
if(timeObj != null)
|
||||
time = (Integer) timeObj;
|
||||
icon = item.getItem().getIcon(item, 0, player, using, time);
|
||||
if(transform) {
|
||||
GL11.glTranslatef(0.2F, -0.3F, 0.1F);
|
||||
|
||||
@@ -12,10 +12,8 @@ package vazkii.botania.client.render.item;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
@@ -27,9 +25,6 @@ import vazkii.botania.common.item.lens.ItemLens;
|
||||
|
||||
public class RenderLens implements IItemRenderer {
|
||||
|
||||
static RenderItem render = new RenderItem();
|
||||
ItemRenderer renderer = new ItemRenderer(Minecraft.getMinecraft());
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type != ItemRenderType.INVENTORY;
|
||||
@@ -42,25 +37,22 @@ public class RenderLens implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch(type) {
|
||||
case ENTITY : {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, 0F, 0F);
|
||||
if(item.isOnItemFrame())
|
||||
GL11.glTranslatef(0F, -0.3F, 0.01F);
|
||||
render(item);
|
||||
GL11.glPopMatrix();
|
||||
break;
|
||||
}
|
||||
case EQUIPPED : {
|
||||
render(item);
|
||||
break;
|
||||
}
|
||||
case EQUIPPED_FIRST_PERSON : {
|
||||
render(item);
|
||||
break;
|
||||
}
|
||||
default : break;
|
||||
switch (type) {
|
||||
case ENTITY: {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, 0F, 0F);
|
||||
if (item.isOnItemFrame())
|
||||
GL11.glTranslatef(0F, -0.3F, 0.01F);
|
||||
render(item);
|
||||
GL11.glPopMatrix();
|
||||
break;
|
||||
}
|
||||
case EQUIPPED, EQUIPPED_FIRST_PERSON: {
|
||||
render(item);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +103,7 @@ public class RenderLens implements IItemRenderer {
|
||||
float zLevel = 0F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
if(shiny)
|
||||
if (shiny)
|
||||
tessellator.setBrightness(240);
|
||||
tessellator.addVertexWithUV(par1 + 0, par2 + par5, zLevel, icon.getMinU(), icon.getMaxV());
|
||||
tessellator.addVertexWithUV(par1 + par4, par2 + par5, zLevel, icon.getMaxU(), icon.getMaxV());
|
||||
|
||||
@@ -17,7 +17,6 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -52,7 +51,6 @@ public class RenderTileAltar extends TileEntitySpecialRenderer {
|
||||
private static final ResourceLocation textureMossy = new ResourceLocation(LibResources.MODEL_ALTAR_MOSSY);
|
||||
|
||||
ModelAltar model = new ModelAltar();
|
||||
RenderItem renderItem = new RenderItem();
|
||||
RenderBlocks renderBlocks = new RenderBlocks();
|
||||
public static int forceMeta = -1;
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ public class RenderTileBrewery extends TileEntitySpecialRenderer {
|
||||
model.render(this, time);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
brewery = null;
|
||||
}
|
||||
|
||||
public void renderItemStack(ItemStack stack) {
|
||||
|
||||
@@ -33,7 +33,8 @@ public class RenderTileCocoon extends TileEntitySpecialRenderer {
|
||||
|
||||
float rot = 0F;
|
||||
float modval = 60F - (float) cocoon.timePassed / (float) TileCocoon.TOTAL_TIME * 30F;
|
||||
if(cocoon.timePassed % modval < 10) {
|
||||
// At timePassed 0 with partialTicks 0 (inventory/NEI render), log(0) makes rot NaN and the model disappears.
|
||||
if(cocoon.timePassed > 0 && cocoon.timePassed % modval < 10) {
|
||||
float mod = (cocoon.timePassed + partialTicks) % modval;
|
||||
float v = mod / 5 * (float) Math.PI * 2;
|
||||
rot = (float) Math.sin(v) * (float) Math.log(cocoon.timePassed + partialTicks);
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
package vazkii.botania.client.render.tile;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -33,15 +32,12 @@ public class RenderTileCorporeaCrystalCube extends TileEntitySpecialRenderer {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_CRYSTAL_CUBE);
|
||||
ModelCrystalCube model = new ModelCrystalCube();
|
||||
EntityItem entity = null;
|
||||
EntityItem entity = new EntityItem(null, 0, 0, 0, new ItemStack(Blocks.stone));
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
TileCorporeaCrystalCube cube = (TileCorporeaCrystalCube) tileEntity;
|
||||
|
||||
if(entity == null)
|
||||
entity = new EntityItem(cube.getWorldObj(), cube.xCoord, cube.yCoord, cube.zCoord, new ItemStack(Blocks.stone));
|
||||
|
||||
entity.age = ClientTickHandler.ticksInGame;
|
||||
ItemStack stack = cube.getRequestTarget();
|
||||
entity.setEntityItemStack(stack);
|
||||
@@ -67,7 +63,7 @@ public class RenderTileCorporeaCrystalCube extends TileEntitySpecialRenderer {
|
||||
GL11.glTranslatef(0F, 0.8F, 0F);
|
||||
GL11.glScalef(s, s, s);
|
||||
GL11.glRotatef(180F, 0F, 0F, 1F);
|
||||
((Render) RenderManager.instance.entityRenderMap.get(EntityItem.class)).doRender(entity, 0, 0, 0, 1F, partialTicks);
|
||||
RenderManager.instance.entityRenderMap.get(EntityItem.class).doRender(entity, 0, 0, 0, 1F, partialTicks);
|
||||
GL11.glPopMatrix();
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
}
|
||||
|
||||
@@ -12,15 +12,13 @@ package vazkii.botania.client.render.tile;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -32,8 +30,7 @@ import vazkii.botania.common.block.tile.TileEnchanter;
|
||||
|
||||
public class RenderTileEnchanter extends TileEntitySpecialRenderer {
|
||||
|
||||
RenderItem renderItem = new RenderItem();
|
||||
EntityItem item;
|
||||
EntityItem item = new EntityItem(null, 0, 0, 0, new ItemStack(Blocks.stone));
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
@@ -48,15 +45,12 @@ public class RenderTileEnchanter extends TileEntitySpecialRenderer {
|
||||
alphaMod = 1F;
|
||||
|
||||
if(enchanter.itemToEnchant != null) {
|
||||
if(item == null)
|
||||
item = new EntityItem(enchanter.getWorldObj(), enchanter.xCoord, enchanter.yCoord + 1, enchanter.zCoord, enchanter.itemToEnchant);
|
||||
|
||||
item.age = ClientTickHandler.ticksInGame;
|
||||
item.setEntityItemStack(enchanter.itemToEnchant);
|
||||
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslatef(0.5F, 1.25F, 0.5F);
|
||||
((Render) RenderManager.instance.entityRenderMap.get(EntityItem.class)).doRender(item, x, y, z, 1F, partialTicks);
|
||||
RenderManager.instance.entityRenderMap.get(EntityItem.class).doRender(item, x, y, z, 1F, partialTicks);
|
||||
GL11.glTranslatef(-0.5F, -1.25F, -0.5F);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,6 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.passive.EntitySheep;
|
||||
@@ -44,7 +42,6 @@ public class RenderTilePool extends TileEntitySpecialRenderer {
|
||||
private static final ResourceLocation textureDil = new ResourceLocation(LibResources.MODEL_DILUTED_POOL);
|
||||
|
||||
private static final ModelPool model = new ModelPool();
|
||||
RenderItem renderItem = new RenderItem();
|
||||
|
||||
public static int forceMeta = 0;
|
||||
public static boolean forceMana = false;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.client.render.world;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -18,6 +19,7 @@ import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderGlobal;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Vec3;
|
||||
@@ -28,7 +30,7 @@ import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.lib.LibObfuscation;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import vazkii.botania.utils.ReflectionUtils;
|
||||
|
||||
public class SkyblockSkyRenderer extends IRenderHandler {
|
||||
|
||||
@@ -45,25 +47,48 @@ public class SkyblockSkyRenderer extends IRenderHandler {
|
||||
new ResourceLocation(LibResources.MISC_PLANET + "5.png")
|
||||
};
|
||||
|
||||
private static final Field GL_SKY_LIST = ReflectionUtils.findField(RenderGlobal.class, LibObfuscation.GL_SKY_LIST);
|
||||
private static final Field STAR_GL_CALL_LIST = ReflectionUtils.findField(RenderGlobal.class, LibObfuscation.STAR_GL_CALL_LIST);
|
||||
|
||||
// rainbow angles are deterministic per in-game day
|
||||
private static int lastRainbowDay = -1;
|
||||
private static float rainbowAngle1, rainbowAngle2;
|
||||
|
||||
// sky color samples, interpolated across ticks by partialTicks
|
||||
private static int lastSkySampleTick = -1;
|
||||
private static float skyRed0, skyGreen0, skyBlue0;
|
||||
private static float skyRed1, skyGreen1, skyBlue1;
|
||||
|
||||
@Override
|
||||
public void render(float partialTicks, WorldClient world, Minecraft mc) {
|
||||
boolean test = false;
|
||||
if(test)
|
||||
return;
|
||||
|
||||
int glSkyList = ReflectionHelper.getPrivateValue(RenderGlobal.class, mc.renderGlobal, LibObfuscation.GL_SKY_LIST);
|
||||
int starGLCallList = ReflectionHelper.getPrivateValue(RenderGlobal.class, mc.renderGlobal, LibObfuscation.STAR_GL_CALL_LIST);
|
||||
int glSkyList = ReflectionUtils.getInt(GL_SKY_LIST, mc.renderGlobal);
|
||||
int starGLCallList = ReflectionUtils.getInt(STAR_GL_CALL_LIST, mc.renderGlobal);
|
||||
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
Vec3 vec3 = world.getSkyColor(mc.renderViewEntity, partialTicks);
|
||||
float f1 = (float)vec3.xCoord;
|
||||
float f2 = (float)vec3.yCoord;
|
||||
float f3 = (float)vec3.zCoord;
|
||||
Entity viewEntity = mc.renderViewEntity;
|
||||
int tick = ClientTickHandler.ticksInGame;
|
||||
if(tick != lastSkySampleTick) {
|
||||
if(lastSkySampleTick != -1) {
|
||||
skyRed0 = skyRed1;
|
||||
skyGreen0 = skyGreen1;
|
||||
skyBlue0 = skyBlue1;
|
||||
}
|
||||
Vec3 sample = world.getSkyColor(viewEntity, 1.0F);
|
||||
skyRed1 = (float) sample.xCoord;
|
||||
skyGreen1 = (float) sample.yCoord;
|
||||
skyBlue1 = (float) sample.zCoord;
|
||||
lastSkySampleTick = tick;
|
||||
}
|
||||
float frac = Math.min(1F, Math.max(0F, partialTicks));
|
||||
float f1 = skyRed0 + (skyRed1 - skyRed0) * frac;
|
||||
float f2 = skyGreen0 + (skyGreen1 - skyGreen0) * frac;
|
||||
float f3 = skyBlue0 + (skyBlue1 - skyBlue0) * frac;
|
||||
float f6;
|
||||
|
||||
float insideVoid = 0;
|
||||
if(mc.thePlayer.posY <= -2)
|
||||
insideVoid = (float) Math.min(1F, -(mc.thePlayer.posY + 2) / 30F);
|
||||
if(viewEntity.posY <= -2)
|
||||
insideVoid = (float) Math.min(1F, -(viewEntity.posY + 2) / 30F);
|
||||
|
||||
f1 = Math.max(0F, f1 - insideVoid);
|
||||
f2 = Math.max(0F, f2 - insideVoid);
|
||||
@@ -244,9 +269,14 @@ public class SkyblockSkyRenderer extends IRenderHandler {
|
||||
|
||||
long time = world.getWorldTime() + 1000;
|
||||
int day = (int) (time / 24000L);
|
||||
Random rand = new Random(day * 0xFF);
|
||||
float angle1 = rand.nextFloat() * 360F;
|
||||
float angle2 = rand.nextFloat() * 360F;
|
||||
if(lastRainbowDay != day) {
|
||||
Random rand = new Random(day * 0xFF);
|
||||
rainbowAngle1 = rand.nextFloat() * 360F;
|
||||
rainbowAngle2 = rand.nextFloat() * 360F;
|
||||
lastRainbowDay = day;
|
||||
}
|
||||
float angle1 = rainbowAngle1;
|
||||
float angle2 = rainbowAngle2;
|
||||
GL11.glColor4f(1F, 1F, 1F, effCelAng1 * (1F - insideVoid));
|
||||
GL11.glRotatef(angle1, 0F, 1F, 0F);
|
||||
GL11.glRotatef(angle2, 0F, 0F, 1F);
|
||||
|
||||
@@ -43,6 +43,7 @@ public class Botania {
|
||||
public static boolean etFuturumLoaded = false;
|
||||
public static boolean storageDrawersLoaded = false;
|
||||
public static boolean structureLibLoaded = false;
|
||||
public static boolean neiLoaded = false;
|
||||
|
||||
public static ILightHelper lightHelper;
|
||||
|
||||
@@ -63,6 +64,7 @@ public class Botania {
|
||||
etFuturumLoaded = Loader.isModLoaded("etfuturum");
|
||||
storageDrawersLoaded = Loader.isModLoaded("StorageDrawers");
|
||||
structureLibLoaded = Loader.isModLoaded("structurelib");
|
||||
neiLoaded = Loader.isModLoaded("NotEnoughItems");
|
||||
|
||||
lightHelper = coloredLightsLoaded ? new LightHelperColored() : new LightHelperVanilla();
|
||||
proxy.preInit(event);
|
||||
|
||||
@@ -62,10 +62,13 @@ public class BlockAlfPortal extends BlockModContainer<TileAlfPortal> implements
|
||||
|
||||
@Override
|
||||
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) {
|
||||
boolean did = ((TileAlfPortal) world.getTileEntity(x, y, z)).onWanded();
|
||||
if(did && player != null)
|
||||
player.addStat(ModAchievements.elfPortalOpen, 1);
|
||||
return did;
|
||||
if(!world.isRemote) {
|
||||
boolean did = ((TileAlfPortal) world.getTileEntity(x, y, z)).onWanded();
|
||||
if(did && player != null)
|
||||
player.addStat(ModAchievements.elfPortalOpen, 1);
|
||||
return did;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,12 +10,16 @@
|
||||
*/
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.api.IFlowerPottable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -23,13 +27,16 @@ import net.minecraft.entity.passive.EntitySheep;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.client.lib.LibRenderIDs;
|
||||
import vazkii.botania.client.render.block.RenderSpecialFlower;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.achievement.IPickupAchievement;
|
||||
import vazkii.botania.common.achievement.ModAchievements;
|
||||
@@ -42,7 +49,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockModFlower extends BlockFlower implements ILexiconable, IPickupAchievement, IGrowable {
|
||||
public class BlockModFlower extends BlockFlower implements ILexiconable, IPickupAchievement, IGrowable, IFlowerPottable {
|
||||
|
||||
public static IIcon[] icons;
|
||||
public static IIcon[] iconsAlt;
|
||||
@@ -156,4 +163,12 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup
|
||||
world.setBlock(x, y + 1, z, flower, placeMeta | 8, flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderFlowerPot(NBTTagCompound compound, IBlockAccess blockAccess, Block block, int x, int y, int z, RenderBlocks render) {
|
||||
Tessellator tess = Tessellator.instance;
|
||||
tess.addTranslation(0, 4F / 16F, 0);
|
||||
boolean b = RenderSpecialFlower.renderCrossedSquares(blockAccess, block, x, y, z, 0.75F, false, render);
|
||||
tess.addTranslation(0, -4F / 16F, 0);
|
||||
return b;
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ package vazkii.botania.common.block.decor;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.api.IFlowerPottable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockMushroom;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -44,7 +45,7 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@Optional.Interface(modid = "Thaumcraft", iface = "thaumcraft.api.crafting.IInfusionStabiliser", striprefs = true)
|
||||
public class BlockModMushroom extends BlockMushroom implements IInfusionStabiliser, IHornHarvestable, ILexiconable {
|
||||
public class BlockModMushroom extends BlockMushroom implements IInfusionStabiliser, IHornHarvestable, ILexiconable, IFlowerPottable {
|
||||
|
||||
public static IIcon[] icons;
|
||||
public int originalLight;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.subtile.functional;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -21,10 +22,12 @@ import vazkii.botania.api.subtile.RadiusDescriptor;
|
||||
import vazkii.botania.api.subtile.SubTileFunctional;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibObfuscation;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import vazkii.botania.utils.ReflectionUtils;
|
||||
|
||||
public class SubTilePollidisiac extends SubTileFunctional {
|
||||
|
||||
private static final Field IN_LOVE = ReflectionUtils.findField(EntityAnimal.class, LibObfuscation.IN_LOVE);
|
||||
|
||||
private static final int RANGE = 6;
|
||||
|
||||
@Override
|
||||
@@ -42,7 +45,7 @@ public class SubTilePollidisiac extends SubTileFunctional {
|
||||
if(mana < manaCost)
|
||||
break;
|
||||
|
||||
int love = ReflectionHelper.getPrivateValue(EntityAnimal.class, animal, LibObfuscation.IN_LOVE);
|
||||
int love = ReflectionUtils.getInt(IN_LOVE, animal);
|
||||
if(animal.getGrowingAge() == 0 && love <= 0) {
|
||||
for(EntityItem item : items) {
|
||||
if(item.age < (60 + slowdown) || item.isDead)
|
||||
@@ -56,7 +59,7 @@ public class SubTilePollidisiac extends SubTileFunctional {
|
||||
|
||||
mana -= manaCost;
|
||||
|
||||
ReflectionHelper.setPrivateValue(EntityAnimal.class, animal, 1200, LibObfuscation.IN_LOVE);
|
||||
ReflectionUtils.setInt(IN_LOVE, animal, 1200);
|
||||
animal.setTarget(null);
|
||||
supertile.getWorldObj().setEntityState(animal, (byte)18);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.subtile.functional;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -27,10 +28,14 @@ import vazkii.botania.api.subtile.RadiusDescriptor;
|
||||
import vazkii.botania.api.subtile.SubTileFunctional;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibObfuscation;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import vazkii.botania.utils.ReflectionUtils;
|
||||
|
||||
public class SubTileTigerseye extends SubTileFunctional {
|
||||
|
||||
private static final Field TIME_SINCE_IGNITED = ReflectionUtils.findField(EntityCreeper.class, LibObfuscation.TIME_SINCE_IGNITED);
|
||||
private static final Field TARGET_ENTITY_CLASS = ReflectionUtils.findField(EntityAIAvoidEntity.class, LibObfuscation.TARGET_ENTITY_CLASS);
|
||||
private static final Field TARGET_CLASS = ReflectionUtils.findField(EntityAINearestAttackableTarget.class, LibObfuscation.TARGET_CLASS);
|
||||
|
||||
private static final int RANGE = 10;
|
||||
private static final int RANGE_Y = 4;
|
||||
|
||||
@@ -58,7 +63,7 @@ public class SubTileTigerseye extends SubTileFunctional {
|
||||
}
|
||||
|
||||
if(entity instanceof EntityCreeper) {
|
||||
ReflectionHelper.setPrivateValue(EntityCreeper.class, (EntityCreeper) entity, 2, LibObfuscation.TIME_SINCE_IGNITED);
|
||||
ReflectionUtils.setInt(TIME_SINCE_IGNITED, entity, 2);
|
||||
entity.setAttackTarget(null);
|
||||
}
|
||||
|
||||
@@ -71,16 +76,16 @@ public class SubTileTigerseye extends SubTileFunctional {
|
||||
}
|
||||
|
||||
private boolean messWithRunAwayAI(EntityAIAvoidEntity aiEntry) {
|
||||
if(ReflectionHelper.getPrivateValue(EntityAIAvoidEntity.class, aiEntry, LibObfuscation.TARGET_ENTITY_CLASS) == EntityOcelot.class) {
|
||||
ReflectionHelper.setPrivateValue(EntityAIAvoidEntity.class, aiEntry, EntityPlayer.class, LibObfuscation.TARGET_ENTITY_CLASS);
|
||||
if(ReflectionUtils.getObject(TARGET_ENTITY_CLASS, aiEntry) == EntityOcelot.class) {
|
||||
ReflectionUtils.setObject(TARGET_ENTITY_CLASS, aiEntry, EntityPlayer.class);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void messWithGetTargetAI(EntityAINearestAttackableTarget aiEntry) {
|
||||
if(ReflectionHelper.getPrivateValue(EntityAINearestAttackableTarget.class, aiEntry, LibObfuscation.TARGET_CLASS) == EntityPlayer.class)
|
||||
ReflectionHelper.setPrivateValue(EntityAINearestAttackableTarget.class, aiEntry, EntityEnderCrystal.class, LibObfuscation.TARGET_CLASS); // Something random that won't be around
|
||||
if(ReflectionUtils.getObject(TARGET_CLASS, aiEntry) == EntityPlayer.class)
|
||||
ReflectionUtils.setObject(TARGET_CLASS, aiEntry, EntityEnderCrystal.class); // Something random that won't be around
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,6 +12,7 @@ package vazkii.botania.common.block.subtile.generating;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityTNTPrimed;
|
||||
@@ -89,6 +90,7 @@ public class SubTileEntropinnyum extends SubTileGenerating {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@Optional.Method(modid = "IC2")
|
||||
public void consumeExplosionIC2(ic2.api.event.ExplosionEvent event) {
|
||||
if(processExplosion(event.world, event.entity, event.x, event.y, event.z)) {
|
||||
event.setCanceled(true);
|
||||
@@ -99,6 +101,7 @@ public class SubTileEntropinnyum extends SubTileGenerating {
|
||||
if (world.isRemote || mana != 0 || !(Math.abs(supertile.xCoord - posX) <= RANGE && Math.abs(supertile.yCoord - posY) <= RANGE && Math.abs(supertile.zCoord - posZ) <= RANGE)) {
|
||||
return false;
|
||||
}
|
||||
if (explosionSource == null) return false;
|
||||
|
||||
explosionSource.setDead();
|
||||
mana += getMaxMana();
|
||||
|
||||
@@ -167,7 +167,8 @@ public class TileAlfPortal extends TileMod {
|
||||
} else closeNow = false;
|
||||
|
||||
if(closeNow) {
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 1 | 2);
|
||||
if(!worldObj.isRemote)
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 1 | 2);
|
||||
for(int i = 0; i < 36; i++)
|
||||
blockParticle(meta);
|
||||
closeNow = false;
|
||||
@@ -175,7 +176,8 @@ public class TileAlfPortal extends TileMod {
|
||||
if(newMeta == 0)
|
||||
for(int i = 0; i < 36; i++)
|
||||
blockParticle(meta);
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, newMeta, 1 | 2);
|
||||
if(!worldObj.isRemote)
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, newMeta, 1 | 2);
|
||||
} else if(explode) {
|
||||
worldObj.createExplosion(null, xCoord + .5, yCoord + 2.0, zCoord + .5, 3f, true);
|
||||
explode = false;
|
||||
|
||||
@@ -22,8 +22,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.brew.BrewUtilities;
|
||||
import vazkii.botania.api.brew.IBrewContainer;
|
||||
import vazkii.botania.api.brew.IBrewItem;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.api.mana.IManaReceiver;
|
||||
import vazkii.botania.api.recipe.RecipeBrew;
|
||||
@@ -42,7 +42,7 @@ public class TileBrewery extends TileSimpleInventory implements ISidedInventory,
|
||||
public int signal = 0;
|
||||
|
||||
public boolean addItem(EntityPlayer player, ItemStack stack) {
|
||||
if(recipe != null || stack == null || stack.getItem() instanceof IBrewItem && ((IBrewItem) stack.getItem()).getBrew(stack) != null && ((IBrewItem) stack.getItem()).getBrew(stack) != BotaniaAPI.fallbackBrew || getStackInSlot(0) == null != stack.getItem() instanceof IBrewContainer)
|
||||
if (recipe != null || stack == null || BrewUtilities.isFilledBrew(stack) || (getStackInSlot(0) == null) != (stack.getItem() instanceof IBrewContainer))
|
||||
return false;
|
||||
|
||||
boolean did = false;
|
||||
@@ -153,10 +153,9 @@ public class TileBrewery extends TileSimpleInventory implements ISidedInventory,
|
||||
|
||||
public int getManaCost() {
|
||||
ItemStack stack = getStackInSlot(0);
|
||||
if(recipe == null || stack == null || !(stack.getItem() instanceof IBrewContainer))
|
||||
if(recipe == null || stack == null || !(stack.getItem() instanceof IBrewContainer container))
|
||||
return 0;
|
||||
IBrewContainer container = (IBrewContainer) stack.getItem();
|
||||
return container.getManaCost(recipe.getBrew(), stack);
|
||||
return container.getManaCost(recipe.getBrew(), stack);
|
||||
}
|
||||
|
||||
public void craftingFanciness() {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.tile;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -24,12 +25,19 @@ import net.minecraft.util.WeightedRandom;
|
||||
import vazkii.botania.api.mana.IManaReceiver;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.lib.LibObfuscation;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import vazkii.botania.utils.ReflectionUtils;
|
||||
|
||||
public class TileSpawnerClaw extends TileMod implements IManaReceiver {
|
||||
|
||||
private static final String TAG_MANA = "mana";
|
||||
|
||||
private static final Field SPAWN_COUNT = ReflectionUtils.findField(MobSpawnerBaseLogic.class, LibObfuscation.SPAWN_COUNT);
|
||||
private static final Field SPAWN_RANGE = ReflectionUtils.findField(MobSpawnerBaseLogic.class, LibObfuscation.SPAWN_RANGE);
|
||||
private static final Field MAX_NEARBY_ENTITIES = ReflectionUtils.findField(MobSpawnerBaseLogic.class, LibObfuscation.MAX_NEARBY_ENTITIES);
|
||||
private static final Field MAX_SPAWN_DELAY = ReflectionUtils.findField(MobSpawnerBaseLogic.class, LibObfuscation.MAX_SPAWN_DELAY);
|
||||
private static final Field MIN_SPAWN_DELAY = ReflectionUtils.findField(MobSpawnerBaseLogic.class, LibObfuscation.MIN_SPAWN_DELAY);
|
||||
private static final Field POTENTIAL_ENTITY_SPAWNS = ReflectionUtils.findField(MobSpawnerBaseLogic.class, LibObfuscation.POTENTIAL_ENTITY_SPAWNS);
|
||||
|
||||
int mana = 0;
|
||||
|
||||
@Override
|
||||
@@ -61,9 +69,9 @@ public class TileSpawnerClaw extends TileMod implements IManaReceiver {
|
||||
|
||||
boolean flag = false;
|
||||
|
||||
int spawnCount = ReflectionHelper.getPrivateValue(MobSpawnerBaseLogic.class, logic, LibObfuscation.SPAWN_COUNT);
|
||||
int spawnRange = ReflectionHelper.getPrivateValue(MobSpawnerBaseLogic.class, logic, LibObfuscation.SPAWN_RANGE);
|
||||
int maxNearbyEntities = ReflectionHelper.getPrivateValue(MobSpawnerBaseLogic.class, logic, LibObfuscation.MAX_NEARBY_ENTITIES);
|
||||
int spawnCount = ReflectionUtils.getInt(SPAWN_COUNT, logic);
|
||||
int spawnRange = ReflectionUtils.getInt(SPAWN_RANGE, logic);
|
||||
int maxNearbyEntities = ReflectionUtils.getInt(MAX_NEARBY_ENTITIES, logic);
|
||||
|
||||
for(int i = 0; i < spawnCount; ++i) {
|
||||
Entity entity = EntityList.createEntityByName(logic.getEntityNameToSpawn(), logic.getSpawnerWorld());
|
||||
@@ -103,9 +111,9 @@ public class TileSpawnerClaw extends TileMod implements IManaReceiver {
|
||||
}
|
||||
|
||||
private void resetTimer(MobSpawnerBaseLogic logic) {
|
||||
int maxSpawnDelay = ReflectionHelper.getPrivateValue(MobSpawnerBaseLogic.class, logic, LibObfuscation.MAX_SPAWN_DELAY);
|
||||
int minSpawnDelay = ReflectionHelper.getPrivateValue(MobSpawnerBaseLogic.class, logic, LibObfuscation.MIN_SPAWN_DELAY);
|
||||
List<MobSpawnerBaseLogic.WeightedRandomMinecart> potentialEntitySpawns = ReflectionHelper.getPrivateValue(MobSpawnerBaseLogic.class, logic, LibObfuscation.POTENTIAL_ENTITY_SPAWNS);
|
||||
int maxSpawnDelay = ReflectionUtils.getInt(MAX_SPAWN_DELAY, logic);
|
||||
int minSpawnDelay = ReflectionUtils.getInt(MIN_SPAWN_DELAY, logic);
|
||||
List<MobSpawnerBaseLogic.WeightedRandomMinecart> potentialEntitySpawns = (List<MobSpawnerBaseLogic.WeightedRandomMinecart>) ReflectionUtils.getObject(POTENTIAL_ENTITY_SPAWNS, logic);
|
||||
|
||||
if(maxSpawnDelay <= minSpawnDelay)
|
||||
logic.spawnDelay = minSpawnDelay;
|
||||
|
||||
@@ -285,6 +285,13 @@ public class TileCorporeaIndex extends TileCorporeaBase implements ICorporeaRequ
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasNearbyIndexes(EntityPlayer player) {
|
||||
for(TileCorporeaIndex index : indexes)
|
||||
if(isInRangeOfIndex(player, index) && index.worldObj.isRemote == player.worldObj.isRemote)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static List<TileCorporeaIndex> getNearbyIndexes(EntityPlayer player) {
|
||||
List<TileCorporeaIndex> indexList = new ArrayList<>();
|
||||
for(TileCorporeaIndex index : indexes)
|
||||
@@ -296,7 +303,7 @@ public class TileCorporeaIndex extends TileCorporeaBase implements ICorporeaRequ
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldAutoComplete() {
|
||||
return !getNearbyIndexes(Minecraft.getMinecraft().thePlayer).isEmpty();
|
||||
return hasNearbyIndexes(Minecraft.getMinecraft().thePlayer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
|
||||
long least = compound.getLong(TAG_UUID_LEAST);
|
||||
UUID identity = getIdentifierUnsafe();
|
||||
if(identity == null || most != identity.getMostSignificantBits() || least != identity.getLeastSignificantBits())
|
||||
identity = new UUID(most, least);
|
||||
this.identity = new UUID(most, least);
|
||||
} else getIdentifier();
|
||||
|
||||
mana = compound.getInteger(TAG_MANA);
|
||||
@@ -464,8 +464,6 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
|
||||
}
|
||||
|
||||
public EntityManaBurst getBurst(boolean fake) {
|
||||
EntityManaBurst burst = new EntityManaBurst(this, fake);
|
||||
|
||||
boolean dreamwood = isDreamwood();
|
||||
boolean ultra = isULTRA_SPREADER();
|
||||
int maxMana = ultra ? 640 : dreamwood ? 240 : 160;
|
||||
@@ -480,29 +478,31 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
|
||||
if(lens != null && lens.getItem() instanceof ILensEffect)
|
||||
((ILensEffect) lens.getItem()).apply(lens, props);
|
||||
|
||||
burst.setSourceLens(lens);
|
||||
if(getCurrentMana() >= props.maxMana || fake) {
|
||||
if(mapmakerOverride) {
|
||||
burst.setColor(mmForcedColor);
|
||||
burst.setMana(mmForcedManaPayload);
|
||||
burst.setStartingMana(mmForcedManaPayload);
|
||||
burst.setMinManaLoss(mmForcedTicksBeforeManaLoss);
|
||||
burst.setManaLossPerTick(mmForcedManaLossPerTick);
|
||||
burst.setGravity(mmForcedGravity);
|
||||
burst.setMotion(burst.motionX * mmForcedVelocityMultiplier, burst.motionY * mmForcedVelocityMultiplier, burst.motionZ * mmForcedVelocityMultiplier);
|
||||
} else {
|
||||
burst.setColor(props.color);
|
||||
burst.setMana(props.maxMana);
|
||||
burst.setStartingMana(props.maxMana);
|
||||
burst.setMinManaLoss(props.ticksBeforeManaLoss);
|
||||
burst.setManaLossPerTick(props.manaLossPerTick);
|
||||
burst.setGravity(props.gravity);
|
||||
burst.setMotion(burst.motionX * props.motionModifier, burst.motionY * props.motionModifier, burst.motionZ * props.motionModifier);
|
||||
}
|
||||
if(getCurrentMana() < props.maxMana && !fake)
|
||||
return null;
|
||||
|
||||
return burst;
|
||||
// Construct the entity only after the mana check, every new Entity takes a global entity ID
|
||||
EntityManaBurst burst = new EntityManaBurst(this, fake);
|
||||
burst.setSourceLens(lens);
|
||||
if(mapmakerOverride) {
|
||||
burst.setColor(mmForcedColor);
|
||||
burst.setMana(mmForcedManaPayload);
|
||||
burst.setStartingMana(mmForcedManaPayload);
|
||||
burst.setMinManaLoss(mmForcedTicksBeforeManaLoss);
|
||||
burst.setManaLossPerTick(mmForcedManaLossPerTick);
|
||||
burst.setGravity(mmForcedGravity);
|
||||
burst.setMotion(burst.motionX * mmForcedVelocityMultiplier, burst.motionY * mmForcedVelocityMultiplier, burst.motionZ * mmForcedVelocityMultiplier);
|
||||
} else {
|
||||
burst.setColor(props.color);
|
||||
burst.setMana(props.maxMana);
|
||||
burst.setStartingMana(props.maxMana);
|
||||
burst.setMinManaLoss(props.ticksBeforeManaLoss);
|
||||
burst.setManaLossPerTick(props.manaLossPerTick);
|
||||
burst.setGravity(props.gravity);
|
||||
burst.setMotion(burst.motionX * props.motionModifier, burst.motionY * props.motionModifier, burst.motionZ * props.motionModifier);
|
||||
}
|
||||
return null;
|
||||
|
||||
return burst;
|
||||
}
|
||||
|
||||
public ILensControl getLensController(ItemStack stack) {
|
||||
|
||||
@@ -22,7 +22,6 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
public final class ItemNBTHelper {
|
||||
|
||||
@@ -221,6 +220,7 @@ public final class ItemNBTHelper {
|
||||
* NBT-friendly version of {@link codechicken.nei.recipe.TemplateRecipeHandler.CachedRecipe#contains(Collection, ItemStack)}
|
||||
*/
|
||||
public static boolean cachedRecipeContainsWithNBT(Collection<PositionedStack> ingredients, ItemStack ingredient) {
|
||||
if (ingredients == null) return false;
|
||||
for (PositionedStack stack : ingredients)
|
||||
if (positionedStackContainsWithNBT(stack, ingredient))
|
||||
return true;
|
||||
@@ -232,6 +232,7 @@ public final class ItemNBTHelper {
|
||||
* NBT-friendly version of {@link codechicken.nei.PositionedStack#contains(ItemStack)}
|
||||
*/
|
||||
public static boolean positionedStackContainsWithNBT(PositionedStack stack, ItemStack ingredient) {
|
||||
if (stack == null) return false;
|
||||
for(ItemStack item : stack.items)
|
||||
if(areStacksSameTypeCraftingWithNBT(item, ingredient))
|
||||
return true;
|
||||
|
||||
@@ -10,14 +10,24 @@
|
||||
*/
|
||||
package vazkii.botania.common.core.helper;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.common.lib.LibObfuscation;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import vazkii.botania.utils.ReflectionUtils;
|
||||
|
||||
public class ObfuscationHelper {
|
||||
|
||||
private static Field particleTextureField;
|
||||
private static boolean particleTextureResolved = false;
|
||||
|
||||
public static ResourceLocation getParticleTexture() {
|
||||
return ReflectionHelper.getPrivateValue(EffectRenderer.class, null, LibObfuscation.PARTICLE_TEXTURES);
|
||||
if(!particleTextureResolved) {
|
||||
particleTextureField = ReflectionUtils.findField(EffectRenderer.class, LibObfuscation.PARTICLE_TEXTURES);
|
||||
particleTextureResolved = true;
|
||||
}
|
||||
|
||||
return (ResourceLocation) ReflectionUtils.getObject(particleTextureField, null);
|
||||
}
|
||||
}
|
||||
@@ -256,6 +256,13 @@ public class CommonProxy {
|
||||
((EntityPlayerMP) entity).theItemInWorldManager.setBlockReachDistance(Math.max(5, ((EntityPlayerMP) entity).theItemInWorldManager.getBlockReachDistance() + reach));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets (instead of adds to) the extra reach of the client player. No-op on the server.
|
||||
*/
|
||||
public void setClientExtraReach(EntityLivingBase entity, float reach) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
public boolean openWikiPage(World world, Block block, MovingObjectPosition pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.common.entity;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -74,12 +75,14 @@ import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.relic.ItemRelic;
|
||||
import vazkii.botania.common.lib.LibObfuscation;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import vazkii.botania.utils.ReflectionUtils;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWithShader {
|
||||
|
||||
private static final Field IS_BAD_EFFECT = ReflectionUtils.findField(Potion.class, LibObfuscation.IS_BAD_EFFECT);
|
||||
|
||||
public static final int SPAWN_TICKS = 160;
|
||||
private static final float RANGE = 12F;
|
||||
private static final float MAX_HP = 800F;
|
||||
@@ -587,7 +590,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
List<PotionEffect> remove = new ArrayList<>();
|
||||
Collection<PotionEffect> active = player.getActivePotionEffects();
|
||||
for(PotionEffect effect : active)
|
||||
if(effect.getDuration() < 200 && effect.getIsAmbient() && !ReflectionHelper.<Boolean, Potion>getPrivateValue(Potion.class, Potion.potionTypes[effect.getPotionID()], LibObfuscation.IS_BAD_EFFECT))
|
||||
if(effect.getDuration() < 200 && effect.getIsAmbient() && !ReflectionUtils.getBoolean(IS_BAD_EFFECT, Potion.potionTypes[effect.getPotionID()], true))
|
||||
remove.add(effect);
|
||||
|
||||
active.removeAll(remove);
|
||||
@@ -866,6 +869,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
private static Rectangle barRect;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static Rectangle hpBarRect;
|
||||
private static ItemStack skullStack;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -891,11 +895,12 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
int py = y + 12;
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
ItemStack stack = new ItemStack(Items.skull, 1, 3);
|
||||
if(skullStack == null)
|
||||
skullStack = new ItemStack(Items.skull, 1, 3);
|
||||
mc.renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, stack, px, py);
|
||||
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, skullStack, px, py);
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
|
||||
boolean unicode = mc.fontRenderer.getUnicodeFlag();
|
||||
|
||||
@@ -21,14 +21,16 @@ import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemBlockModSlab extends ItemSlab {
|
||||
private final String unlocalizedName;
|
||||
|
||||
public ItemBlockModSlab(Block blockSlab) {
|
||||
super(blockSlab, ((BlockModSlab)blockSlab).getSingleBlock(), ((BlockModSlab)blockSlab).getFullBlock(), false);
|
||||
unlocalizedName = blockSlab.getUnlocalizedName().replace("tile.", "tile.botania:");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return field_150939_a.getUnlocalizedName().replaceAll("tile.", "tile.botania:");
|
||||
return unlocalizedName;
|
||||
}
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> infoList, boolean advanced) {
|
||||
|
||||
@@ -10,14 +10,13 @@
|
||||
*/
|
||||
package vazkii.botania.common.item.equipment.bauble;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HexFormat;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
@@ -121,44 +120,44 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
|
||||
infoList.add(StatCollector.translateToLocal("botania.wings" + stack.getItemDamage()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The original solution for "16E1BDFD1D6AE1A954C9C5E1B2D9099780F3E1724541F1F2F77310B769CFFBAC" has been lost
|
||||
* to time. It's supposed to be a 19 character long Matrix reference, but hash() is broken and gives
|
||||
* inconsistent output, so it probably wouldn't even be recognized if you got it right. It was later
|
||||
* replaced with the name of an Aqours single, but the name is too long for anvils in 1.7.10.
|
||||
* It has been fixed to be consistent (and considerably simplified since doing weird random obfuscation before
|
||||
* hashing is pointless at best), but it required replacing it with my own solution.
|
||||
* If you have the original solution, I will gladly replace this one with it.
|
||||
* Here are a few hints:
|
||||
* It's the title of a song that aligns with Vazkii's interests.
|
||||
* For authenticity, this song was released before this secret was originally added (2015).
|
||||
* This song has a special segment only present in one of the single-member versions.
|
||||
* -koolkrafter5
|
||||
*/
|
||||
@Override
|
||||
public void onEquipped(ItemStack stack, EntityLivingBase player) {
|
||||
super.onEquipped(stack, player);
|
||||
if(stack.getItemDamage() != WING_TYPES && hash(stack.getDisplayName()).equals("16E1BDFD1D6AE1A954C9C5E1B2D9099780F3E1724541F1F2F77310B769CFFBAC")) {
|
||||
if (stack.getItemDamage() != WING_TYPES &&
|
||||
hash(stack.getDisplayName()).equals("04E789FA6BC538F7645606141A1CFECECF4E84C301CB892779E761FD3FFF6386")) {
|
||||
stack.setItemDamage(WING_TYPES);
|
||||
stack.getTagCompound().removeTag("display");
|
||||
}
|
||||
}
|
||||
|
||||
String hash(String str) {
|
||||
if(str != null)
|
||||
try {
|
||||
MessageDigest md = MessageDigest.getInstance("SHA-256");
|
||||
return new HexBinaryAdapter().marshal(md.digest(salt(str).getBytes()));
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
try {
|
||||
MessageDigest md = MessageDigest.getInstance("SHA-256");
|
||||
byte[] digest = md.digest(salt(str).getBytes(StandardCharsets.UTF_8));
|
||||
return HexFormat.of().withUpperCase().formatHex(digest);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// Might as well be called sugar given it's not secure at all :D
|
||||
String salt(String str) {
|
||||
str = str += "wowsuchsaltmuchsecurityverywow";
|
||||
SecureRandom rand = new SecureRandom(str.getBytes());
|
||||
int l = str.length();
|
||||
int steps = rand.nextInt(l);
|
||||
char[] chrs = str.toCharArray();
|
||||
for(int i = 0; i < steps; i++) {
|
||||
int indA = rand.nextInt(l);
|
||||
int indB;
|
||||
do {
|
||||
indB = rand.nextInt(l);
|
||||
} while(indB == indA);
|
||||
char c = (char) (chrs[indA] ^ chrs[indB]);
|
||||
chrs[indA] = c;
|
||||
}
|
||||
|
||||
return String.copyValueOf(chrs);
|
||||
return str + "wowsuchsaltmuchsecurityverywow";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,10 +36,9 @@ public class ItemMiningRing extends ItemBauble implements IManaUsingItem {
|
||||
if(!hasMana)
|
||||
onUnequipped(stack, player);
|
||||
else {
|
||||
if(player.getActivePotionEffect(Potion.digSpeed) != null)
|
||||
player.removePotionEffect(Potion.digSpeed.id);
|
||||
|
||||
player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, Integer.MAX_VALUE, 1, true));
|
||||
PotionEffect currentEffect = player.getActivePotionEffect(Potion.digSpeed);
|
||||
if(currentEffect == null || currentEffect.getAmplifier() < 1)
|
||||
player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, Integer.MAX_VALUE, 1, true));
|
||||
}
|
||||
|
||||
if(player.swingProgress == 0.25F)
|
||||
|
||||
@@ -33,6 +33,7 @@ import vazkii.botania.api.item.ICosmeticAttachable;
|
||||
import vazkii.botania.api.item.ICosmeticBauble;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.common.container.InventoryBaubles;
|
||||
import baubles.common.lib.PlayerHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -104,8 +105,12 @@ public class ItemMonocle extends ItemBauble implements IBurstViewerBauble, ICosm
|
||||
}
|
||||
|
||||
public static boolean hasMonocle(EntityPlayer player) {
|
||||
return hasMonocle(PlayerHandler.getPlayerBaubles(player));
|
||||
}
|
||||
|
||||
public static boolean hasMonocle(InventoryBaubles inv) {
|
||||
for(int i = 0; i < 4; i++) {
|
||||
ItemStack stack = PlayerHandler.getPlayerBaubles(player).getStackInSlot(i);
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if(stack != null) {
|
||||
Item item = stack.getItem();
|
||||
if(item instanceof IBurstViewerBauble)
|
||||
|
||||
@@ -11,10 +11,13 @@
|
||||
package vazkii.botania.common.item.equipment.bauble;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.BaublesApi;
|
||||
|
||||
public class ItemReachRing extends ItemBauble {
|
||||
|
||||
@@ -27,6 +30,29 @@ public class ItemReachRing extends ItemBauble {
|
||||
Botania.proxy.setExtraReach(player, 3.5F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerLoad(ItemStack stack, EntityLivingBase player) {
|
||||
if(player.worldObj.isRemote) {
|
||||
// Baubles resends all baubles to the client on login and on every dimension change and calls this for each
|
||||
// of them, but the client keeps its reach extension across dimension changes. Set it instead of adding to it.
|
||||
Botania.proxy.setClientExtraReach(player, 3.5F * countWornRings(player));
|
||||
} else super.onPlayerLoad(stack, player);
|
||||
}
|
||||
|
||||
private static int countWornRings(EntityLivingBase player) {
|
||||
if(!(player instanceof EntityPlayer))
|
||||
return 0;
|
||||
|
||||
int count = 0;
|
||||
IInventory baubles = BaublesApi.getBaubles((EntityPlayer) player);
|
||||
for(int i = 0; i < baubles.getSizeInventory(); i++) {
|
||||
ItemStack bauble = baubles.getStackInSlot(i);
|
||||
if(bauble != null && bauble.getItem() instanceof ItemReachRing)
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnequipped(ItemStack stack, EntityLivingBase player) {
|
||||
Botania.proxy.setExtraReach(player, -3.5F);
|
||||
|
||||
@@ -29,7 +29,6 @@ import net.minecraft.world.World;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.equipment.tool.elementium.ItemElementiumPick;
|
||||
import vazkii.botania.common.item.equipment.tool.terrasteel.ItemTerraPick;
|
||||
|
||||
@@ -137,8 +136,8 @@ public final class ToolCommons {
|
||||
materialLevel = 20;
|
||||
|
||||
int modifier = 0;
|
||||
if(item == ModItems.terraPick)
|
||||
modifier = ItemTerraPick.getLevel(stack);
|
||||
if(item instanceof ItemTerraPick pick)
|
||||
modifier = pick.getLevel(stack);
|
||||
|
||||
int efficiency = EnchantmentHelper.getEnchantmentLevel(Enchantment.efficiency.effectId, stack);
|
||||
return materialLevel * 100 + modifier * 10 + efficiency;
|
||||
|
||||
@@ -34,6 +34,7 @@ import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.item.ISequentialBreaker;
|
||||
import vazkii.botania.api.mana.IManaGivingItem;
|
||||
import vazkii.botania.api.mana.IManaItem;
|
||||
import vazkii.botania.api.mana.ITieredManaTooltipDisplay;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.achievement.ModAchievements;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
@@ -49,7 +50,9 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemTerraPick extends ItemManasteelPick implements IManaItem, ISequentialBreaker {
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class ItemTerraPick extends ItemManasteelPick implements IManaItem, ISequentialBreaker, ITieredManaTooltipDisplay {
|
||||
|
||||
private static final String TAG_ENABLED = "enabled";
|
||||
private static final String TAG_MANA = "mana";
|
||||
@@ -242,15 +245,11 @@ public class ItemTerraPick extends ItemManasteelPick implements IManaItem, ISequ
|
||||
|
||||
@Override
|
||||
public int getMana(ItemStack stack) {
|
||||
return getMana_(stack);
|
||||
}
|
||||
|
||||
public static int getMana_(ItemStack stack) {
|
||||
return ItemNBTHelper.getInt(stack, TAG_MANA, 0);
|
||||
}
|
||||
|
||||
public static int getLevel(ItemStack stack) {
|
||||
int mana = getMana_(stack);
|
||||
public int getLevel(ItemStack stack) {
|
||||
int mana = getMana(stack);
|
||||
for(int i = LEVELS.length - 1; i > 0; i--)
|
||||
if(mana >= LEVELS[i])
|
||||
return i;
|
||||
@@ -303,4 +302,45 @@ public class ItemTerraPick extends ItemManasteelPick implements IManaItem, ISequ
|
||||
return isTipped(stack);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getLeftManaLabel(@Nonnull ItemStack stack) {
|
||||
int level = getLevel(stack);
|
||||
return StatCollector.translateToLocal("botania.rank" + level);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getRightManaLabel(@Nonnull ItemStack stack) {
|
||||
int level = getLevel(stack);
|
||||
return (level + 1 == LEVELS.length) ? "" : StatCollector.translateToLocal("botania.rank" + (level + 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isRainbowEffect(@Nonnull ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getManaFractionForDisplay(ItemStack stack) {
|
||||
int level = getLevel(stack);
|
||||
if (level + 1 >= LEVELS.length) return 1;
|
||||
|
||||
int min = LEVELS[level];
|
||||
int max = LEVELS[level + 1];
|
||||
int mana = getMana(stack);
|
||||
float fraction = mana - min;
|
||||
float total = max - min;
|
||||
return fraction / total;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public int[] getManaTiers(@Nonnull ItemStack stack) {
|
||||
return LEVELS;
|
||||
}
|
||||
}
|
||||
@@ -19,12 +19,13 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.brew.Brew;
|
||||
import vazkii.botania.api.internal.IGuiLexiconEntry;
|
||||
import vazkii.botania.api.lexicon.ILexicon;
|
||||
import vazkii.botania.api.lexicon.ITwoNamedPage;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
|
||||
import vazkii.botania.api.recipe.RecipeBrew;
|
||||
import vazkii.botania.client.core.helper.BrewHelper;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -51,50 +52,48 @@ public class PageBrew extends PageRecipe implements ITwoNamedPage {
|
||||
FontRenderer renderer = Minecraft.getMinecraft().fontRenderer;
|
||||
boolean unicode = renderer.getUnicodeFlag();
|
||||
renderer.setUnicodeFlag(true);
|
||||
String s = EnumChatFormatting.BOLD + String.format(StatCollector.translateToLocal("botaniamisc.brewOf"), StatCollector.translateToLocal(brew.getUnlocalizedName()));
|
||||
String s = EnumChatFormatting.BOLD + StatCollector.translateToLocalFormatted("botaniamisc.brewOf", StatCollector.translateToLocal(brew.getUnlocalizedName()));
|
||||
renderer.drawString(s, gui.getLeft() + gui.getWidth() / 2 - renderer.getStringWidth(s) / 2, y, 0x222222);
|
||||
renderer.setUnicodeFlag(unicode);
|
||||
PageText.renderText(x, y + 22, width, height, text);
|
||||
|
||||
ItemStack book = Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem();
|
||||
if(book != null && book.getItem() instanceof ILexicon && ((ILexicon) book.getItem()).isKnowledgeUnlocked(book, BotaniaAPI.elvenKnowledge)) {
|
||||
renderItemAtLinePos(gui, 20, 2, y + 12, recipe.getOutput(new ItemStack(ModItems.vial)));
|
||||
renderItemAtLinePos(gui, 20, 3, y + 12, recipe.getOutput(new ItemStack(ModItems.vial, 1, 1)));
|
||||
} else renderItemAtLinePos(gui, 0, -1, y + 12, recipe.getOutput(new ItemStack(ModItems.vial)));
|
||||
renderItemRow(gui, getOutputs(book), y + 12);
|
||||
|
||||
int i = 0;
|
||||
y = gui.getTop() + gui.getHeight() - 54;
|
||||
y = gui.getTop() + gui.getHeight() - 54;
|
||||
List<Object> inputs = new ArrayList<>(recipe.getInputs());
|
||||
|
||||
int offset = gui.getWidth() / 2 - inputs.size() * 9;
|
||||
for(Object input : inputs) {
|
||||
if(input instanceof String)
|
||||
input = OreDictionary.getOres((String) input).get(0);
|
||||
renderItemRow(gui, inputs, y);
|
||||
|
||||
renderItemAtLinePos(gui, offset, i, y, (ItemStack) input);
|
||||
i++;
|
||||
}
|
||||
|
||||
super.renderRecipe(gui, mx, my);
|
||||
super.renderRecipe(gui, mx, my);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderItemAtLinePos(IGuiLexiconEntry gui, int offset, int pos, int yPos, ItemStack stack) {
|
||||
if(stack == null || stack.getItem() == null)
|
||||
return;
|
||||
stack = stack.copy();
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void renderItemRow(IGuiLexiconEntry gui, List<?> inputs, int y) {
|
||||
int spacing = Math.min(gui.getWidth() / inputs.size(), 18);
|
||||
int x = gui.getLeft() + (gui.getWidth() - spacing * inputs.size()) / 2;
|
||||
|
||||
if(stack.getItemDamage() == Short.MAX_VALUE)
|
||||
stack.setItemDamage(0);
|
||||
for (Object input : inputs) {
|
||||
ItemStack stack;
|
||||
if (input instanceof String) {
|
||||
stack = OreDictionary.getOres((String) input).get(0);
|
||||
} else {
|
||||
stack = (ItemStack) input;
|
||||
}
|
||||
|
||||
int xPos = gui.getLeft() + (pos == -1 ? gui.getWidth() / 2 - 8 : pos * 18) + offset;
|
||||
if (stack == null || stack.getItem() == null) continue;
|
||||
|
||||
ItemStack stack1 = stack.copy();
|
||||
if(stack1.getItemDamage() == -1)
|
||||
stack1.setItemDamage(0);
|
||||
if (stack.getItemDamage() == Short.MAX_VALUE || stack.getItemDamage() == -1) {
|
||||
ItemStack newStack = new ItemStack(stack.getItem(), stack.stackSize, 0);
|
||||
newStack.stackTagCompound = stack.stackTagCompound;
|
||||
stack = newStack;
|
||||
}
|
||||
|
||||
renderItem(gui, xPos, yPos, stack1, false);
|
||||
}
|
||||
renderItem(gui, x, y, stack, false);
|
||||
|
||||
x += spacing;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDisplayedRecipes() {
|
||||
@@ -105,6 +104,27 @@ public class PageBrew extends PageRecipe implements ITwoNamedPage {
|
||||
return list;
|
||||
}
|
||||
|
||||
private List<ItemStack> getOutputs(ItemStack lexicon) {
|
||||
ArrayList<ItemStack> list = new ArrayList<>();
|
||||
|
||||
for (ItemStack empty : BrewHelper.getBrewContainers()) {
|
||||
if (lexicon != null && lexicon.getItem() instanceof ILexicon lexItem) {
|
||||
// Check if the lexicon has this item unlocked.
|
||||
LexiconRecipeMappings.EntryData entry = LexiconRecipeMappings.getDataForStack(empty);
|
||||
if (entry != null && (!entry.entry.isVisible() || !lexItem.isKnowledgeUnlocked(lexicon, entry.entry.getKnowledgeType()))) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack filled = recipe.getOutput(empty);
|
||||
if (filled != null) {
|
||||
list.add(filled);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSecondUnlocalizedName(String name) {
|
||||
text = name;
|
||||
|
||||
@@ -13,6 +13,7 @@ package vazkii.botania.common.lexicon.page;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@@ -33,15 +34,18 @@ import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.common.core.helper.InventoryHelper;
|
||||
import vazkii.botania.utils.ReflectionUtils;
|
||||
|
||||
public class PageCraftingRecipe extends PageRecipe {
|
||||
|
||||
private static final ResourceLocation craftingOverlay = new ResourceLocation(LibResources.GUI_CRAFTING_OVERLAY);
|
||||
|
||||
private static final Field RECIPE_WIDTH = ReflectionUtils.findField(ShapedOreRecipe.class, 4);
|
||||
private static final Field RECIPE_HEIGHT = ReflectionUtils.findField(ShapedOreRecipe.class, 5);
|
||||
|
||||
List<IRecipe> recipes;
|
||||
int ticksElapsed = 0;
|
||||
int recipeAt = 0;
|
||||
@@ -134,8 +138,8 @@ public class PageCraftingRecipe extends PageRecipe {
|
||||
renderItemAtGridPos(gui, 1 + x, 1 + y, shaped.recipeItems[y * shaped.recipeWidth + x], true);
|
||||
} else if(recipe instanceof ShapedOreRecipe) {
|
||||
ShapedOreRecipe shaped = (ShapedOreRecipe) recipe;
|
||||
int width = (Integer) ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, shaped, 4);
|
||||
int height = (Integer) ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, shaped, 5);
|
||||
int width = ReflectionUtils.getInt(RECIPE_WIDTH, shaped);
|
||||
int height = ReflectionUtils.getInt(RECIPE_HEIGHT, shaped);
|
||||
|
||||
for(int y = 0; y < height; y++)
|
||||
for(int x = 0; x < width; x++) {
|
||||
|
||||
@@ -79,7 +79,7 @@ public class PageRecipe extends LexiconPage {
|
||||
int tooltipY = 8 + tooltipData.size() * 11;
|
||||
|
||||
if(tooltipEntry) {
|
||||
vazkii.botania.client.core.helper.RenderHelper.renderTooltipOrange(mx, my + tooltipY, Arrays.asList(EnumChatFormatting.GRAY + StatCollector.translateToLocal("botaniamisc.clickToRecipe")));
|
||||
vazkii.botania.client.core.helper.RenderHelper.renderTooltipOrange(mx, my + tooltipY, Arrays.asList(EnumChatFormatting.GRAY + StatCollector.translateToLocal("botaniamisc.clickToSeeRecipe")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ public class PageShedding extends PageEntity {
|
||||
int tooltipY = 8 + tooltipData.size() * 11;
|
||||
|
||||
if(tooltipEntry) {
|
||||
vazkii.botania.client.core.helper.RenderHelper.renderTooltipOrange(mx, my + tooltipY, Arrays.asList(EnumChatFormatting.GRAY + StatCollector.translateToLocal("botaniamisc.clickToRecipe")));
|
||||
vazkii.botania.client.core.helper.RenderHelper.renderTooltipOrange(mx, my + tooltipY, Arrays.asList(EnumChatFormatting.GRAY + StatCollector.translateToLocal("botaniamisc.clickToSeeRecipe")));
|
||||
tooltipY += 18;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,8 +47,12 @@ public class PageText extends LexiconPage {
|
||||
renderText(x, y, width, height, 10, unlocalizedText);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void renderText(int x, int y, int width, int height, int paragraphSize, String unlocalizedText) {
|
||||
renderText(x, y, width, height, paragraphSize, 0, unlocalizedText);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void renderText(int x, int y, int width, int height, int paragraphSize, int color, String unlocalizedText) {
|
||||
y += 10;
|
||||
width -= 4;
|
||||
|
||||
@@ -132,7 +136,7 @@ public class PageText extends LexiconPage {
|
||||
String tok = words.get(idx);
|
||||
int tw = font.getStringWidth(tok);
|
||||
|
||||
font.drawString(tok, xi, y, 0);
|
||||
font.drawString(tok, xi, y, color);
|
||||
xi += tw;
|
||||
|
||||
if (justify && gi < gapIds.size() && idx == gapIds.get(gi)) {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package vazkii.botania.common.lib;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.color.ColorResource;
|
||||
|
||||
|
||||
public class LibColorUtils {
|
||||
|
||||
private static final ColorResource.Factory color = new ColorResource.Factory("botania");
|
||||
|
||||
public static final ColorResource
|
||||
// spotless:off
|
||||
neiHandlerBotaniaLexicaTitle = color.rgb("neiHandlerBotaniaLexicaTitle", "0x404040"),
|
||||
neiHandlerBotaniaLexicaKnowledge = color.rgb("neiHandlerBotaniaLexicaKnowledge", "0x404040"),
|
||||
neiHandlerBotaniaLexicaTagline = color.rgb("neiHandlerBotaniaLexicaTagline", "0x404040"),
|
||||
neiHandlerBotaniaLexicaExtraInfo = color.rgb("neiHandlerBotaniaLexicaExtraInfo", "0x404040"),
|
||||
neiHandlerBotaniaLexicaExtraInfoDesc = color.rgb("neiHandlerBotaniaLexicaExtraInfoDesc", "0x404040");
|
||||
// spotless:on
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package vazkii.botania.utils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public final class ReflectionUtils {
|
||||
|
||||
private ReflectionUtils() {}
|
||||
|
||||
public static Field findField(Class<?> clazz, String... names) {
|
||||
for(String name : names) {
|
||||
try {
|
||||
Field field = clazz.getDeclaredField(name);
|
||||
field.setAccessible(true);
|
||||
return field;
|
||||
} catch(NoSuchFieldException e) {
|
||||
// Try the next candidate name
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Field findField(Class<?> clazz, int index) {
|
||||
try {
|
||||
Field field = clazz.getDeclaredFields()[index];
|
||||
field.setAccessible(true);
|
||||
return field;
|
||||
} catch(Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static int getInt(Field field, Object instance) {
|
||||
return getInt(field, instance, 0);
|
||||
}
|
||||
|
||||
public static int getInt(Field field, Object instance, int def) {
|
||||
try {
|
||||
return field.getInt(instance);
|
||||
} catch(Exception e) {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean getBoolean(Field field, Object instance) {
|
||||
return getBoolean(field, instance, false);
|
||||
}
|
||||
|
||||
public static boolean getBoolean(Field field, Object instance, boolean def) {
|
||||
try {
|
||||
return field.getBoolean(instance);
|
||||
} catch(Exception e) {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
||||
public static Object getObject(Field field, Object instance) {
|
||||
try {
|
||||
return field.get(instance);
|
||||
} catch(Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setInt(Field field, Object instance, int value) {
|
||||
try {
|
||||
field.setInt(instance, value);
|
||||
} catch(Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void setBoolean(Field field, Object instance, boolean value) {
|
||||
try {
|
||||
field.setBoolean(instance, value);
|
||||
} catch(Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void setObject(Field field, Object instance, Object value) {
|
||||
try {
|
||||
field.set(instance, value);
|
||||
} catch(Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,7 +10,7 @@ botaniamisc.statusUnknown=Unbekannter Status
|
||||
botaniamisc.color=%s gefärbt
|
||||
botaniamisc.manaUsage=Manaverbrauch
|
||||
botaniamisc.shiftToRead=Shift-rechtsklicke, um mehr zu lesen
|
||||
botaniamisc.clickToRecipe=Shift-klicke, um Rezept zu sehen
|
||||
botaniamisc.clickToSeeRecipe=Shift-klicke, um Rezept zu sehen
|
||||
botaniamisc.clickToIndex=Shift-klicke für Index
|
||||
botaniamisc.flareColor=Ladungen %s
|
||||
botaniamisc.outputtingPower=Gibt Energie an Items ab
|
||||
|
||||
@@ -18,7 +18,7 @@ botaniamisc.statusUnknown=Unknown Status
|
||||
botaniamisc.color=%s Tinted
|
||||
botaniamisc.manaUsage=Mana Usage
|
||||
botaniamisc.shiftToRead=Shift-right click to read more
|
||||
botaniamisc.clickToRecipe=Shift click to see recipe
|
||||
botaniamisc.clickToSeeRecipe=Shift click to see recipe
|
||||
botaniamisc.clickToIndex=Shift click for index
|
||||
botaniamisc.flareColor=%s Rounds
|
||||
botaniamisc.outputtingPower=Sparing Mana to Items
|
||||
@@ -50,7 +50,7 @@ botaniamisc.clickToSee=Click to read
|
||||
botaniamisc.shiftToRemove=Shift-click to remove
|
||||
botaniamisc.clickToAdd=Add Bookmark
|
||||
botaniamisc.ratio=%sx Zoom (hover to zoom out)
|
||||
botaniamisc.neiratio=Zoom (shift to zoom out)
|
||||
botaniamisc.neiratio=%s Zoom (shift to zoom out)
|
||||
botaniamisc.bottleTooltip=It has an acquired taste
|
||||
botaniamisc.coarseDirt0=Coarse Dirt, grass
|
||||
botaniamisc.coarseDirt1=won't grow on it
|
||||
@@ -184,6 +184,8 @@ botania.nei.pureDaisy=Pure Daisy
|
||||
botania.nei.lexica=Lexica Botania
|
||||
nei.options.keys.gui.botania_corporea_request=Corporea Request
|
||||
|
||||
botania.nei.anySeed=Any Seed
|
||||
|
||||
botania.nei.lexicaSeparator=Extra Info:
|
||||
botania.nei.lexicaNoInfo=(there's no Extra Info for this entry, sorry!)
|
||||
|
||||
@@ -417,7 +419,7 @@ botania.versioning.flavour43=That's impossible, a Botania Update doesn't break d
|
||||
botania.versioning.flavour44=Look at the update, now back at me, now back at the update. There's a download button there, moron.
|
||||
botania.versioning.flavour45=No, you can't have fries with your Botania Update.
|
||||
botania.versioning.flavour46=You were expecting Botania to be up to date, but it was me, Dio!
|
||||
botania.versioning.flavour47=Rumour says if you move the truck there's a Botania Update below it.
|
||||
botania.versioning.flavour47=Rumor says if you move the truck there's a Botania Update below it.
|
||||
botania.versioning.flavour48=I wonder when Bevo's updating his pack...
|
||||
botania.versioning.flavour49=1 Botania Update on the wall, 1 Botania Update on the wall.
|
||||
botania.versioning.flavour50=You notice Botania has updated. It fills you with determination.
|
||||
@@ -434,7 +436,7 @@ botania.versioning.flavour60=Botania Updates. They do what they must, because th
|
||||
botania.versioning.flavour61=Update me! Update me! Update me Seymore!
|
||||
botania.versioning.flavour62=Nine out of ten doctors recommend you update Botania.
|
||||
botania.versioning.flavour63=The update bacons at midnight.
|
||||
botania.versioning.flavour64=A new Botania Update is out. And it's name is JOHN CENA! DOO DOO DOO DOO
|
||||
botania.versioning.flavour64=A new Botania Update is out. And its name is JOHN CENA! DOO DOO DOO DOO
|
||||
botania.versioning.outdated=You are running Botania build %s, the latest is build %s.
|
||||
botania.versioning.updateMessage=["Click for... [",{"text":"Download","color":"green","hoverEvent":{"action":"show_text","value":{"text":"Click this to automatically download the latest version","color":"green"}},"clickEvent":{"action":"run_command","value":"/botania-download-latest %version%"}},"] [",{"text":"Website","color":"green","hoverEvent":{"action":"show_text","value":{"text":"Click this to go to the mod's website","color":"green"}},"clickEvent":{"action":"open_url","value":"http://botaniamod.net/downloads.php"}},"] [",{"text":"Changelog","color":"green","hoverEvent":{"action":"show_text","value":{"text":"Click this to go to the version's Changelog","color":"green"}},"clickEvent":{"action":"open_url","value":"http://botaniamod.net/changelog.php#%version%"}},"]"]
|
||||
botania.versioning.startingDownload=[{"text":"Starting download of %s. Please do not remove your hard disk. Enjoying ","color":"aqua"},{"text":"Botania","color":"green"},{"text":"? Consider supporting ","color":"aqua"},{"text":"Vazkii","color":"light_purple"},{"text":" on [","color":"aqua"},{"text":"Patreon","color":"gold","hoverEvent":{"action":"show_text","value":{"text":"Click this to go to Vazkii's Patreon","color":"light_purple"}},"clickEvent":{"action":"open_url","value":"http://www.patreon.com/Vazkii"}},{"text":"]!","color":"aqua"}]
|
||||
@@ -1717,6 +1719,9 @@ botania.potion.clear=Absolution
|
||||
botania.gui.lexicon.header=Lexica Botania, %s Edition Table of Contents
|
||||
botania.gui.lexicon.wip=(This entry is a Work In Progress. It's not even its final form)
|
||||
|
||||
botania.gui.flowerBag.title=Flower Pouch
|
||||
botania.gui.shroomBag.title=Mushroom Pouch
|
||||
|
||||
# MUSIC DISCS
|
||||
item.record.botania:gaia1.desc=Kain Vinosec - Endure Emptiness
|
||||
item.record.botania:gaia2.desc=Kain Vinosec - Fight For Quiescence
|
||||
@@ -2628,7 +2633,7 @@ botania.page.pool7=A total space biscuit
|
||||
# -- SPARKS
|
||||
botania.entry.sparks=Sparks
|
||||
botania.tagline.sparks=Simple and fast short-range Mana transporters
|
||||
botania.page.sparks0=&1Sparks&0 are interesting entities. Created from a combination of raw energy and &4Mana&0, they have the ability to be placed on top of a few specific &4Mana&0 containing or accepting blocks, mainly, &1Mana Pools&0.<br>Some blocks have the ability to harness &4Mana&0 from &1Sparks&0, but the uses for them seem limited to a few blocks right now.
|
||||
botania.page.sparks0=&1Sparks&0 are interesting entities. Created from a combination of raw energy and &4Mana&0, they have the ability to be placed on top of a few specific &4Mana&0 containing or accepting blocks, mainly &1Mana Pools&0.<br>Some blocks have the ability to harness &4Mana&0 from &1Sparks&0, but the uses for them seem limited to a few blocks right now.
|
||||
botania.page.sparks1=Placing a &1Spark&0 on top of a &1Mana Pool&0 and another on top of a block that can accept it will allow for the latter to remotely access the reservoirs of the &1Mana Pool&0 when needed, given it's not too far away.<br>To remove a &1Spark&0 simply shift-right click it with a &1Wand of the Forest&0. Regular right clicking shows which other &1Sparks&0 it can transfer to.
|
||||
botania.page.sparks3=In the case that one might think that &1Sparks&0 are too obstrusive in their looks, one can use &1Phantom Ink&0 to turn the target &1Spark&0 highly translucent. This does not consume the ink.
|
||||
botania.page.sparks2=&oholds up spork&r
|
||||
@@ -2669,7 +2674,7 @@ botania.page.lens1=The basic lens, it doesn't do anything.
|
||||
botania.page.lens2=&4Dyeing&0 lenses!
|
||||
botania.page.lens3=&1Rainbow Lens&0 all the way
|
||||
botania.page.lens4=But lenses are not only for fancy colors. One can upgrade them with all sorts of materials to create new lens which can do all sorts of effects on the &4Mana Bursts&0.<br>It's to take in mind that, if using a normal &1Mana Spreader&0, there needs to be a &4Mana&0 receiving block at the end for the burst to fire. A &1Pulse Mana Spreader&0 is recommended for some lenses.
|
||||
botania.page.lens5=Sometimes, though, having a single &1Mana Lens&0 in a spreader just isn't enough sometimes. By combining two lenses with a &1Slimeball&0 in a crafting table, it's possible to unite them into one, and keep the effects of both.<br>The first lens used determines the visuals (texture and color). It's to note that some combinations will not work, nor will two lenses of the same type.
|
||||
botania.page.lens5=Sometimes, though, having a single &1Mana Lens&0 in a spreader just isn't enough sometimes. By combining two lenses with a &1Slimeball&0 in a crafting table, it's possible to merge them into one, and keep the effects of both.<br>The first lens used determines the visuals (texture and color). It's to note that some combinations will not work, nor will two lenses of the same type.
|
||||
botania.page.lens6=The &1Velocity Lens&0 will drastically increase the speed at which a &4Mana Burst&0 travels, but not only does the beam start to lose its &4Mana&0 a lot faster, it can also carry a bit less.
|
||||
botania.page.lens7=Velocity Lens
|
||||
botania.page.lens8=The &1Potency Lens&0 will double the amount of &4Mana&0 a &4Mana Burst&0 can carry, however, the beam becomes slower and after it starts to lose mana it does so at a lot faster rate.
|
||||
@@ -2844,7 +2849,7 @@ botania.page.tigerseye1=&oRisin' up to the challenge of our rivals&r.
|
||||
# -- ORECHID
|
||||
botania.entry.orechid=Orechid
|
||||
botania.tagline.orechid=Creates ores from stone
|
||||
botania.page.orechid0=While going mining is all good, a renewable, sedentary, means of getting ore is due. The &1Orechid&0 will use &4Mana&0 to generate &4ores&0 in nearby &1Stone&0 blocks.<br>The ores it generates are random, but seem to be biased towards more common ores rather than rarer ones.
|
||||
botania.page.orechid0=While going mining is all good, a renewable, sedentary means of getting ore is due. The &1Orechid&0 will use &4Mana&0 to generate &4ores&0 in nearby &1Stone&0 blocks.<br>The ores it generates are random, but seem to be biased towards more common ores rather than rarer ones.
|
||||
botania.page.orechid1=&oNot dragon poop&r.
|
||||
|
||||
# -- ORECHID IGNEM
|
||||
@@ -3086,9 +3091,9 @@ botania.page.dandelifeon_w=Warning: This feature is experimental.<br>It may, and
|
||||
botania.page.dandelifeon0=The &1Dandelifeon&0 is a flower not recommended for those faint of heart.<br>While it's possibly the strongest available generating flower within the botanist's toolbelt, it's also one of the less straightforward to put to work.
|
||||
botania.page.dandelifeon1=This flower makes use of a cellular automata known as &4Conway's Game of Life&0. The area for this procedure is a 25x25 square centered around the &1Dandelifeon&0 itself.<br>While the flower has a redstone signal, twice every second it'll step the game once.
|
||||
botania.page.dandelifeon2=The game is executed with the concept of &4Cells&0. The 25x25 area can be seen as a grid of 25 by 25 cells<br>Cells may be live or dead, live if the block in that position is a &1Cellular Block&0 (read on) or dead if it's anything else. &4Neighbours&0 are the eight blocks in the same plane around any one cell.
|
||||
botania.page.dandelifeon3=Every step of the game, the following transitions might happen: &41)&0 Any live cell with fewer than two or more than three live neighbours dies. &42)&0 Any live cell with exactly two or three live neigbours lives on. &43)&0 Any dead cell with exactly three live neigbours becomes a live cell.
|
||||
botania.page.dandelifeon3=Every step of the game, the following transitions might happen: &41)&0 Any live cell with fewer than two or more than three live neighbours dies. &42)&0 Any live cell with exactly two or three live neighbors lives on. &43)&0 Any dead cell with exactly three live neighbors becomes a live cell.
|
||||
botania.page.dandelifeon4=All of the transitions happen at the same time.<br>Aside from those, a few additional rules not present in a typical simulation of &4Conway's Game of Life&0 are also present in the &1Dandelifeon&0 procedures, listed in the following pages.
|
||||
botania.page.dandelifeon5=All cells have an age, starting at zero. Whenever a cell lives on, by having two or three neighbours, its age inreases by one. Whenever a dead cell becomes a live cell, the age of the new live cell is equal to the age of the oldest neighbour, plus one. Any cells older than sixty generations will die during the next step.
|
||||
botania.page.dandelifeon5=All cells have an age, starting at zero. Whenever a cell lives on, by having two or three neighbours, its age increases by one. Whenever a dead cell becomes a live cell, the age of the new live cell is equal to the age of the oldest neighbour, plus one. Any cells older than sixty generations will die during the next step.
|
||||
botania.page.dandelifeon6=Second off, the 3x3 zone centered around the &1Dandelifeon&0 itself is not habitable by cells. Any live cells that would exist in that area are turned into &4Mana&0 instead. The older the cell that would be created, the more &4Mana&0 it makes. Age zero cells produce no &4Mana&0.
|
||||
botania.page.dandelifeon10=Whenever any live cells are absorbed by the 3x3 zone in the center, all other cells in the board die.<br>A few other restrictions apply to cells, such as having two different &1Dandelifeon&0 flowers affect the same cell will kill it. Lastly, any cell will die if moved by any other means than the &1Dandelifeon&0 itself.
|
||||
botania.page.dandelifeon7=&1Cellular Blocks&0 are crafted with &1Cactus&0, &1Carrots&0 and &1Potatoes&0, and are extremely fragile, they may not be picked once placed down or moved by &1Pistons&0 and may not be created (through having 3 live neighbours on a dead cell) on any block that isn't air.<br>If not within the range of a &1Dandelifeon&0 they work as normal building blocks.
|
||||
@@ -3231,7 +3236,7 @@ botania.page.forestEye2=Now you see me...
|
||||
# -- OPEN CRATE
|
||||
botania.entry.openCrate=Open Crate
|
||||
botania.tagline.openCrate=A simple device to drop things
|
||||
botania.page.openCrate0=Sometimes devices like &1Droppers&0 or &1Dispensers&0 aren't precise or fast enough. A simple solution is to make a crate and punch a hole in the bottom.<br>Yeah, it's that simple. The &1Open Crate&0 accepts items from &1Hoppers&0 or any other means of inserting items, and obviously, drops them directly below it.
|
||||
botania.page.openCrate0=Sometimes devices like &1Droppers&0 or &1Dispensers&0 aren't precise or fast enough. A simple solution is to make a crate and punch a hole in the bottom.<br>Yeah, it's that simple. The &1Open Crate&0 accepts items from &1Hoppers&0 or any other means of inserting items, and obviously drops them directly below it.
|
||||
botania.page.openCrate1=Depending on the situation, items can be inserted into the open crate with a &1Hopper&0, &1Hopperhock&0 or &1Dropper&0.<br>A little interesting effect the &1Open Crate&0 can do is that, when given a redstone signal, any items it drops are prevented from being caught by flowers like the &1Hopperhock&0, &1Rannuncarpus&0 or &1Pollidisiac&0 for around ten seconds more than usual.
|
||||
botania.page.openCrate2=A super crate box
|
||||
|
||||
@@ -3644,7 +3649,7 @@ botania.page.slimeBottle1=JUMPYDOLL
|
||||
botania.entry.exchangeRod=Rod of the Shifting Crust
|
||||
botania.tagline.exchangeRod=A rod to change blocks
|
||||
botania.page.exchangeRod0=&1Rod of the Shifting Crust&0 is a magical device with the ability to swap blocks in the world at very fast speeds. In order to achieve this, one must first select a block to swap with, this is done by shift-right clicking that block in the world.<br>After this block is selected, left clicking any other block in the world will swap it for that block, assuming it's present in the user's inventory.
|
||||
botania.page.exchangeRod1=Right clicking on a block in the world will start a larger transformation, which will swap all highlighted blocks into the one selected. Obviously, these blocks do come from the user's inventory as well. Only proper, full size blocks can be used for this swap, so no flowers, torches or other shenenigans of the sort. Using this power does, naturally, require &4Mana&0 from the user's inventory.
|
||||
botania.page.exchangeRod1=Right clicking on a block in the world will start a larger transformation, which will swap all highlighted blocks into the one selected. Obviously, these blocks do come from the user's inventory as well. Only proper, full size blocks can be used for this swap, so no flowers, torches or other shenanigans of the sort. Using this power does, naturally, require &4Mana&0 from the user's inventory.
|
||||
botania.page.exchangeRod2=Other rods or devices can be used to extend the power of the &1Rod of the Shifting Crust&0.<br>For example, having a &1Rod of the Lands&0 in one's inventory provides the &1Rod of the Shifting Crust&0 with an endless supply of &1Dirt&0, assuming the &4Mana&0 cost for the &1Rod of the Lands&0' dirt conjuration is fulfilled.
|
||||
botania.page.exchangeRod3=Bootlegged equal trade
|
||||
|
||||
@@ -3688,7 +3693,7 @@ botania.page.enderEyeBlock1=MY BRAND
|
||||
botania.entry.pistonRelay=Force Relay
|
||||
botania.tagline.pistonRelay=Remote piston extension
|
||||
botania.page.pistonRelay0=It seems that infusing &1Pistons&0 with &4Mana&0 results in some interesting adverse effects.<br>This block tears the fabric of space, relaying any piston force applied to it to the block it's bound to.<br>To bind it to a block, right click it with a &1Wand of the Forest&0, and right click on the block you want to bind it to.
|
||||
botania.page.pistonRelay1=To break the block, shift-right click it with a &1Wand of the Forest&0, any other means will destroy it.<br>Furthermore, this block is highly unstable, and may create uncanny effects, care is to be taken. It is also resistant to glue, both in pulling and pushing. This allows for a "frame" like setup.
|
||||
botania.page.pistonRelay1=To break the block, shift-right click it with a &1Wand of the Forest&0, any other means will destroy it.<br>Furthermore, this block is highly unstable and may create uncanny effects; care is to be taken when working with it. It is resistant to glue, both in pulling and pushing, which allows for a "frame" like setup.
|
||||
botania.page.pistonRelay2=Infusing a &1Piston&0 with &4Mana&0.
|
||||
|
||||
# -- HAND OF ENDER
|
||||
@@ -4334,7 +4339,7 @@ botania.tagline.banners=Lots of new banner patterns
|
||||
botania.page.banners0=In the presence of the &1Banners&0 from the future, &1Botania&0 adds &415&0 new icons to them, which can be mixed and matched with the original patterns and icons.<br>The following items can be used alongside a dye in the crafting grid to add an icon to a &1Banner&0: &1All Iron Tools&0, &1Spark Augments&0, &1Raw Fish&0, &1Livingwood and Dreamwood Twigs&0, &1Lexica Botania&0, &1Terrasteel&0 and the &1Tiny Potato&0.
|
||||
botania.page.banners1=Showcase of the various banners
|
||||
|
||||
# -- PREVNTING DECAY
|
||||
# -- PREVENTING DECAY
|
||||
botania.entry.preventingDecay=Preventing Decay
|
||||
botania.tagline.preventingDecay=Preventing passive flowers' decay
|
||||
botania.page.preventingDecay0=no
|
||||
@@ -10,7 +10,7 @@ botaniamisc.statusUnknown=Estado Desconocido
|
||||
botaniamisc.color=%s Teñido
|
||||
botaniamisc.manaUsage=Uso de Maná
|
||||
botaniamisc.shiftToRead=Shift + click derecho para leer más
|
||||
botaniamisc.clickToRecipe=Shift + click para ver la receta
|
||||
botaniamisc.clickToSeeRecipe=Shift + click para ver la receta
|
||||
botaniamisc.clickToIndex=Shift + click para volver al índice
|
||||
botaniamisc.flareColor=%s Rounds
|
||||
botaniamisc.outputtingPower=Compartiendo Maná con Ítems
|
||||
|
||||
@@ -17,7 +17,7 @@ botaniamisc.statusUnknown=Estado desconocido
|
||||
botaniamisc.color=Teñido a %s
|
||||
botaniamisc.manaUsage=Uso de maná
|
||||
botaniamisc.shiftToRead=Shift + clic derecho para leer más
|
||||
botaniamisc.clickToRecipe=Shift + clic para ver la receta
|
||||
botaniamisc.clickToSeeRecipe=Shift + clic para ver la receta
|
||||
botaniamisc.clickToIndex=Shift + clic para volver al índice
|
||||
botaniamisc.flareColor=%s rondas
|
||||
botaniamisc.outputtingPower=Transfiriendo maná a objetos
|
||||
@@ -1471,6 +1471,8 @@ botania.potion.clear=Absolución
|
||||
botania.gui.lexicon.header=Lexica Botania, %s edición tabla de contenidos
|
||||
botania.gui.lexicon.wip=(Esta entrada es Trabajo en Curso. No está en su forma final)
|
||||
|
||||
botania.gui.flowerBag.title=Bolsa de flores
|
||||
|
||||
# MUSIC DISCS
|
||||
item.record.botania:gaia1.desc=Kain Vinosec - Endure Emptiness
|
||||
item.record.botania:gaia2.desc=Kain Vinosec - Fight For Quiescence
|
||||
|
||||
@@ -16,7 +16,7 @@ botaniamisc.statusUnknown=Statut inconnu
|
||||
botaniamisc.color=%s teinté
|
||||
botaniamisc.manaUsage=Utilisation de mana
|
||||
botaniamisc.shiftToRead=Maj-cliquez droit pour lire plus
|
||||
botaniamisc.clickToRecipe=Maj-cliquez vour voir la recette
|
||||
botaniamisc.clickToSeeRecipe=Maj-cliquez vour voir la recette
|
||||
botaniamisc.clickToIndex=Maj-cliquez pour l'index
|
||||
botaniamisc.flareColor=%s tours
|
||||
botaniamisc.outputtingPower=Partage le mana aux éléments
|
||||
@@ -1494,6 +1494,8 @@ botania.potion.clear=Absolution
|
||||
botania.gui.lexicon.header=Lexica Botania, Edition %s Table des matières
|
||||
botania.gui.lexicon.wip=(Ce passage est un travail en cours. Ce n'est même pas sa forme finale)
|
||||
|
||||
botania.gui.flowerBag.title=Poche à fleur
|
||||
|
||||
# MUSIC DISCS
|
||||
item.record.botania:gaia1.desc=Kain Vinosec - Supportez le vide
|
||||
item.record.botania:gaia2.desc=Kain Vinosec - Combat pour la quiétude
|
||||
|
||||
@@ -16,7 +16,7 @@ botaniamisc.statusUnknown=不明な状態
|
||||
botaniamisc.color=%s Tinted
|
||||
botaniamisc.manaUsage=マナ使用量
|
||||
botaniamisc.shiftToRead=詳細を読む(シフト+右クリック)
|
||||
botaniamisc.clickToRecipe=レシピを見る(シフトクリック)
|
||||
botaniamisc.clickToSeeRecipe=レシピを見る(シフトクリック)
|
||||
botaniamisc.clickToIndex=目次へ(シフト+クリック)
|
||||
botaniamisc.flareColor=%s Rounds
|
||||
botaniamisc.outputtingPower=アイテムへマナを送る
|
||||
@@ -1462,6 +1462,9 @@ item.botania:speedUpBelt.name=大地を闊歩するもののたすき
|
||||
item.botania:baubleBox.name=装飾品入れ
|
||||
item.botania:manaPowder.name=マナの粉末
|
||||
|
||||
# GUI TEXT
|
||||
botania.gui.flowerBag.title=花入れ小袋
|
||||
|
||||
# LEXICON CATEGORIES
|
||||
botania.category.basics=基本と機構
|
||||
botania.category.mana=マナの取り扱い
|
||||
|
||||
@@ -17,7 +17,7 @@ botaniamisc.statusUnknown=알 수 없는 상태
|
||||
botaniamisc.color=%s 색
|
||||
botaniamisc.manaUsage=마나 사용량
|
||||
botaniamisc.shiftToRead=Shift 우클릭으로 더 많은 정보를 얻으세요
|
||||
botaniamisc.clickToRecipe=Shift 좌클릭으로 조합법을 얻으세요
|
||||
botaniamisc.clickToSeeRecipe=Shift 좌클릭으로 조합법을 얻으세요
|
||||
botaniamisc.clickToIndex=Shift 클릭시 목차로 이동
|
||||
botaniamisc.flareColor=%s 색
|
||||
botaniamisc.outputtingPower=아이템에 마나를 주입합니다
|
||||
@@ -1493,6 +1493,8 @@ botania.potion.clear=면죄
|
||||
botania.gui.lexicon.header=보타니아 사전, %s 번째 제본판 목차 - 배우길 원하는 카테고리를 클릭하세요. :
|
||||
botania.gui.lexicon.wip=(이 부분은 작성중입니다. 내용이 완전하지 않을수도 있습니다.)
|
||||
|
||||
botania.gui.flowerBag.title=꽃 파우치
|
||||
|
||||
# MUSIC DISCS
|
||||
item.record.botania:gaia1.desc=Kain Vinosec - Endure Emptiness
|
||||
item.record.botania:gaia2.desc=Kain Vinosec - Fight For Quiescence
|
||||
@@ -2765,7 +2767,7 @@ botania.page.slimeBottle1=JUMPYDOLL
|
||||
# -- ROD OF THE SHIFTING CRUST
|
||||
botania.entry.exchangeRod=Rod of the Shifting Crust
|
||||
botania.page.exchangeRod0=&1Rod of the Shifting Crust&0 is a magical device with the ability to swap blocks in the world at very fast speeds. In order to achieve this, one must first select a block to swap with, this is done by shift-right clicking that block in the world.<br>After this block is selected, left clicking any other block in the world will swap it for that block, assuming it's present in the user's inventory.
|
||||
botania.page.exchangeRod1=Right clicking on a block in the world will start a larger transformation, which will swap all highlighted blocks into the one selected. Obviously, these blocks do come from the user's inventory as well. Only proper, full size blocks can be used for this swap, so no flowers, torches or other shenenigans of the sort. Using this power does, naturally, require &4Mana&0 from the user's inventory.
|
||||
botania.page.exchangeRod1=Right clicking on a block in the world will start a larger transformation, which will swap all highlighted blocks into the one selected. Obviously, these blocks do come from the user's inventory as well. Only proper, full size blocks can be used for this swap, so no flowers, torches or other shenanigans of the sort. Using this power does, naturally, require &4Mana&0 from the user's inventory.
|
||||
botania.page.exchangeRod2=Other rods or devices can be used to extend the power of the &1Rod of the Shifting Crust&0.<br>For example, having a &1Rod of the Lands&0 in one's inventory provides the &1Rod of the Shifting Crust&0 with an endless supply of &1Dirt&0, assuming the &4Mana&0 cost for the &1Rod of the Lands&0' dirt conjuration is fulfiled.
|
||||
botania.page.exchangeRod3=Bootlegged equal trade
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ botaniamisc.statusUnknown=Onbekende Status
|
||||
botaniamisc.color=%s Gekleurd
|
||||
botaniamisc.manaUsage=Mana Verbruik
|
||||
botaniamisc.shiftToRead=Shift-rechts klikken voor meer
|
||||
botaniamisc.clickToRecipe=Shift klikken voor recept
|
||||
botaniamisc.clickToSeeRecipe=Shift klikken voor recept
|
||||
botaniamisc.clickToIndex=Shift klikken voor index
|
||||
botaniamisc.flareColor=%s Ladingen
|
||||
botaniamisc.outputtingPower=Geeft Mana af aan items
|
||||
@@ -1653,6 +1653,8 @@ botania.potion.clear=Totaalheid
|
||||
botania.gui.lexicon.header=Lexica Botania, %s Editie Inhoudsopgave
|
||||
botania.gui.lexicon.wip=(Hier wordt nog aan gewerkt.)
|
||||
|
||||
botania.gui.flowerBag.title=Bloementas
|
||||
|
||||
# MUSIC DISCS
|
||||
item.record.botania:gaia1.desc=Kain Vinosec - Endure Emptiness
|
||||
item.record.botania:gaia2.desc=Kain Vinosec - Fight For Quiescence
|
||||
|
||||
@@ -16,7 +16,7 @@ botaniamisc.statusUnknown=Status desconhecido
|
||||
botaniamisc.color=Cor: %s
|
||||
botaniamisc.manaUsage=Uso de Mana
|
||||
botaniamisc.shiftToRead=Shift-clique direito para ler
|
||||
botaniamisc.clickToRecipe=Shift-clique para ver a receita
|
||||
botaniamisc.clickToSeeRecipe=Shift-clique para ver a receita
|
||||
botaniamisc.clickToIndex=Shift-clique para o índice
|
||||
botaniamisc.flareColor=Projéteis: %s
|
||||
botaniamisc.outputtingPower=Enviando Mana para Itens
|
||||
@@ -1693,6 +1693,8 @@ botania.potion.clear=Absolução
|
||||
botania.gui.lexicon.header=Lexica Botania, Edição %s - Índice
|
||||
botania.gui.lexicon.wip=(Esse tópico está em progresso. Nem ao menos está na forma final)
|
||||
|
||||
botania.gui.flowerBag.title=Cesto de Flores
|
||||
|
||||
# MUSIC DISCS
|
||||
item.record.botania:gaia1.desc=Kain Vinosec - Endure Emptiness
|
||||
item.record.botania:gaia2.desc=Kain Vinosec - Fight For Quiescence
|
||||
|
||||
@@ -18,7 +18,7 @@ botaniamisc.statusUnknown=Неизвестный статус
|
||||
botaniamisc.color=Окрашено в %s
|
||||
botaniamisc.manaUsage=Потребление маны
|
||||
botaniamisc.shiftToRead=Shift+ПКМ, чтобы прочитать об этом
|
||||
botaniamisc.clickToRecipe=Shift+ЛКМ, чтобы увидеть рецепт
|
||||
botaniamisc.clickToSeeRecipe=Shift+ЛКМ, чтобы увидеть рецепт
|
||||
botaniamisc.clickToIndex=Shift+ЛКМ, чтобы перейти в раздел
|
||||
botaniamisc.flareColor=%s заряд
|
||||
botaniamisc.outputtingPower=Затраты маны на предметы
|
||||
@@ -1704,6 +1704,8 @@ botania.potion.clear=Очищение
|
||||
botania.gui.lexicon.header=Лексика Botania, %s Выберите категорию:
|
||||
botania.gui.lexicon.wip=(Эта секция в разработке. Это даже не конечный вариант)
|
||||
|
||||
botania.gui.flowerBag.title=Цветочный мешочек
|
||||
|
||||
# MUSIC DISCS
|
||||
item.record.botania:gaia1.desc=Kain Vinosec - Endure Emptiness
|
||||
item.record.botania:gaia2.desc=Kain Vinosec - Fight For Quiescence
|
||||
|
||||
@@ -16,7 +16,7 @@ botaniamisc.statusUnknown=未知状态
|
||||
botaniamisc.color=%s 染色
|
||||
botaniamisc.manaUsage=魔力消耗
|
||||
botaniamisc.shiftToRead=Shift并右击了解更多
|
||||
botaniamisc.clickToRecipe=Shift点击查看合成
|
||||
botaniamisc.clickToSeeRecipe=Shift点击查看合成
|
||||
botaniamisc.clickToIndex=Shift点击查看目录
|
||||
botaniamisc.flareColor=%s 弹药
|
||||
botaniamisc.outputtingPower=给物品输送能量
|
||||
@@ -1699,6 +1699,8 @@ botania.potion.clear=赦免
|
||||
botania.gui.lexicon.header=植物魔法辞典 第%s版 - 目录
|
||||
botania.gui.lexicon.wip=(本条目的编纂工作仍在进行,其当前内容仍未完全定稿)
|
||||
|
||||
botania.gui.flowerBag.title=采花袋
|
||||
|
||||
# MUSIC DISCS
|
||||
item.record.botania:gaia1.desc=Kain Vinosec - Endure Emptiness
|
||||
item.record.botania:gaia2.desc=Kain Vinosec - Fight For Quiescence
|
||||
|
||||
@@ -16,7 +16,7 @@ botaniamisc.statusUnknown=未知狀態
|
||||
botaniamisc.color=%s 染色
|
||||
botaniamisc.manaUsage=瑪那消耗
|
||||
botaniamisc.shiftToRead=Shift並右擊瞭解更多
|
||||
botaniamisc.clickToRecipe=Shift點擊查看合成
|
||||
botaniamisc.clickToSeeRecipe=Shift點擊查看合成
|
||||
botaniamisc.clickToIndex=Shift點擊查看目錄
|
||||
botaniamisc.flareColor=%s 彈藥
|
||||
botaniamisc.outputtingPower=給物品輸送能量
|
||||
@@ -1696,6 +1696,8 @@ botania.potion.clear=赦免
|
||||
botania.gui.lexicon.header=植物魔法辭典 第%s版 - 目錄
|
||||
botania.gui.lexicon.wip=(本條目的編纂工作仍在進行,其當前內容仍未完全定稿)
|
||||
|
||||
botania.gui.flowerBag.title=採花袋
|
||||
|
||||
# MUSIC DISCS
|
||||
item.record.botania:gaia1.desc=Kain Vinosec - Endure Emptiness
|
||||
item.record.botania:gaia2.desc=Kain Vinosec - Fight For Quiescence
|
||||
|
||||
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |