mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-10-26 14:24:22 +00:00
Compare commits
20
Commits
1.13.17-GTNH
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c5c51e6fa | ||
|
|
37379acd3d | ||
|
|
3f62d4b8fe | ||
|
|
2257f1648c | ||
|
|
cefdfd7ca6 | ||
|
|
c802a448e4 | ||
|
|
daae5de075 | ||
|
|
abd62c1076 | ||
|
|
8e709b0190 | ||
|
|
a16181c480 | ||
|
|
9f9c413b48 | ||
|
|
31eb7b3516 | ||
|
|
d213b7bf0a | ||
|
|
c168882a48 | ||
|
|
073ae658b5 | ||
|
|
0e88bd8a9c | ||
|
|
9d1709dd74 | ||
|
|
ffdce1834c | ||
|
|
3fa2240e61 | ||
|
|
ec99a884b6 |
No files matched your search
@@ -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).
|
||||
|
||||
|
||||
+8
-9
@@ -1,20 +1,19 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:Baubles-Expanded:2.2.14-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:GTNHLib:0.9.62: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.60:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.7.10:dev') {transitive=false}
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.96-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.17.26:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.2.20-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.34:dev")
|
||||
compileOnly("com.github.GTNewHorizons:StructureLib:1.4.42:dev")
|
||||
}
|
||||
|
||||
+2
-2
@@ -44,7 +44,7 @@ developmentEnvironmentUserName = Developer
|
||||
# - 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 = jabel
|
||||
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.
|
||||
@@ -65,7 +65,7 @@ enableModernJavaSyntax = jabel
|
||||
# - 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 =
|
||||
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.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c2dd35c9d0aaf0ba6ad0791320f99dfc/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/e5810bd7fd1f8a586644409d395a7e55/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/7b3c4877c0749019e6805bb61e421497/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/d76df094a9cbbabd3b08251f9e61444a/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
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.24'
|
||||
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);
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -39,10 +40,12 @@ import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.item.ItemLexicon;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
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() {
|
||||
@@ -50,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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
+129
-92
@@ -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;
|
||||
}
|
||||
}
|
||||
+102
-124
@@ -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)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+51
-46
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+124
-106
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
+115
-100
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+118
-94
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+79
-81
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+38
-34
@@ -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;
|
||||
|
||||
+6
-3
@@ -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
|
||||
|
||||
@@ -101,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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
@@ -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) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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!)
|
||||
|
||||
|
||||
Reference in new issue
Block a user