mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-10-26 22:34:08 +00:00
Compare commits
34
Commits
1.13.3-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 | ||
|
|
944aec7441 | ||
|
|
9d677e7734 | ||
|
|
0852f91ba7 | ||
|
|
38845602a9 | ||
|
|
4878e88fce | ||
|
|
fa850857e8 | ||
|
|
e0a0b1ec53 | ||
|
|
d42076af69 | ||
|
|
610dad28b7 | ||
|
|
eb767ebeaa | ||
|
|
1516aa495e | ||
|
|
bba06bcf46 | ||
|
|
d407ca2c31 | ||
|
|
c0daedcbd8 |
No files matched your search
@@ -0,0 +1,17 @@
|
||||
name: Optimize images
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, main, release/** ]
|
||||
paths:
|
||||
- "**/*.png"
|
||||
|
||||
push:
|
||||
branches: [ master, main, release/** ]
|
||||
paths:
|
||||
- "**/*.png"
|
||||
|
||||
jobs:
|
||||
optimize-images:
|
||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.yml@master
|
||||
secrets: inherit
|
||||
@@ -1,40 +0,0 @@
|
||||
Hey there. Looks like you want to contribute with an issue. Great. Here's what you have to do:
|
||||
* Have a look through the [Botania FAQ](http://botaniamod.net/faq.php), to see if your issue has been solved already;
|
||||
* Read through the steps on [Bug Reporting 101](http://vazkii.us/br101/) (You may skip this if you're already familiar with reporting issues, but it's good for newcomers);
|
||||
* Note the following points:
|
||||
* Issues regarding MCPC+/Cauldron that are not reproducible with forge only are **not accepted**;
|
||||
* Issues regarding outdated versions of the mod are **not accepted**;
|
||||
* Unless you manually update every mod on the pack to the latest, issues regarding any public modpack that is not officially maintained or supported by the botania developers (the ones in the modpack section of the website are not) are **not accepted**;
|
||||
* Duplicate issues or issues that have been solved already (use the search feature!) will be closed without asking.
|
||||
* Do not tag your issues' names. "Something Broke" is prefered to "[Bug] Something Broke" because there's a proper label system in place.
|
||||
* Suggestions are **not** accepted here. Post them on the forums or reddit instead. If there's any still open they're old ones before this rule was added.
|
||||
|
||||
The following "bugs" are not accepted:
|
||||
* Intended Behaviour
|
||||
* Double tall flowers need be harvested with shears to not clutter the inventory
|
||||
* Already fixed but people keep reporting it for some reason
|
||||
* Wearing a Ring of Loki or Ring of the Aesir shows a wireframe below bedrock
|
||||
* Not a botania problem/Not fixable
|
||||
* Crash on startup with ChromatiCraft installed (update CC)
|
||||
* Crash on startup with Blocks3D Mod installed
|
||||
* Crash on opening the Lexica Botania with Enchiridion installed (update Enchiridion)
|
||||
* Flowers don't render (Optifine issue)
|
||||
* Mana Bursts get destroyed on Cauldron by the ClearLagg plugin (add botania:manaBurst to the ClearLagg blacklist)
|
||||
* Force Relays destroy blocks when used very fast (Can't fix due to the nature of the block)
|
||||
* Terrasteel crafting won't start (make sure your checkerboard is correct, there's Livingrock under the plate)
|
||||
* The Horn of the Canopy doesn't break Thaumcraft leaves (Thaumcraft doesn't use the typical class or material)
|
||||
* Some Baubles don't work properly on LAN (Baubles bug)
|
||||
|
||||
[Report the Issue](https://github.com/Vazkii/Botania/issues)!
|
||||
|
||||
You can find me at most times on [#vazkii @ irc.esper.net](http://webchat.esper.net/?channels=vazkii), if you need to speak with me about the issue you would report. Just make sure to use common sense and read what the bot tells you.
|
||||
|
||||
---
|
||||
|
||||
If you want to make a Pull Request keep these in mind:
|
||||
* Do NOT use the github editor. Test your damn PRs before you submit them.
|
||||
* I'm very strict when it comes to syntax. Make sure your PR's syntax matches the syntax of the rest of the code. That includes spacing after if/for/(etc), proper bracket usage, camel casing and copyleft headers on new classes.
|
||||
* If your pull request edits very small chunks of code and isn't flawless I'll close it as it'll probably take less time to fix it myself rather than pull yours and change the code.
|
||||
* Unless you have a very good reason for it, keep your PRs all in one commit. You can do it with [rebase](https://git-scm.com/docs/git-rebase).
|
||||
|
||||
|
||||
+9
-8
@@ -1,18 +1,19 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:Baubles-Expanded:2.2.0-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:GTNHLib:0.7.0: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.45:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.6.8:dev') {transitive=false}
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.8-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.17.0:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.2.0-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.23:dev")
|
||||
compileOnly("com.github.GTNewHorizons:StructureLib:1.4.42:dev")
|
||||
}
|
||||
|
||||
+39
-4
@@ -39,9 +39,33 @@ remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/co
|
||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||
developmentEnvironmentUserName = Developer
|
||||
|
||||
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
||||
# See https://github.com/bsideup/jabel for details on how this works.
|
||||
enableModernJavaSyntax = true
|
||||
# Enables modern Java syntax support. Valid values:
|
||||
# - false: No modern syntax, Java 8 only
|
||||
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
|
||||
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
|
||||
# - modern: Native modern Java bytecode, no downgrading
|
||||
enableModernJavaSyntax = jvmDowngrader
|
||||
|
||||
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
|
||||
# and should *not* be used in most situations. -1 disables this.
|
||||
# forceToolchainVersion = -1
|
||||
|
||||
# Target JVM version for JVM Downgrader bytecode downgrading.
|
||||
# Only used when enableModernJavaSyntax = jvmDowngrader
|
||||
# downgradeTargetVersion = 8
|
||||
|
||||
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
|
||||
# Classes will be available in META-INF/versions/N/ for each version N in this list.
|
||||
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
|
||||
# jvmDowngraderMultiReleaseVersions = 21,25
|
||||
|
||||
# Specifies how JVM Downgrader API stubs are provided. Options:
|
||||
# - shade: Shade minimized stubs into the jar
|
||||
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
|
||||
# - external: Another dependency provides stubs (no constraint, no warning)
|
||||
# - (empty): Warning reminding you to configure stubs
|
||||
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
|
||||
jvmDowngraderStubsProvider = gtnhlib
|
||||
|
||||
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
||||
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||
@@ -87,7 +111,9 @@ usesMixinDebug = false
|
||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||
mixinPlugin =
|
||||
|
||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||
# Specify the package that contains all of your Mixins. The package must exist or
|
||||
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
|
||||
# it must match with this or the build will fail.
|
||||
mixinsPackage =
|
||||
|
||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||
@@ -163,6 +189,12 @@ curseForgeRelations =
|
||||
# projects. New projects should not use this parameter.
|
||||
# customArchiveBaseName =
|
||||
|
||||
# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory.
|
||||
# runClientWorkingDirectory = run/client
|
||||
|
||||
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory.
|
||||
# runServerWorkingDirectory = run/server
|
||||
|
||||
# Optional parameter to have the build automatically fail if an illegal version is used.
|
||||
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
|
||||
# The check is ONLY performed if the version is a git tag.
|
||||
@@ -192,3 +224,6 @@ disableSpotless = true
|
||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||
# ideaCheckSpotlessOnBuild = true
|
||||
|
||||
# Non-GTNH properties
|
||||
org.gradle.configuration-cache = true
|
||||
org.gradle.parallel = true
|
||||
@@ -0,0 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
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
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -57,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -114,7 +114,6 @@ case "$( uname )" in #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@@ -172,7 +171,6 @@ fi
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
@@ -212,8 +210,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
|
||||
Vendored
+1
-2
@@ -70,11 +70,10 @@ goto fail
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.43'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.27'
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,12 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
||||
/**
|
||||
* The class for a Brew definition, each one is a singleton.
|
||||
* A type of brew that can be created in the Botanical Brewery.
|
||||
*
|
||||
* <p>
|
||||
* Each instance of this class represents a single <i>type</i> of brew that can be created in the brewery, similarly
|
||||
* to how {@link net.minecraft.item.Item} and {@link net.minecraft.block.Block} work.
|
||||
* </p>
|
||||
*/
|
||||
public class Brew {
|
||||
|
||||
@@ -31,11 +36,12 @@ public class Brew {
|
||||
boolean canInfuseIncense = true;
|
||||
|
||||
/**
|
||||
* @param key The key for this brew, used in NBT and the global map.
|
||||
* @param name The unlocalized name of this potion.
|
||||
* @param color The color for the potion to be rendered in the bottle, note that it will get
|
||||
* changed a bit when it renders (for more or less brightness) to give a fancy effect.
|
||||
* @param cost The cost, in Mana for this brew.
|
||||
* @param effects A list of effects to apply to the player when they drink it.
|
||||
* @param color The color for the potion to be rendered in the bottle. Note that it will get
|
||||
* changed a bit when it renders (for more or less brightness) to give a fancy effect.
|
||||
* @param cost The cost, in Mana for this brew. Must be positive.
|
||||
* @param effects A list of potion effects to apply to the player when they drink it.
|
||||
*/
|
||||
public Brew(String key, String name, int color, int cost, PotionEffect... effects) {
|
||||
this.key = key;
|
||||
@@ -101,14 +107,14 @@ public class Brew {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the insensitive unlocalized mana cost. This is used for the lexicon.
|
||||
* Get the item-insensitive mana cost. This is used for the lexicon and for crafting costs.
|
||||
*/
|
||||
public int getManaCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the mana cost for the ItemStack passed in.
|
||||
* Gets the mana cost for the ItemStack passed in. In standard Botania, this is used only by the Cursed Blood Pendant.
|
||||
*/
|
||||
public int getManaCost(ItemStack stack) {
|
||||
return getManaCost();
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package vazkii.botania.api.brew;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
/**
|
||||
* Utility methods for checking the properties of {@link ItemStack}s related to Brews.
|
||||
*/
|
||||
public final class BrewUtilities {
|
||||
|
||||
/**
|
||||
* Check if an {@link ItemStack} represents a filled Brew.
|
||||
*
|
||||
* @param stack The stack to check
|
||||
* @return Whether this item contains a Brew.
|
||||
*/
|
||||
public static boolean isFilledBrew(ItemStack stack) {
|
||||
if (!(stack.getItem() instanceof IBrewItem brewItem)) return false;
|
||||
final Brew brew = brewItem.getBrew(stack);
|
||||
return brew != null && brew != BotaniaAPI.fallbackBrew;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an {@link ItemStack} is an empty Brew Container - an item that can go on the middle pedestal of the Botanical Brewery.
|
||||
*
|
||||
* @param stack The stack to check
|
||||
* @return Whether this item is a Brew Container that does not contain a Brew.
|
||||
*/
|
||||
public static boolean isEmptyBrewContainer(ItemStack stack) {
|
||||
return stack.getItem() instanceof IBrewContainer && !isFilledBrew(stack);
|
||||
}
|
||||
}
|
||||
@@ -10,26 +10,32 @@
|
||||
*/
|
||||
package vazkii.botania.api.brew;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* An Item that implements this counts as a Brew Container, by which
|
||||
* it can be used a center item for brew recipes and can contain
|
||||
* a brew.
|
||||
* An {@link Item} that implements this counts as a Brew Container, which allows it to be used a center item in the Botanical Brewery.
|
||||
*/
|
||||
public interface IBrewContainer {
|
||||
|
||||
/**
|
||||
* Returs an ItemStack that should be an item that has the brew
|
||||
* passed in.
|
||||
* Fills an {@link ItemStack} of this container with a {@link Brew}.
|
||||
* If the brew cannot be applied to this container, returns null instead.
|
||||
*
|
||||
* @param brew The brew which may or may not be applicable to this container.
|
||||
* @param stack The stack of this item which is being filled. This stack is not mutated.
|
||||
* @return A <i>new</i> {@link ItemStack} containing an {@link IBrewItem}, or null if this brew is not applicable.
|
||||
* @apiNote The returned stack does not necessarily have to be the same {@link Item} as the empty container.
|
||||
*/
|
||||
public ItemStack getItemForBrew(Brew brew, ItemStack stack);
|
||||
ItemStack getItemForBrew(Brew brew, ItemStack stack);
|
||||
|
||||
/**
|
||||
* Gets the cost to add this brew onto this container. Return -1
|
||||
* to not allow for the brew to be added. Normally you'd
|
||||
* use brew.getManaCost(stack);
|
||||
* Gets the cost to add this brew onto this container. The cost must be a positive number.
|
||||
*
|
||||
* @param brew The brew being applied, which must be applicable to this container. {@link IBrewContainer#getItemForBrew(Brew, ItemStack)} can be used to determine whether the brew is applicable.
|
||||
* @param stack A stack of this empty container. This stack is not mutated.
|
||||
* @return The mana cost for this recipe, which is a positive number.
|
||||
*/
|
||||
public int getManaCost(Brew brew, ItemStack stack);
|
||||
int getManaCost(Brew brew, ItemStack stack);
|
||||
|
||||
}
|
||||
@@ -10,15 +10,26 @@
|
||||
*/
|
||||
package vazkii.botania.api.brew;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
/**
|
||||
* An Item that implements this is a Brew item, by which it contains
|
||||
* a brew. This is only used in vanilla to prevent the brew item
|
||||
* from going back into the brewery but other mods might use it for whatever.
|
||||
* An {@link Item} that implements this is an item which can contain a {@link Brew}.
|
||||
* <p>
|
||||
* This is used in standard Botania to prevent finished brews from going back into the brewery & to enable NEI searches.
|
||||
* However, other mods might use it for other purposes.
|
||||
* </p>
|
||||
*/
|
||||
public interface IBrewItem {
|
||||
|
||||
public Brew getBrew(ItemStack brew);
|
||||
/**
|
||||
* Get the brew contained within a stack of this item.
|
||||
*
|
||||
* @param brew A stack of this item whose contents are being queried.
|
||||
* @return The brew within this container, or {@link BotaniaAPI#fallbackBrew} or null if the stack does not contain
|
||||
* a valid brew.
|
||||
*/
|
||||
Brew getBrew(ItemStack brew);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package vazkii.botania.api.mana;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public interface ITieredManaTooltipDisplay extends IManaTooltipDisplay {
|
||||
/**
|
||||
* Returns the text to use for the top-left side of the mana bar
|
||||
* @param stack the item being rendered
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Nonnull
|
||||
String getLeftManaLabel(@Nonnull ItemStack stack);
|
||||
|
||||
/**
|
||||
* Returns the text to use for the top-right side of the mana bar
|
||||
* @param stack the item being rendered
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Nonnull
|
||||
String getRightManaLabel(@Nonnull ItemStack stack);
|
||||
|
||||
/**
|
||||
* Should the mana bar use the rainbow effect
|
||||
* @param stack the item being rendered
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
boolean isRainbowEffect(@Nonnull ItemStack stack);
|
||||
|
||||
/**
|
||||
* Indicate the mana level boundaries for this item.
|
||||
*/
|
||||
@Nonnull
|
||||
int[] getManaTiers(@Nonnull ItemStack stack);
|
||||
}
|
||||
@@ -32,7 +32,9 @@ import vazkii.botania.common.core.helper.MathHelper;
|
||||
public final class BossBarHandler {
|
||||
|
||||
public static final ResourceLocation defaultBossBar = new ResourceLocation(LibResources.GUI_BOSS_BAR);
|
||||
static IBotaniaBoss currentBoss;
|
||||
private static IBotaniaBoss currentBoss;
|
||||
private static Entity lastBossEntity;
|
||||
private static String lastBossName;
|
||||
|
||||
private static final BarCallback barUniformCallback = new BarCallback();
|
||||
|
||||
@@ -47,7 +49,13 @@ public final class BossBarHandler {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Rectangle bgRect = currentBoss.getBossBarTextureRect();
|
||||
Rectangle fgRect = currentBoss.getBossBarHPTextureRect();
|
||||
String name = currentBoss.func_145748_c_().getFormattedText();
|
||||
Entity e = (Entity) currentBoss;
|
||||
String name;
|
||||
if(lastBossEntity != e) {
|
||||
name = currentBoss.func_145748_c_().getFormattedText();
|
||||
lastBossEntity = e;
|
||||
lastBossName = name;
|
||||
} else name = lastBossName;
|
||||
int c = res.getScaledWidth() / 2;
|
||||
int x = c - bgRect.width / 2;
|
||||
int y = 20;
|
||||
@@ -66,7 +74,6 @@ public final class BossBarHandler {
|
||||
mc.fontRenderer.drawStringWithShadow(name, tx, y - 10, 0xA2018C);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
Entity e = (Entity) currentBoss;
|
||||
EntityPlayer p = mc.thePlayer;
|
||||
if(e.isDead || !p.worldObj.loadedEntityList.contains(e) || MathHelper.pointDistanceSpace(e.posX, e.posY, e.posZ, p.posX, p.posY, p.posZ) > 32)
|
||||
currentBoss = null;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
@@ -30,13 +31,16 @@ import org.lwjgl.input.Keyboard;
|
||||
|
||||
import vazkii.botania.api.corporea.CorporeaHelper;
|
||||
import vazkii.botania.common.lib.LibObfuscation;
|
||||
import vazkii.botania.utils.ReflectionUtils;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
public class CorporeaAutoCompleteHandler {
|
||||
|
||||
private static final Field COMPLETE_FLAG = ReflectionUtils.findField(GuiChat.class, LibObfuscation.COMPLETE_FLAG);
|
||||
private static final Field INPUT_FIELD = ReflectionUtils.findField(GuiChat.class, LibObfuscation.INPUT_FIELD);
|
||||
|
||||
boolean isAutoCompleted = false;
|
||||
String originalString = "";
|
||||
List<CompletionData> completions = new ArrayList<>();
|
||||
@@ -83,7 +87,7 @@ public class CorporeaAutoCompleteHandler {
|
||||
}
|
||||
GuiChat chat = (GuiChat) screen;
|
||||
if(isAutoCompleted) {
|
||||
boolean valid = ReflectionHelper.getPrivateValue(GuiChat.class, chat, LibObfuscation.COMPLETE_FLAG);
|
||||
boolean valid = ReflectionUtils.getBoolean(COMPLETE_FLAG, chat);
|
||||
if(!valid)
|
||||
isAutoCompleted = false;
|
||||
}
|
||||
@@ -99,7 +103,7 @@ public class CorporeaAutoCompleteHandler {
|
||||
if(!CorporeaHelper.shouldAutoComplete())
|
||||
return;
|
||||
|
||||
GuiTextField inputField = ReflectionHelper.getPrivateValue(GuiChat.class, chat, LibObfuscation.INPUT_FIELD);
|
||||
GuiTextField inputField = (GuiTextField) ReflectionUtils.getObject(INPUT_FIELD, chat);
|
||||
if(!isAutoCompleted)
|
||||
buildAutoCompletes(inputField, chat);
|
||||
if(isAutoCompleted && !completions.isEmpty())
|
||||
@@ -127,7 +131,7 @@ public class CorporeaAutoCompleteHandler {
|
||||
if(completions.isEmpty())
|
||||
return;
|
||||
position = -1;
|
||||
ReflectionHelper.setPrivateValue(GuiChat.class, chat, true, LibObfuscation.COMPLETE_FLAG);
|
||||
ReflectionUtils.setBoolean(COMPLETE_FLAG, chat, true);
|
||||
StringBuilder stringbuilder = new StringBuilder();
|
||||
CompletionData data;
|
||||
for(Iterator<CompletionData> iterator = completions.iterator(); iterator.hasNext(); stringbuilder.append(data.string)) {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
@@ -50,7 +51,6 @@ import vazkii.botania.api.wiki.IWikiProvider;
|
||||
import vazkii.botania.api.wiki.WikiHooks;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.TileAltar;
|
||||
import vazkii.botania.common.block.tile.TileRuneAltar;
|
||||
@@ -65,15 +65,18 @@ import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemMonocle;
|
||||
import vazkii.botania.common.lib.LibObfuscation;
|
||||
import vazkii.botania.utils.ReflectionUtils;
|
||||
import baubles.common.container.InventoryBaubles;
|
||||
import baubles.common.lib.PlayerHandler;
|
||||
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
public final class HUDHandler {
|
||||
|
||||
public static final ResourceLocation manaBar = new ResourceLocation(LibResources.GUI_MANA_HUD);
|
||||
|
||||
private static final Field REMAINING_HIGHLIGHT_TICKS = ReflectionUtils.findField(GuiIngame.class, LibObfuscation.REMAINING_HIGHLIGHT_TICKS);
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||
public void onDrawScreenPre(RenderGameOverlayEvent.Pre event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
@@ -128,7 +131,7 @@ public final class HUDHandler {
|
||||
renderCrystalCubeHUD(event.resolution, (TileCorporeaCrystalCube) tile);
|
||||
}
|
||||
|
||||
if(!TileCorporeaIndex.InputHandler.getNearbyIndexes(mc.thePlayer).isEmpty() && mc.currentScreen != null && mc.currentScreen instanceof GuiChat) {
|
||||
if(mc.currentScreen != null && mc.currentScreen instanceof GuiChat && TileCorporeaIndex.InputHandler.hasNearbyIndexes(mc.thePlayer)) {
|
||||
profiler.startSection("nearIndex");
|
||||
renderNearIndexDisplay(event.resolution);
|
||||
profiler.endSection();
|
||||
@@ -159,21 +162,23 @@ public final class HUDHandler {
|
||||
profiler.endSection();
|
||||
}*/
|
||||
|
||||
if(Botania.proxy.isClientPlayerWearingMonocle()) {
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player);
|
||||
|
||||
if(ItemMonocle.hasMonocle(baubles)) {
|
||||
profiler.startSection("monocle");
|
||||
ItemMonocle.renderHUD(event.resolution, mc.thePlayer);
|
||||
ItemMonocle.renderHUD(event.resolution, player);
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
profiler.startSection("manaBar");
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
int totalMana = 0;
|
||||
int totalMaxMana = 0;
|
||||
boolean anyRequest = false;
|
||||
boolean creative = false;
|
||||
|
||||
IInventory mainInv = player.inventory;
|
||||
IInventory baublesInv = PlayerHandler.getPlayerBaubles(player);
|
||||
IInventory baublesInv = baubles;
|
||||
|
||||
int invSize = mainInv.getSizeInventory();
|
||||
int size = invSize;
|
||||
@@ -221,7 +226,7 @@ public final class HUDHandler {
|
||||
Profiler profiler = mc.mcProfiler;
|
||||
|
||||
profiler.startSection("wandMode");
|
||||
int ticks = ReflectionHelper.getPrivateValue(GuiIngame.class, mc.ingameGUI, LibObfuscation.REMAINING_HIGHLIGHT_TICKS);
|
||||
int ticks = ReflectionUtils.getInt(REMAINING_HIGHLIGHT_TICKS, mc.ingameGUI);
|
||||
ticks -= 15;
|
||||
if(ticks > 0) {
|
||||
int alpha = Math.min(255, (int) (ticks * 256.0F / 10.0F));
|
||||
@@ -257,8 +262,8 @@ public final class HUDHandler {
|
||||
else return;
|
||||
}
|
||||
|
||||
Color color = new Color(Color.HSBtoRGB(0.55F, (float) Math.min(1F, Math.sin(System.currentTimeMillis() / 200D) * 0.5 + 1F), 1F));
|
||||
GL11.glColor4ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) (255 - color.getRed()));
|
||||
int rgb = Color.HSBtoRGB(0.55F, (float) Math.min(1F, Math.sin(System.currentTimeMillis() / 200D) * 0.5 + 1F), 1F);
|
||||
GL11.glColor4ub((byte) (rgb >> 16), (byte) (rgb >> 8), (byte) rgb, (byte) (255 - (rgb >> 16)));
|
||||
mc.renderEngine.bindTexture(manaBar);
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
@@ -480,8 +485,7 @@ public final class HUDHandler {
|
||||
|
||||
RenderHelper.drawTexturedModalRect(x + 1, y + 1, 0, 0, 5, 100, 3);
|
||||
|
||||
Color color_ = new Color(color);
|
||||
GL11.glColor4ub((byte) color_.getRed(), (byte) color_.getGreen(),(byte) color_.getBlue(), (byte) (255F * alpha));
|
||||
GL11.glColor4ub((byte) (color >> 16), (byte) (color >> 8), (byte) color, (byte) (255F * alpha));
|
||||
RenderHelper.drawTexturedModalRect(x + 1, y + 1, 0, 0, 5, Math.min(100, manaPercentage), 3);
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@ public final class ItemsRemainingRenderHandler {
|
||||
|
||||
private static ItemStack stack;
|
||||
private static int ticks, count;
|
||||
private static String cachedText;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void render(ScaledResolution resolution, float partTicks) {
|
||||
@@ -62,17 +63,7 @@ public final class ItemsRemainingRenderHandler {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
String text = EnumChatFormatting.GREEN + stack.getDisplayName();
|
||||
if(count >= 0) {
|
||||
int max = stack.getMaxStackSize();
|
||||
int stacks = count / max;
|
||||
int rem = count % max;
|
||||
|
||||
if(stacks == 0)
|
||||
text = "" + count;
|
||||
else text = count + " (" + EnumChatFormatting.AQUA + stacks + EnumChatFormatting.RESET + "*" + EnumChatFormatting.GRAY + max + EnumChatFormatting.RESET + "+" + EnumChatFormatting.YELLOW + rem + EnumChatFormatting.RESET + ")";
|
||||
} else if(count == -1)
|
||||
text = "\u221E";
|
||||
String text = cachedText;
|
||||
|
||||
int color = 0x00FFFFFF | (int) (alpha * 0xFF) << 24;
|
||||
mc.fontRenderer.drawStringWithShadow(text, x + 20, y + 6, color);
|
||||
@@ -92,6 +83,22 @@ public final class ItemsRemainingRenderHandler {
|
||||
ItemsRemainingRenderHandler.stack = stack;
|
||||
ItemsRemainingRenderHandler.count = count;
|
||||
ticks = stack == null ? 0 : maxTicks;
|
||||
|
||||
cachedText = "";
|
||||
if(stack != null) {
|
||||
String text = EnumChatFormatting.GREEN + stack.getDisplayName();
|
||||
if(count >= 0) {
|
||||
int max = stack.getMaxStackSize();
|
||||
int stacks = count / max;
|
||||
int rem = count % max;
|
||||
|
||||
if(stacks == 0)
|
||||
text = "" + count;
|
||||
else text = count + " (" + EnumChatFormatting.AQUA + stacks + EnumChatFormatting.RESET + "*" + EnumChatFormatting.GRAY + max + EnumChatFormatting.RESET + "+" + EnumChatFormatting.YELLOW + rem + EnumChatFormatting.RESET + ")";
|
||||
} else if(count == -1)
|
||||
text = "\u221E";
|
||||
cachedText = text;
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(EntityPlayer player, ItemStack displayStack, Pattern pattern) {
|
||||
|
||||
@@ -2,15 +2,14 @@
|
||||
* This class was created by <Vazkii/ChickenBones>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Feb 3, 2014, 9:05:38 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
@@ -51,10 +50,11 @@ public class LightningHandler {
|
||||
static double interpPosY;
|
||||
static double interpPosZ;
|
||||
|
||||
private static Vector3 getRelativeViewVector(Vector3 pos) {
|
||||
Entity renderEntity = Minecraft.getMinecraft().renderViewEntity;
|
||||
return new Vector3((float) renderEntity.posX - pos.x, (float) renderEntity.posY + renderEntity.getEyeHeight() - pos.y, (float) renderEntity.posZ - pos.z);
|
||||
}
|
||||
private final Vector3 scratchView = new Vector3();
|
||||
private final Vector3 scratchPoint = new Vector3();
|
||||
private final Vector3 scratchDiff1 = new Vector3();
|
||||
private final Vector3 scratchDiff2 = new Vector3();
|
||||
private final Vector3 scratchRound = new Vector3();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRenderWorldLast(RenderWorldLastEvent event) {
|
||||
@@ -67,12 +67,14 @@ public class LightningHandler {
|
||||
profiler.endStartSection("lightning");
|
||||
|
||||
float frame = event.partialTicks;
|
||||
Entity entity = Minecraft.getMinecraft().thePlayer;
|
||||
TextureManager render = Minecraft.getMinecraft().renderEngine;
|
||||
|
||||
interpPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * frame;
|
||||
interpPosY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * frame;
|
||||
interpPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * frame;
|
||||
Entity viewEntity = Minecraft.getMinecraft().renderViewEntity;
|
||||
interpPosX = viewEntity.lastTickPosX + (viewEntity.posX - viewEntity.lastTickPosX) * frame;
|
||||
interpPosY = viewEntity.lastTickPosY + (viewEntity.posY - viewEntity.lastTickPosY) * frame;
|
||||
interpPosZ = viewEntity.lastTickPosZ + (viewEntity.posZ - viewEntity.lastTickPosZ) * frame;
|
||||
|
||||
scratchView.set(viewEntity.posX, viewEntity.posY + viewEntity.getEyeHeight(), viewEntity.posZ);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(-interpPosX, -interpPosY, -interpPosZ);
|
||||
@@ -130,22 +132,23 @@ public class LightningHandler {
|
||||
int renderstart = (int) ((expandTime / 2 - bolt.particleMaxAge + bolt.particleAge) / (float) (expandTime / 2) * bolt.numsegments0);
|
||||
int renderend = (int) ((bolt.particleAge + expandTime) / (float) expandTime * bolt.numsegments0);
|
||||
|
||||
for(Segment rendersegment : bolt.segments) {
|
||||
for(int i = 0; i < bolt.segments.size(); i++) {
|
||||
Segment rendersegment = bolt.segments.get(i);
|
||||
if(rendersegment.segmentno < renderstart || rendersegment.segmentno > renderend)
|
||||
continue;
|
||||
|
||||
Vector3 playervec = getRelativeViewVector(rendersegment.startpoint.point).multiply(-1);
|
||||
Vector3 playervec = scratchPoint.set(rendersegment.startpoint.point).subtract(scratchView);
|
||||
|
||||
double width = 0.025F * (playervec.mag() / 5 + 1) * (1 + rendersegment.light) * 0.5F;
|
||||
|
||||
Vector3 diff1 = playervec.copy().crossProduct(rendersegment.prevdiff).normalize().multiply(width / rendersegment.sinprev);
|
||||
Vector3 diff2 = playervec.copy().crossProduct(rendersegment.nextdiff).normalize().multiply(width / rendersegment.sinnext);
|
||||
Vector3 diff1 = scratchDiff1.set(playervec).crossProduct(rendersegment.prevdiff).normalize().multiply(width / rendersegment.sinprev);
|
||||
Vector3 diff2 = scratchDiff2.set(playervec).crossProduct(rendersegment.nextdiff).normalize().multiply(width / rendersegment.sinnext);
|
||||
|
||||
Vector3 startvec = rendersegment.startpoint.point;
|
||||
Vector3 endvec = rendersegment.endpoint.point;
|
||||
|
||||
int color = inner ? bolt.colorInner : bolt.colorOuter;
|
||||
tessellator.setColorRGBA_I(color, (int) (mainalpha * rendersegment.light * new Color(color).getAlpha()));
|
||||
tessellator.setColorRGBA_I(color, (int) (mainalpha * rendersegment.light * 255));
|
||||
|
||||
tessellator.addVertexWithUV(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z, 0.5, 0);
|
||||
tessellator.addVertexWithUV(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z, 0.5, 0);
|
||||
@@ -153,7 +156,7 @@ public class LightningHandler {
|
||||
tessellator.addVertexWithUV(endvec.x + diff2.x, endvec.y + diff2.y, endvec.z + diff2.z, 0.5, 1);
|
||||
|
||||
if(rendersegment.next == null) {
|
||||
Vector3 roundend = rendersegment.endpoint.point.copy().add(rendersegment.diff.copy().normalize().multiply(width));
|
||||
Vector3 roundend = scratchRound.set(rendersegment.diff).normalize().multiply(width).add(rendersegment.endpoint.point);
|
||||
|
||||
tessellator.addVertexWithUV(roundend.x - diff2.x, roundend.y - diff2.y, roundend.z - diff2.z, 0, 0);
|
||||
tessellator.addVertexWithUV(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z, 0.5, 0);
|
||||
@@ -162,7 +165,7 @@ public class LightningHandler {
|
||||
}
|
||||
|
||||
if(rendersegment.prev == null) {
|
||||
Vector3 roundend = rendersegment.startpoint.point.copy().subtract(rendersegment.diff.copy().normalize().multiply(width));
|
||||
Vector3 roundend = scratchRound.set(rendersegment.diff).normalize().multiply(width).multiply(-1).add(rendersegment.startpoint.point);
|
||||
|
||||
tessellator.addVertexWithUV(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z, 0.5, 0);
|
||||
tessellator.addVertexWithUV(roundend.x - diff1.x, roundend.y - diff1.y, roundend.z - diff1.z, 0, 0);
|
||||
@@ -223,9 +226,9 @@ public class LightningHandler {
|
||||
|
||||
@Override
|
||||
public int compare(Segment o1, Segment o2) {
|
||||
int comp = Integer.valueOf(o1.splitno).compareTo(o2.splitno);
|
||||
int comp = o1.splitno - o2.splitno;
|
||||
if(comp == 0)
|
||||
return Integer.valueOf(o1.segmentno).compareTo(o2.segmentno);
|
||||
return o1.segmentno - o2.segmentno;
|
||||
else return comp;
|
||||
}
|
||||
}
|
||||
@@ -497,4 +500,4 @@ public class LightningHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,9 +51,9 @@ public class MultiblockBlockAccess implements IBlockAccess {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightBrightnessForSkyBlocks(int x, int y, int z, int p_72802_4_) {
|
||||
public int getLightBrightnessForSkyBlocks(int x, int y, int z, int lightValue) {
|
||||
if(hasBlockAccess)
|
||||
return originalBlockAccess.getLightBrightnessForSkyBlocks(x,y,z,p_72802_4_);
|
||||
return originalBlockAccess.getLightBrightnessForSkyBlocks(x, y, z, lightValue);
|
||||
return 15728640;
|
||||
}
|
||||
|
||||
|
||||
+39
-33
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -25,7 +26,6 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -34,16 +34,18 @@ import vazkii.botania.api.lexicon.ILexicon;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings.EntryData;
|
||||
import vazkii.botania.api.mana.IManaTooltipDisplay;
|
||||
import vazkii.botania.api.mana.ITieredManaTooltipDisplay;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.item.ItemLexicon;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.equipment.tool.terrasteel.ItemTerraPick;
|
||||
import vazkii.botania.common.lib.LibObfuscation;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import vazkii.botania.utils.ReflectionUtils;
|
||||
|
||||
public final class TooltipAdditionDisplayHandler {
|
||||
|
||||
private static final Field THE_SLOT = ReflectionUtils.findField(GuiContainer.class, LibObfuscation.THE_SLOT);
|
||||
|
||||
private static float lexiconLookupTime = 0F;
|
||||
|
||||
public static void render() {
|
||||
@@ -51,7 +53,7 @@ public final class TooltipAdditionDisplayHandler {
|
||||
GuiScreen gui = mc.currentScreen;
|
||||
if(gui != null && gui instanceof GuiContainer && mc.thePlayer != null && mc.thePlayer.inventory.getItemStack() == null) {
|
||||
GuiContainer container = (GuiContainer) gui;
|
||||
Slot slot = ReflectionHelper.getPrivateValue(GuiContainer.class, container, LibObfuscation.THE_SLOT);
|
||||
Slot slot = (Slot) ReflectionUtils.getObject(THE_SLOT, container);
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
if(stack != null) {
|
||||
@@ -83,10 +85,10 @@ public final class TooltipAdditionDisplayHandler {
|
||||
if(offscreen)
|
||||
offx = -13 - width;
|
||||
|
||||
if(stack.getItem() instanceof ItemTerraPick)
|
||||
drawTerraPick(stack, mouseX, mouseY, offx, offy, width, height, font);
|
||||
else if(stack.getItem() instanceof IManaTooltipDisplay)
|
||||
drawManaBar(stack, (IManaTooltipDisplay) stack.getItem(), mouseX, mouseY, offx, offy, width, height);
|
||||
if(stack.getItem() instanceof ITieredManaTooltipDisplay tieredItem)
|
||||
drawTieredManaBar(stack, tieredItem, mouseX, mouseY, offx, offy, width, height, font);
|
||||
else if(stack.getItem() instanceof IManaTooltipDisplay manaItem)
|
||||
drawManaBar(stack, manaItem, mouseX, mouseY, offx, offy, width, height);
|
||||
|
||||
EntryData data = LexiconRecipeMappings.getDataForStack(stack);
|
||||
if(data != null) {
|
||||
@@ -169,33 +171,37 @@ public final class TooltipAdditionDisplayHandler {
|
||||
} else lexiconLookupTime = 0F;
|
||||
}
|
||||
|
||||
private static void drawTerraPick(ItemStack stack, int mouseX, int mouseY, int offx, int offy, int width, int height, FontRenderer font) {
|
||||
int level = ItemTerraPick.getLevel(stack);
|
||||
int max = ItemTerraPick.LEVELS[Math.min(ItemTerraPick.LEVELS.length - 1, level + 1)];
|
||||
boolean ss = level >= ItemTerraPick.LEVELS.length - 1;
|
||||
int curr = ItemTerraPick.getMana_(stack);
|
||||
float percent = level == 0 ? 0F : (float) curr / (float) max;
|
||||
int rainbowWidth = Math.min(width - (ss ? 0 : 1), (int) (width * percent));
|
||||
float huePer = width == 0 ? 0F : 1F / width;
|
||||
float hueOff = (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.01F;
|
||||
private static void drawTieredManaBar(ItemStack stack, ITieredManaTooltipDisplay item, int mouseX, int mouseY, int offx, int offy, int width, int height, FontRenderer font) {
|
||||
float percent = item.getManaFractionForDisplay(stack);
|
||||
int manaBarWidth = Math.min(width - (percent == 1 ? 0 : 1), (int) (width * percent));
|
||||
float huePer = width == 0 ? 0F : 1F / width;
|
||||
float hueOff = (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.01F;
|
||||
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
Gui.drawRect(mouseX + offx - 1, mouseY - offy - height - 1, mouseX + offx + width + 1, mouseY - offy, 0xFF000000);
|
||||
for(int i = 0; i < rainbowWidth; i++)
|
||||
Gui.drawRect(mouseX + offx + i, mouseY - offy - height, mouseX + offx + i + 1, mouseY - offy, Color.HSBtoRGB(hueOff + huePer * i, 1F, 1F));
|
||||
Gui.drawRect(mouseX + offx + rainbowWidth, mouseY - offy - height, mouseX + offx + width, mouseY - offy, 0xFF555555);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
Gui.drawRect(mouseX + offx - 1, mouseY - offy - height - 1, mouseX + offx + width + 1, mouseY - offy, 0xFF000000);
|
||||
if (item.isRainbowEffect(stack)) {
|
||||
for (int i = 0; i < manaBarWidth; i++) {
|
||||
Gui.drawRect(mouseX + offx + i, mouseY - offy - height, mouseX + offx + i + 1, mouseY - offy, Color.HSBtoRGB(hueOff + huePer * i, 1F, 1F));
|
||||
}
|
||||
} else {
|
||||
Gui.drawRect(mouseX + offx, mouseY - offy - height, mouseX + offx + manaBarWidth, mouseY - offy, Color.HSBtoRGB(0.528F, ((float) Math.sin((ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.2) + 1F) * 0.3F + 0.4F, 1F));
|
||||
}
|
||||
Gui.drawRect(mouseX + offx + manaBarWidth, mouseY - offy - height, mouseX + offx + width, mouseY - offy, 0xFF555555);
|
||||
|
||||
String rank = StatCollector.translateToLocal("botania.rank" + level).replaceAll("&", "\u00a7");
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
font.drawStringWithShadow(rank, mouseX + offx, mouseY - offy - 12, 0xFFFFFF);
|
||||
if(!ss) {
|
||||
rank = StatCollector.translateToLocal("botania.rank" + (level + 1)).replaceAll("&", "\u00a7");
|
||||
font.drawStringWithShadow(rank, mouseX + offx + width - font.getStringWidth(rank), mouseY - offy - 12, 0xFFFFFF);
|
||||
}
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
String leftRank = item.getLeftManaLabel(stack).replaceAll("&", "\u00a7");
|
||||
if (!leftRank.isEmpty()) {
|
||||
font.drawStringWithShadow(leftRank, mouseX + offx, mouseY - offy - 12, 0xFFFFFF);
|
||||
}
|
||||
String rightRank = item.getRightManaLabel(stack).replaceAll("&", "\u00a7");
|
||||
if (!rightRank.isEmpty()) {
|
||||
font.drawStringWithShadow(rightRank, mouseX + offx + width - font.getStringWidth(rightRank), mouseY - offy - 12, 0xFFFFFF);
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
private static void drawManaBar(ItemStack stack, IManaTooltipDisplay display, int mouseX, int mouseY, int offx, int offy, int width, int height) {
|
||||
float fraction = display.getManaFractionForDisplay(stack);
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package vazkii.botania.client.core.helper;
|
||||
|
||||
import codechicken.nei.ItemList;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.brew.BrewUtilities;
|
||||
import vazkii.botania.api.brew.IBrewContainer;
|
||||
import vazkii.botania.common.Botania;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public final class BrewHelper {
|
||||
|
||||
public static List<ItemStack> getBrewContainers() {
|
||||
class Cache {
|
||||
private static final List<ItemStack> BREW_CONTAINERS = List.copyOf(scanBrewContainers());
|
||||
}
|
||||
|
||||
return Cache.BREW_CONTAINERS;
|
||||
}
|
||||
|
||||
private static List<ItemStack> scanBrewContainers() {
|
||||
ArrayList<ItemStack> containers = new ArrayList<>();
|
||||
|
||||
if (Botania.neiLoaded) {
|
||||
for (ItemStack item : ItemList.items) {
|
||||
if (item != null && BrewUtilities.isEmptyBrewContainer(item)) {
|
||||
containers.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (containers.isEmpty()) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final Iterable<Item> itemRegistry = Item.itemRegistry;
|
||||
|
||||
ArrayList<ItemStack> potentialContainers = new ArrayList<>();
|
||||
for (Item item : itemRegistry) {
|
||||
if (item instanceof IBrewContainer) {
|
||||
item.getSubItems(item, item.getCreativeTab(), potentialContainers);
|
||||
|
||||
for (ItemStack maybeContainer : potentialContainers) {
|
||||
if (maybeContainer != null && BrewUtilities.isEmptyBrewContainer(maybeContainer)) {
|
||||
containers.add(maybeContainer);
|
||||
}
|
||||
}
|
||||
|
||||
potentialContainers.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return containers;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,12 +12,12 @@ package vazkii.botania.client.core.helper;
|
||||
|
||||
public final class FontHelper {
|
||||
|
||||
public static boolean isFormatColor(char par0) {
|
||||
return par0 >= 48 && par0 <= 57 || par0 >= 97 && par0 <= 102 || par0 >= 65 && par0 <= 70;
|
||||
public static boolean isFormatColor(char letter) {
|
||||
return letter >= 48 && letter <= 57 || letter >= 97 && letter <= 102 || letter >= 65 && letter <= 70;
|
||||
}
|
||||
|
||||
public static boolean isFormatSpecial(char par0) {
|
||||
return par0 >= 107 && par0 <= 111 || par0 >= 75 && par0 <= 79 || par0 == 114 || par0 == 82;
|
||||
public static boolean isFormatSpecial(char letter) {
|
||||
return letter >= 107 && letter <= 111 || letter >= 75 && letter <= 79 || letter == 114 || letter == 82;
|
||||
}
|
||||
|
||||
public static String getFormatFromString(String par0Str) {
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -97,15 +98,15 @@ public final class RenderHelper {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
}
|
||||
|
||||
public static void drawGradientRect(int par1, int par2, float z, int par3, int par4, int par5, int par6) {
|
||||
float var7 = (par5 >> 24 & 255) / 255F;
|
||||
float var8 = (par5 >> 16 & 255) / 255F;
|
||||
float var9 = (par5 >> 8 & 255) / 255F;
|
||||
float var10 = (par5 & 255) / 255F;
|
||||
float var11 = (par6 >> 24 & 255) / 255F;
|
||||
float var12 = (par6 >> 16 & 255) / 255F;
|
||||
float var13 = (par6 >> 8 & 255) / 255F;
|
||||
float var14 = (par6 & 255) / 255F;
|
||||
public static void drawGradientRect(int left, int top, float z, int right, int bottom, int topColor, int bottomColor) {
|
||||
float topA = (topColor >> 24 & 255) / 255F;
|
||||
float topR = (topColor >> 16 & 255) / 255F;
|
||||
float topG = (topColor >> 8 & 255) / 255F;
|
||||
float topB = (topColor & 255) / 255F;
|
||||
float bottomA = (bottomColor >> 24 & 255) / 255F;
|
||||
float bottomR = (bottomColor >> 16 & 255) / 255F;
|
||||
float bottomG = (bottomColor >> 8 & 255) / 255F;
|
||||
float bottomB = (bottomColor & 255) / 255F;
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
@@ -113,12 +114,12 @@ public final class RenderHelper {
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
Tessellator var15 = Tessellator.instance;
|
||||
var15.startDrawingQuads();
|
||||
var15.setColorRGBA_F(var8, var9, var10, var7);
|
||||
var15.addVertex(par3, par2, z);
|
||||
var15.addVertex(par1, par2, z);
|
||||
var15.setColorRGBA_F(var12, var13, var14, var11);
|
||||
var15.addVertex(par1, par4, z);
|
||||
var15.addVertex(par3, par4, z);
|
||||
var15.setColorRGBA_F(topR, topG, topB, topA);
|
||||
var15.addVertex(right, top, z);
|
||||
var15.addVertex(left, top, z);
|
||||
var15.setColorRGBA_F(bottomR, bottomG, bottomB, bottomA);
|
||||
var15.addVertex(left, bottom, z);
|
||||
var15.addVertex(right, bottom, z);
|
||||
var15.draw();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
@@ -126,17 +127,17 @@ public final class RenderHelper {
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
public static void drawTexturedModalRect(int par1, int par2, float z, int par3, int par4, int par5, int par6) {
|
||||
drawTexturedModalRect(par1, par2, z, par3, par4, par5, par6, 0.00390625F, 0.00390625F);
|
||||
public static void drawTexturedModalRect(int x, int y, float z, int textureX, int textureY, int width, int height) {
|
||||
drawTexturedModalRect(x, y, z, textureX, textureY, width, height, 0.00390625F, 0.00390625F);
|
||||
}
|
||||
|
||||
public static void drawTexturedModalRect(int par1, int par2, float z, int par3, int par4, int par5, int par6, float f, float f1) {
|
||||
public static void drawTexturedModalRect(int x, int y, float z, int textureX, int textureY, int width, int height, float f, float f1) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(par1 + 0, par2 + par6, z, (par3 + 0) * f, (par4 + par6) * f1);
|
||||
tessellator.addVertexWithUV(par1 + par5, par2 + par6, z, (par3 + par5) * f, (par4 + par6) * f1);
|
||||
tessellator.addVertexWithUV(par1 + par5, par2 + 0, z, (par3 + par5) * f, (par4 + 0) * f1);
|
||||
tessellator.addVertexWithUV(par1 + 0, par2 + 0, z, (par3 + 0) * f, (par4 + 0) * f1);
|
||||
tessellator.addVertexWithUV(x + 0, y + height, z, (textureX + 0) * f, (textureY + height) * f1);
|
||||
tessellator.addVertexWithUV(x + width, y + height, z, (textureX + width) * f, (textureY + height) * f1);
|
||||
tessellator.addVertexWithUV(x + width, y + 0, z, (textureX + width) * f, (textureY + 0) * f1);
|
||||
tessellator.addVertexWithUV(x + 0, y + 0, z, (textureX + 0) * f, (textureY + 0) * f1);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
@@ -249,4 +250,15 @@ public final class RenderHelper {
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
public static void renderIcon(int x, int y, IIcon icon, int width, int height, int brightness) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setBrightness(brightness);
|
||||
tessellator.addVertexWithUV(x, y + height, 0, icon.getMinU(), icon.getMaxV());
|
||||
tessellator.addVertexWithUV(x + width, y + height, 0, icon.getMaxU(), icon.getMaxV());
|
||||
tessellator.addVertexWithUV(x + width, y, 0, icon.getMaxU(), icon.getMinV());
|
||||
tessellator.addVertexWithUV(x, y, 0, icon.getMinU(), icon.getMinV());
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
@@ -162,85 +166,96 @@ public class FXSparkle extends EntityFX {
|
||||
particleGravity = value;
|
||||
}
|
||||
|
||||
protected boolean pushOutOfBlocks(double par1, double par3, double par5) {
|
||||
int var7 = MathHelper.floor_double(par1);
|
||||
int var8 = MathHelper.floor_double(par3);
|
||||
int var9 = MathHelper.floor_double(par5);
|
||||
double var10 = par1 - var7;
|
||||
double var12 = par3 - var8;
|
||||
double var14 = par5 - var9;
|
||||
protected boolean pushOutOfBlocks(double x, double y, double z) {
|
||||
int blockX = MathHelper.floor_double(x);
|
||||
int blockY = MathHelper.floor_double(y);
|
||||
int blockZ = MathHelper.floor_double(z);
|
||||
double dx = x - blockX;
|
||||
double dy = y - blockY;
|
||||
double dz = z - blockZ;
|
||||
|
||||
if (!worldObj.isAirBlock(var7, var8, var9)) {
|
||||
boolean var16 = !worldObj.isBlockNormalCubeDefault(var7 - 1, var8, var9, false);
|
||||
boolean var17 = !worldObj.isBlockNormalCubeDefault(var7 + 1, var8, var9, false);
|
||||
boolean var18 = !worldObj.isBlockNormalCubeDefault(var7, var8 - 1, var9, false);
|
||||
boolean var19 = !worldObj.isBlockNormalCubeDefault(var7, var8 + 1, var9, false);
|
||||
boolean var20 = !worldObj.isBlockNormalCubeDefault(var7, var8, var9 - 1, false);
|
||||
boolean var21 = !worldObj.isBlockNormalCubeDefault(var7, var8, var9 + 1, false);
|
||||
byte var22 = -1;
|
||||
double var23 = 9999.0D;
|
||||
if (!worldObj.isAirBlock(blockX, blockY, blockZ)) {
|
||||
boolean westFree = !worldObj.isBlockNormalCubeDefault(blockX - 1, blockY, blockZ, false);
|
||||
boolean eastFree = !worldObj.isBlockNormalCubeDefault(blockX + 1, blockY, blockZ, false);
|
||||
boolean downFree = !worldObj.isBlockNormalCubeDefault(blockX, blockY - 1, blockZ, false);
|
||||
boolean upFree = !worldObj.isBlockNormalCubeDefault(blockX, blockY + 1, blockZ, false);
|
||||
boolean northFree = !worldObj.isBlockNormalCubeDefault(blockX, blockY, blockZ - 1, false);
|
||||
boolean southFree = !worldObj.isBlockNormalCubeDefault(blockX, blockY, blockZ + 1, false);
|
||||
byte direction = -1;
|
||||
double minDist = 9999.0D;
|
||||
|
||||
if (var16 && var10 < var23) {
|
||||
var23 = var10;
|
||||
var22 = 0;
|
||||
if (westFree && dx < minDist) {
|
||||
minDist = dx;
|
||||
direction = 0;
|
||||
}
|
||||
|
||||
if (var17 && 1.0D - var10 < var23) {
|
||||
var23 = 1.0D - var10;
|
||||
var22 = 1;
|
||||
if (eastFree && (1.0D - dx) < minDist) {
|
||||
minDist = 1.0D - dx;
|
||||
direction = 1;
|
||||
}
|
||||
|
||||
if (var18 && var12 < var23) {
|
||||
var23 = var12;
|
||||
var22 = 2;
|
||||
if (downFree && dy < minDist) {
|
||||
minDist = dy;
|
||||
direction = 2;
|
||||
}
|
||||
|
||||
if (var19 && 1.0D - var12 < var23) {
|
||||
var23 = 1.0D - var12;
|
||||
var22 = 3;
|
||||
if (upFree && (1.0D - dy) < minDist) {
|
||||
minDist = 1.0D - dy;
|
||||
direction = 3;
|
||||
}
|
||||
|
||||
if (var20 && var14 < var23) {
|
||||
var23 = var14;
|
||||
var22 = 4;
|
||||
if (northFree && dz < minDist) {
|
||||
minDist = dz;
|
||||
direction = 4;
|
||||
}
|
||||
|
||||
if (var21 && 1.0D - var14 < var23) {
|
||||
var23 = 1.0D - var14;
|
||||
var22 = 5;
|
||||
if (southFree && (1.0D - dz) < minDist) {
|
||||
minDist = 1.0D - dz;
|
||||
direction = 5;
|
||||
}
|
||||
|
||||
float var25 = rand.nextFloat() * 0.05F + 0.025F;
|
||||
float var26 = (rand.nextFloat() - rand.nextFloat()) * 0.1F;
|
||||
float mainVel = rand.nextFloat() * 0.05F + 0.025F;
|
||||
float sideVel1 = (rand.nextFloat() - rand.nextFloat()) * 0.1F;
|
||||
float sideVel2 = (rand.nextFloat() - rand.nextFloat()) * 0.1F;
|
||||
|
||||
if (var22 == 0) {
|
||||
motionX = -var25;
|
||||
motionY=motionZ=var26;
|
||||
}
|
||||
switch(direction) {
|
||||
case 0 -> {
|
||||
motionX = -mainVel;
|
||||
motionY = sideVel1;
|
||||
motionZ = sideVel2;
|
||||
}
|
||||
|
||||
if (var22 == 1) {
|
||||
motionX = var25;
|
||||
motionY=motionZ=var26;
|
||||
}
|
||||
case 1 -> {
|
||||
motionX = mainVel;
|
||||
motionY = sideVel1;
|
||||
motionZ = sideVel2;
|
||||
}
|
||||
|
||||
if (var22 == 2) {
|
||||
motionY = -var25;
|
||||
motionX=motionZ=var26;
|
||||
}
|
||||
case 2 -> {
|
||||
motionY = -mainVel;
|
||||
motionX = sideVel1;
|
||||
motionZ = sideVel2;
|
||||
}
|
||||
|
||||
if (var22 == 3) {
|
||||
motionY = var25;
|
||||
motionX=motionZ=var26;
|
||||
}
|
||||
case 3 -> {
|
||||
motionY = mainVel;
|
||||
motionX = sideVel1;
|
||||
motionZ = sideVel2;
|
||||
}
|
||||
|
||||
if (var22 == 4) {
|
||||
motionZ = -var25;
|
||||
motionY=motionX=var26;
|
||||
}
|
||||
case 4 -> {
|
||||
motionZ = -mainVel;
|
||||
motionY = sideVel1;
|
||||
motionX = sideVel2;
|
||||
}
|
||||
|
||||
if (var22 == 5) {
|
||||
motionZ = var25;
|
||||
motionY=motionX=var26;
|
||||
case 5 -> {
|
||||
motionZ = mainVel;
|
||||
motionY = sideVel1;
|
||||
motionX = sideVel2;
|
||||
}
|
||||
|
||||
default -> {}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -17,12 +17,12 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SlotLocked extends Slot {
|
||||
|
||||
public SlotLocked(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) {
|
||||
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
|
||||
public SlotLocked(IInventory inventory, int slotIndex, int xPos, int yPos) {
|
||||
super(inventory, slotIndex, xPos, yPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer p_82869_1_) {
|
||||
public boolean canTakeStack(EntityPlayer player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,6 @@ public class GuiFlowerBag extends GuiMagicPlantBag {
|
||||
|
||||
@Override
|
||||
protected String getLocalizedNameKey() {
|
||||
return "item.botania:flowerBag.name";
|
||||
return "botania.gui.flowerBag.title";
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,6 @@ public class GuiShroomBag extends GuiMagicPlantBag {
|
||||
|
||||
@Override
|
||||
protected String getLocalizedNameKey() {
|
||||
return "item.botania:shroomBag.name";
|
||||
return "botania.gui.shroomBag.title";
|
||||
}
|
||||
}
|
||||
@@ -83,9 +83,9 @@ public class ContainerBaubleBox extends Container {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStacksInSlots(ItemStack[] p_75131_1_) {
|
||||
public void putStacksInSlots(ItemStack[] stacks) {
|
||||
baubles.blockEvents = true;
|
||||
super.putStacksInSlots(p_75131_1_);
|
||||
super.putStacksInSlots(stacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -193,15 +193,15 @@ public class GuiLexicon extends GuiScreen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
float time = ClientTickHandler.ticksInGame + par3;
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
float time = ClientTickHandler.ticksInGame + partialTicks;
|
||||
timeDelta = time - lastTime;
|
||||
lastTime = time;
|
||||
partialTicks = par3;
|
||||
this.partialTicks = partialTicks;
|
||||
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
drawNotes(par3);
|
||||
drawNotes(partialTicks);
|
||||
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
@@ -227,7 +227,7 @@ public class GuiLexicon extends GuiScreen {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
drawTexturedModalRect(left - 19, top + 42, 67, 180, 19, 26);
|
||||
if(par1 >= left - 19 && par1 < left && par2 >= top + 62 && par2 < top + 88) {
|
||||
if(mouseX >= left - 19 && mouseX < left && mouseY >= top + 62 && mouseY < top + 88) {
|
||||
mc.renderEngine.bindTexture(textureToff);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
@@ -237,24 +237,24 @@ public class GuiLexicon extends GuiScreen {
|
||||
|
||||
int w = 256;
|
||||
int h = 152;
|
||||
int x = (int) ((ClientTickHandler.ticksInGame + par3) * 6) % (width + w) - w;
|
||||
int y = (int) (top + guiHeight / 2 - h / 4 + Math.sin((ClientTickHandler.ticksInGame + par3) / 6.0) * 40);
|
||||
int x = (int) ((ClientTickHandler.ticksInGame + partialTicks) * 6) % (width + w) - w;
|
||||
int y = (int) (top + guiHeight / 2 - h / 4 + Math.sin((ClientTickHandler.ticksInGame + partialTicks) / 6.0) * 40);
|
||||
|
||||
drawTexturedModalRect(x * 2, y * 2, 0, 0, w, h);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
RenderHelper.renderTooltip(par1, par2, Arrays.asList(EnumChatFormatting.GOLD + "#goldfishchris", EnumChatFormatting.AQUA + "IT SAYS MANUAL"));
|
||||
RenderHelper.renderTooltip(mouseX, mouseY, Arrays.asList(EnumChatFormatting.GOLD + "#goldfishchris", EnumChatFormatting.AQUA + "IT SAYS MANUAL"));
|
||||
}
|
||||
}
|
||||
|
||||
super.drawScreen(par1, par2, par3);
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
|
||||
if(hasTutorialArrow) {
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1F, 1F, 1F, 0.7F + (float) (Math.sin((ClientTickHandler.ticksInGame + par3) * 0.3F) + 1) * 0.15F);
|
||||
GL11.glColor4f(1F, 1F, 1F, 0.7F + (float) (Math.sin((ClientTickHandler.ticksInGame + partialTicks) * 0.3F) + 1) * 0.15F);
|
||||
drawTexturedModalRect(tutorialArrowX, tutorialArrowY, 20, 200, TUTORIAL_ARROW_WIDTH, TUTORIAL_ARROW_HEIGHT);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
@@ -349,20 +349,20 @@ public class GuiLexicon extends GuiScreen {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if(par1GuiButton.id >= BOOKMARK_START) {
|
||||
if(par1GuiButton.id >= BOOKMARK_START + MAX_BOOKMARK_COUNT) {
|
||||
if(par1GuiButton instanceof GuiButtonChallengeInfo)
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
if(button.id >= BOOKMARK_START) {
|
||||
if(button.id >= BOOKMARK_START + MAX_BOOKMARK_COUNT) {
|
||||
if(button instanceof GuiButtonChallengeInfo)
|
||||
mc.displayGuiScreen(new GuiLexiconEntry(LexiconData.challenges, this));
|
||||
else mc.displayGuiScreen(new GuiLexiconHistory());
|
||||
ClientTickHandler.notifyPageChange();
|
||||
} else handleBookmark(par1GuiButton);
|
||||
} else if(par1GuiButton instanceof GuiButtonCategory) {
|
||||
LexiconCategory category = ((GuiButtonCategory) par1GuiButton).getCategory();
|
||||
} else handleBookmark(button);
|
||||
} else if(button instanceof GuiButtonCategory) {
|
||||
LexiconCategory category = ((GuiButtonCategory) button).getCategory();
|
||||
|
||||
mc.displayGuiScreen(new GuiLexiconIndex(category));
|
||||
ClientTickHandler.notifyPageChange();
|
||||
} else switch(par1GuiButton.id) {
|
||||
} else switch(button.id) {
|
||||
case -1 :
|
||||
mc.displayGuiScreen(new GuiBotaniaConfig(this));
|
||||
break;
|
||||
@@ -383,8 +383,8 @@ public class GuiLexicon extends GuiScreen {
|
||||
} else {
|
||||
PersistentVariableHelper.lastBotaniaVersion = LibMisc.VERSION;
|
||||
PersistentVariableHelper.saveSafe();
|
||||
par1GuiButton.visible = false;
|
||||
par1GuiButton.enabled = false;
|
||||
button.visible = false;
|
||||
button.enabled = false;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -394,9 +394,9 @@ public class GuiLexicon extends GuiScreen {
|
||||
}
|
||||
}
|
||||
|
||||
public void handleBookmark(GuiButton par1GuiButton) {
|
||||
public void handleBookmark(GuiButton button) {
|
||||
boolean modified = false;
|
||||
int i = par1GuiButton.id - BOOKMARK_START;
|
||||
int i = button.id - BOOKMARK_START;
|
||||
String key = getNotesKey();
|
||||
if(i == bookmarks.size()) {
|
||||
if(!bookmarkKeys.contains(key)) {
|
||||
@@ -561,15 +561,15 @@ public class GuiLexicon extends GuiScreen {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char par1, int par2) {
|
||||
handleNoteKey(par1, par2);
|
||||
protected void keyTyped(char typedChar, int keyCode) {
|
||||
handleNoteKey(typedChar, keyCode);
|
||||
|
||||
if(!notesEnabled && closeScreenOnInvKey() && mc.gameSettings.keyBindInventory.getKeyCode() == par2) {
|
||||
if(!notesEnabled && closeScreenOnInvKey() && mc.gameSettings.keyBindInventory.getKeyCode() == keyCode) {
|
||||
mc.displayGuiScreen(null);
|
||||
mc.setIngameFocus();
|
||||
}
|
||||
|
||||
if(par2 == KONAMI_CODE[konamiIndex]) {
|
||||
if(keyCode == KONAMI_CODE[konamiIndex]) {
|
||||
konamiIndex++;
|
||||
if(konamiIndex >= KONAMI_CODE.length) {
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147673_a(new ResourceLocation("botania:way")));
|
||||
@@ -577,15 +577,15 @@ public class GuiLexicon extends GuiScreen {
|
||||
}
|
||||
} else konamiIndex = 0;
|
||||
|
||||
super.keyTyped(par1, par2);
|
||||
super.keyTyped(typedChar, keyCode);
|
||||
}
|
||||
|
||||
public void handleNoteKey(char par1, int par2) {
|
||||
public void handleNoteKey(char typedChar, int keyCode) {
|
||||
if(notesEnabled) {
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
boolean changed = false;
|
||||
|
||||
if(par2 == 14 && note.length() > 0) {
|
||||
if(keyCode == 14 && note.length() > 0) {
|
||||
if(isCtrlKeyDown())
|
||||
note = "";
|
||||
else {
|
||||
@@ -596,8 +596,8 @@ public class GuiLexicon extends GuiScreen {
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if((ChatAllowedCharacters.isAllowedCharacter(par1) || par2 == 28) && note.length() < 250) {
|
||||
note += par2 == 28 ? "<br>" : par1;
|
||||
if((ChatAllowedCharacters.isAllowedCharacter(typedChar) || keyCode == 28) && note.length() < 250) {
|
||||
note += keyCode == 28 ? "<br>" : typedChar;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,8 +60,8 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
super.drawScreen(par1, par2, par3);
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
@@ -83,37 +83,37 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char par1, int par2) {
|
||||
if(par2 == 14 && !notesEnabled) // Backspace
|
||||
protected void keyTyped(char typedChar, int keyCode) {
|
||||
if(keyCode == 14 && !notesEnabled) // Backspace
|
||||
back();
|
||||
else if(par2 == 199) { // Home
|
||||
else if(keyCode == 199) { // Home
|
||||
mc.displayGuiScreen(new GuiLexicon());
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}
|
||||
|
||||
super.keyTyped(par1, par2);
|
||||
super.keyTyped(typedChar, keyCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int par1, int par2, int par3) {
|
||||
super.mouseClicked(par1, par2, par3);
|
||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
if(par3 == 1)
|
||||
if(mouseButton == 1)
|
||||
back();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if(par1GuiButton.id >= BOOKMARK_START)
|
||||
super.actionPerformed(par1GuiButton);
|
||||
else if(par1GuiButton.id == 12) {
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
if(button.id >= BOOKMARK_START)
|
||||
super.actionPerformed(button);
|
||||
else if(button.id == 12) {
|
||||
mc.displayGuiScreen(parent);
|
||||
ClientTickHandler.notifyPageChange();
|
||||
} else if(par1GuiButton.id == 13) {
|
||||
} else if(button.id == 13) {
|
||||
challenge.complete = !challenge.complete;
|
||||
setCompleteButtonTitle();
|
||||
PersistentVariableHelper.saveSafe();
|
||||
} else if(par1GuiButton.id == NOTES_BUTTON_ID)
|
||||
} else if(button.id == NOTES_BUTTON_ID)
|
||||
notesEnabled = !notesEnabled;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,8 +54,8 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
super.drawScreen(par1, par2, par3);
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
|
||||
boolean unicode = fontRendererObj.getUnicodeFlag();
|
||||
fontRendererObj.setUnicodeFlag(true);
|
||||
@@ -72,36 +72,36 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char par1, int par2) {
|
||||
if(par2 == 14 && !notesEnabled) // Backspace
|
||||
protected void keyTyped(char typedChar, int keyCode) {
|
||||
if(keyCode == 14 && !notesEnabled) // Backspace
|
||||
back();
|
||||
else if(par2 == 199) { // Home
|
||||
else if(keyCode == 199) { // Home
|
||||
mc.displayGuiScreen(new GuiLexicon());
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}
|
||||
|
||||
super.keyTyped(par1, par2);
|
||||
super.keyTyped(typedChar, keyCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int par1, int par2, int par3) {
|
||||
super.mouseClicked(par1, par2, par3);
|
||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
if(par3 == 1)
|
||||
if(mouseButton == 1)
|
||||
back();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if(par1GuiButton.id >= BOOKMARK_START)
|
||||
super.actionPerformed(par1GuiButton);
|
||||
else if(par1GuiButton.id == 12) {
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
if(button.id >= BOOKMARK_START)
|
||||
super.actionPerformed(button);
|
||||
else if(button.id == 12) {
|
||||
mc.displayGuiScreen(parent);
|
||||
ClientTickHandler.notifyPageChange();
|
||||
} else if(par1GuiButton instanceof GuiButtonChallengeIcon) {
|
||||
GuiButtonChallengeIcon cbutton = (GuiButtonChallengeIcon) par1GuiButton;
|
||||
} else if(button instanceof GuiButtonChallengeIcon) {
|
||||
GuiButtonChallengeIcon cbutton = (GuiButtonChallengeIcon) button;
|
||||
mc.displayGuiScreen(new GuiLexiconChallenge(this, cbutton.challenge));
|
||||
} else if(par1GuiButton.id == NOTES_BUTTON_ID)
|
||||
} else if(button.id == NOTES_BUTTON_ID)
|
||||
notesEnabled = !notesEnabled;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,16 +129,16 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
LexiconPage currentPage = entry.pages.get(page);
|
||||
LexiconPage newPage;
|
||||
|
||||
if(par1GuiButton.id >= BOOKMARK_START)
|
||||
handleBookmark(par1GuiButton);
|
||||
else if(par1GuiButton.id == NOTES_BUTTON_ID)
|
||||
if(button.id >= BOOKMARK_START)
|
||||
handleBookmark(button);
|
||||
else if(button.id == NOTES_BUTTON_ID)
|
||||
notesEnabled = !notesEnabled;
|
||||
else
|
||||
switch(par1GuiButton.id) {
|
||||
switch(button.id) {
|
||||
case 0 :
|
||||
currentPage.onClosed(this);
|
||||
mc.displayGuiScreen(GuiScreen.isShiftKeyDown() ? new GuiLexicon() : parent);
|
||||
@@ -177,7 +177,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
}
|
||||
|
||||
updatePageButtons();
|
||||
currentPage.onActionPerformed(this, par1GuiButton);
|
||||
currentPage.onActionPerformed(this, button);
|
||||
}
|
||||
|
||||
public GuiLexiconEntry setFirstEntry() {
|
||||
@@ -193,11 +193,11 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
super.drawScreen(par1, par2, par3);
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
|
||||
LexiconPage page = entry.pages.get(this.page);
|
||||
page.renderScreen(this, par1, par2);
|
||||
page.renderScreen(this, mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -280,11 +280,11 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int par1, int par2, int par3) {
|
||||
super.mouseClicked(par1, par2, par3);
|
||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
fx = par1;
|
||||
switch(par3) {
|
||||
fx = mouseX;
|
||||
switch(mouseButton) {
|
||||
case 1:
|
||||
back();
|
||||
break;
|
||||
@@ -312,22 +312,22 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char par1, int par2) {
|
||||
handleNoteKey(par1, par2);
|
||||
protected void keyTyped(char typedChar, int keyCode) {
|
||||
handleNoteKey(typedChar, keyCode);
|
||||
|
||||
LexiconPage page = entry.pages.get(this.page);
|
||||
page.onKeyPressed(par1, par2);
|
||||
page.onKeyPressed(typedChar, keyCode);
|
||||
|
||||
if(par2 == 1) {
|
||||
if(keyCode == 1) {
|
||||
mc.displayGuiScreen((GuiScreen)null);
|
||||
mc.setIngameFocus();
|
||||
} else if(par2 == 203 || par2 == 200 || par2 == 201) // Left, Up, Page Up
|
||||
} else if(keyCode == 203 || keyCode == 200 || keyCode == 201) // Left, Up, Page Up
|
||||
prevPage();
|
||||
else if(par2 == 205 || par2 == 208 || par2 == 209) // Right, Down Page Down
|
||||
else if(keyCode == 205 || keyCode == 208 || keyCode == 209) // Right, Down Page Down
|
||||
nextPage();
|
||||
if(par2 == 14 && !notesEnabled) // Backspace
|
||||
if(keyCode == 14 && !notesEnabled) // Backspace
|
||||
back();
|
||||
else if(par2 == 199) { // Home
|
||||
else if(keyCode == 199) { // Home
|
||||
mc.displayGuiScreen(new GuiLexicon());
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}
|
||||
|
||||
@@ -177,8 +177,8 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
super.drawScreen(par1, par2, par3);
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
|
||||
if(!searchField.getText().isEmpty()) {
|
||||
drawBookmark(left + 138, top + guiHeight - 24, " " + searchField.getText(), false);
|
||||
@@ -209,8 +209,8 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
infoTime = Math.max(0, infoTime - timeDelta);
|
||||
|
||||
if(currentButton != null && infoTime == 0) {
|
||||
int x = par1 + 10;
|
||||
int y = par2;
|
||||
int x = mouseX + 10;
|
||||
int y = mouseY;
|
||||
|
||||
x = currentButton.xPosition - 20;
|
||||
y = currentButton.yPosition;
|
||||
@@ -293,13 +293,13 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if(par1GuiButton.id >= BOOKMARK_START)
|
||||
handleBookmark(par1GuiButton);
|
||||
else if(par1GuiButton.id == NOTES_BUTTON_ID)
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
if(button.id >= BOOKMARK_START)
|
||||
handleBookmark(button);
|
||||
else if(button.id == NOTES_BUTTON_ID)
|
||||
notesEnabled = !notesEnabled;
|
||||
else
|
||||
switch(par1GuiButton.id) {
|
||||
switch(button.id) {
|
||||
case 12 :
|
||||
mc.displayGuiScreen(parent);
|
||||
ClientTickHandler.notifyPageChange();
|
||||
@@ -317,10 +317,10 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
ClientTickHandler.notifyPageChange();
|
||||
break;
|
||||
default :
|
||||
if(par1GuiButton instanceof GuiButtonInvisible && ((GuiButtonInvisible) par1GuiButton).dog)
|
||||
((GuiButtonInvisible) par1GuiButton).click();
|
||||
if(button instanceof GuiButtonInvisible && ((GuiButtonInvisible) button).dog)
|
||||
((GuiButtonInvisible) button).click();
|
||||
else {
|
||||
int index = par1GuiButton.id + page * 12;
|
||||
int index = button.id + page * 12;
|
||||
openEntry(index);
|
||||
}
|
||||
}
|
||||
@@ -364,12 +364,12 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int par1, int par2, int par3) {
|
||||
super.mouseClicked(par1, par2, par3);
|
||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
searchField.mouseClicked(par1, par2, par3);
|
||||
fx = par1;
|
||||
switch(par3) {
|
||||
searchField.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
fx = mouseX;
|
||||
switch(mouseButton) {
|
||||
case 1:
|
||||
back();
|
||||
break;
|
||||
@@ -402,27 +402,27 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char par1, int par2) {
|
||||
if(par2 == 203 || par2 == 200 || par2 == 201) // Left, Up, Page Up
|
||||
protected void keyTyped(char typedChar, int keyCode) {
|
||||
if(keyCode == 203 || keyCode == 200 || keyCode == 201) // Left, Up, Page Up
|
||||
prevPage();
|
||||
else if(par2 == 205 || par2 == 208 || par2 == 209) // Right, Down Page Down
|
||||
else if(keyCode == 205 || keyCode == 208 || keyCode == 209) // Right, Down Page Down
|
||||
nextPage();
|
||||
else if(par2 == 14 && !notesEnabled && searchField.getText().isEmpty()) // Backspace
|
||||
else if(keyCode == 14 && !notesEnabled && searchField.getText().isEmpty()) // Backspace
|
||||
back();
|
||||
else if(par2 == 199) { // Home
|
||||
else if(keyCode == 199) { // Home
|
||||
mc.displayGuiScreen(new GuiLexicon());
|
||||
ClientTickHandler.notifyPageChange();
|
||||
} else if(par2 == 28 && entriesToDisplay.size() == 1) // Enter
|
||||
} else if(keyCode == 28 && entriesToDisplay.size() == 1) // Enter
|
||||
openEntry(0);
|
||||
|
||||
if(!notesEnabled) {
|
||||
String search = searchField.getText();
|
||||
searchField.textboxKeyTyped(par1, par2);
|
||||
searchField.textboxKeyTyped(typedChar, keyCode);
|
||||
if(!searchField.getText().equalsIgnoreCase(search))
|
||||
updateAll();
|
||||
}
|
||||
|
||||
super.keyTyped(par1, par2);
|
||||
super.keyTyped(typedChar, keyCode);
|
||||
}
|
||||
|
||||
void back() {
|
||||
|
||||
@@ -29,11 +29,11 @@ public class GuiButtonAchievement extends GuiButtonLexicon {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
field_146123_n = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
mc.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(xPosition, yPosition, k == 2 ? 109 : 98, 191, 11, 11);
|
||||
|
||||
@@ -42,7 +42,7 @@ public class GuiButtonAchievement extends GuiButtonLexicon {
|
||||
|
||||
int tooltipY = (tooltip.size() - 1) * 10;
|
||||
if(k == 2)
|
||||
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
|
||||
RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,24 +23,24 @@ import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
|
||||
public class GuiButtonBack extends GuiButtonLexicon {
|
||||
|
||||
public GuiButtonBack(int par1, int par2, int par3) {
|
||||
super(par1, par2, par3, 18, 9, "");
|
||||
public GuiButtonBack(int id, int xPos, int yPos) {
|
||||
super(id, xPos, yPos, 18, 9, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
if(enabled) {
|
||||
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
field_146123_n = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
mc.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(xPosition, yPosition, 36, k == 2 ? 180 : 189, 18, 9);
|
||||
|
||||
List<String> tooltip = getTooltip();
|
||||
int tooltipY = (tooltip.size() - 1) * 10;
|
||||
if(k == 2)
|
||||
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
|
||||
RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ import net.minecraft.util.StatCollector;
|
||||
|
||||
public class GuiButtonBackWithShift extends GuiButtonBack {
|
||||
|
||||
public GuiButtonBackWithShift(int par1, int par2, int par3) {
|
||||
super(par1, par2, par3);
|
||||
public GuiButtonBackWithShift(int id, int xPos, int yPos) {
|
||||
super(id, xPos, yPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,15 +13,15 @@ public class GuiButtonBookmark extends GuiButtonLexicon {
|
||||
|
||||
GuiLexicon gui;
|
||||
|
||||
public GuiButtonBookmark(int par1, int par2, int par3, GuiLexicon gui, String str) {
|
||||
super(par1, par2, par3, gui.bookmarkWidth(str) + 5, 11, str);
|
||||
public GuiButtonBookmark(int id, int xPos, int yPos, GuiLexicon gui, String text) {
|
||||
super(id, xPos, yPos, gui.bookmarkWidth(text) + 5, 11, text);
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int par2, int par3) {
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
gui.drawBookmark(xPosition, yPosition, displayString, false);
|
||||
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
field_146123_n = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
@@ -35,7 +35,7 @@ public class GuiButtonBookmark extends GuiButtonLexicon {
|
||||
|
||||
int tooltipY = (tooltip.size() + 1) * 5;
|
||||
if(k == 2)
|
||||
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
|
||||
RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -72,8 +72,8 @@ public class GuiButtonCategory extends GuiButtonLexicon {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int mx, int my) {
|
||||
boolean inside = mx >= xPosition && my >= yPosition && mx < xPosition + width && my < yPosition + height;
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
boolean inside = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
|
||||
if(inside)
|
||||
ticksHovered = Math.min(time, ticksHovered + gui.timeDelta);
|
||||
else ticksHovered = Math.max(0F, ticksHovered - gui.timeDelta);
|
||||
|
||||
@@ -34,20 +34,20 @@ public class GuiButtonChallengeIcon extends GuiButtonLexicon {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
field_146123_n = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderItem.getInstance().renderItemIntoGUI(par1Minecraft.fontRenderer, par1Minecraft.renderEngine, challenge.icon, xPosition, yPosition);
|
||||
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, challenge.icon, xPosition, yPosition);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
if(challenge.complete) {
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
par1Minecraft.fontRenderer.drawStringWithShadow("\u2714", xPosition + 10, yPosition + 9, 0x004C00);
|
||||
par1Minecraft.fontRenderer.drawStringWithShadow("\u2714", xPosition + 10, yPosition + 8, 0x0BD20D);
|
||||
mc.fontRenderer.drawStringWithShadow("\u2714", xPosition + 10, yPosition + 9, 0x004C00);
|
||||
mc.fontRenderer.drawStringWithShadow("\u2714", xPosition + 10, yPosition + 8, 0x0BD20D);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class GuiButtonChallengeIcon extends GuiButtonLexicon {
|
||||
|
||||
int tooltipY = (tooltip.size() - 1) * 10;
|
||||
if(k == 2)
|
||||
vazkii.botania.client.core.helper.RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
|
||||
vazkii.botania.client.core.helper.RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,15 +22,15 @@ public class GuiButtonChallengeInfo extends GuiButtonLexicon {
|
||||
|
||||
GuiLexicon gui;
|
||||
|
||||
public GuiButtonChallengeInfo(int par1, int par2, int par3, String str, GuiLexicon gui) {
|
||||
super(par1, par2, par3, gui.bookmarkWidth(str) + 5, 11, str);
|
||||
public GuiButtonChallengeInfo(int id, int xPos, int yPos, String text, GuiLexicon gui) {
|
||||
super(id, xPos, yPos, gui.bookmarkWidth(text) + 5, 11, text);
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int par2, int par3) {
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
gui.drawBookmark(xPosition, yPosition, displayString, false);
|
||||
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
field_146123_n = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
@@ -38,7 +38,7 @@ public class GuiButtonChallengeInfo extends GuiButtonLexicon {
|
||||
|
||||
int tooltipY = (tooltip.size() + 1) * 5;
|
||||
if(k == 2)
|
||||
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
|
||||
RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -29,11 +29,11 @@ public class GuiButtonChallenges extends GuiButtonLexicon {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
field_146123_n = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
mc.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(xPosition, yPosition, k == 2 ? 131 : 120, 180, 11, 11);
|
||||
|
||||
@@ -42,7 +42,7 @@ public class GuiButtonChallenges extends GuiButtonLexicon {
|
||||
|
||||
int tooltipY = (tooltip.size() - 1) * 10;
|
||||
if(k == 2)
|
||||
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
|
||||
RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,14 +34,14 @@ public class GuiButtonDoot extends GuiButtonLexicon {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
field_146123_n = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||
mc.renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
RenderItem.getInstance().renderItemIntoGUI(par1Minecraft.fontRenderer, par1Minecraft.renderEngine, new ItemStack(ModItems.cacophonium), xPosition, yPosition);
|
||||
RenderItem.getInstance().renderItemIntoGUI(par1Minecraft.fontRenderer, par1Minecraft.renderEngine, new ItemStack(Items.fireworks), xPosition + 8, yPosition + 2);
|
||||
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, new ItemStack(ModItems.cacophonium), xPosition, yPosition);
|
||||
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, new ItemStack(Items.fireworks), xPosition + 8, yPosition + 2);
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
|
||||
@@ -23,15 +23,15 @@ public class GuiButtonHistory extends GuiButtonLexicon {
|
||||
|
||||
GuiLexicon gui;
|
||||
|
||||
public GuiButtonHistory(int par1, int par2, int par3, String str, GuiLexicon gui) {
|
||||
super(par1, par2, par3, gui.bookmarkWidth(str) + 5, 11, str);
|
||||
public GuiButtonHistory(int id, int xPos, int yPos, String text, GuiLexicon gui) {
|
||||
super(id, xPos, yPos, gui.bookmarkWidth(text) + 5, 11, text);
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int par2, int par3) {
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
gui.drawBookmark(xPosition, yPosition, displayString, false);
|
||||
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
field_146123_n = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
@@ -40,7 +40,7 @@ public class GuiButtonHistory extends GuiButtonLexicon {
|
||||
|
||||
int tooltipY = (tooltip.size() + 1) * 5;
|
||||
if(k == 2)
|
||||
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
|
||||
RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,8 +39,8 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
|
||||
boolean enableDog = false;
|
||||
double dogPos = 0;
|
||||
|
||||
public GuiButtonInvisible(GuiLexiconIndex gui, int par1, int par2, int par3, int par4, int par5, String par6Str) {
|
||||
super(par1, par2, par3, par4, par5, par6Str);
|
||||
public GuiButtonInvisible(GuiLexiconIndex gui, int id, int xPos, int yPos, int width, int height, String text) {
|
||||
super(id, xPos, yPos, width, height, text);
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
@@ -51,11 +51,11 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
if(enableDog) {
|
||||
dogPos += ClientTickHandler.delta * 10;
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(dogResource);
|
||||
mc.renderEngine.bindTexture(dogResource);
|
||||
float f = 1F / 64F;
|
||||
GL11.glTranslated(dogPos, 0, 0);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
@@ -65,7 +65,7 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
|
||||
GL11.glTranslated(-dogPos, 0, 0);
|
||||
}
|
||||
|
||||
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
field_146123_n = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
boolean showStack = displayStack != null && !displayString.isEmpty();
|
||||
|
||||
@@ -100,16 +100,16 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
|
||||
drawRect(xPosition - 5, yPosition, (int) (xPosition - 5 + timeHover * 24), yPosition + height, alpha << 24 | color);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
|
||||
boolean unicode = par1Minecraft.fontRenderer.getUnicodeFlag();
|
||||
par1Minecraft.fontRenderer.setUnicodeFlag(true);
|
||||
par1Minecraft.fontRenderer.drawString(displayString, xPosition + (showStack ? 7 : 0), yPosition + (height - 8) / 2, 0);
|
||||
par1Minecraft.fontRenderer.setUnicodeFlag(unicode);
|
||||
boolean unicode = mc.fontRenderer.getUnicodeFlag();
|
||||
mc.fontRenderer.setUnicodeFlag(true);
|
||||
mc.fontRenderer.drawString(displayString, xPosition + (showStack ? 7 : 0), yPosition + (height - 8) / 2, 0);
|
||||
mc.fontRenderer.setUnicodeFlag(unicode);
|
||||
|
||||
if(showStack) {
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderItem.getInstance().renderItemIntoGUI(par1Minecraft.fontRenderer, par1Minecraft.renderEngine, displayStack, xPosition * 2 - 6, yPosition * 2 + 4);
|
||||
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, displayStack, xPosition * 2 - 6, yPosition * 2 + 4);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GuiButtonLexicon extends GuiButton {
|
||||
|
||||
public GuiButtonLexicon(int stateName, int id, int p_i1021_3_, int p_i1021_4_, int p_i1021_5_, String p_i1021_6_) {
|
||||
super(stateName, id, p_i1021_3_, p_i1021_4_, p_i1021_5_, p_i1021_6_);
|
||||
public GuiButtonLexicon(int id, int xPos, int yPos, int width, int height, String text) {
|
||||
super(id, xPos, yPos, width, height, text);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -32,11 +32,11 @@ public class GuiButtonNotes extends GuiButtonLexicon {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
field_146123_n = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
mc.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(xPosition, yPosition, k == 2 ? 130 : 120, 191, 10, 11);
|
||||
|
||||
@@ -51,7 +51,7 @@ public class GuiButtonNotes extends GuiButtonLexicon {
|
||||
|
||||
int tooltipY = (tooltip.size() - 1) * 10;
|
||||
if(k == 2)
|
||||
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
|
||||
RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -29,11 +29,11 @@ public class GuiButtonOptions extends GuiButtonLexicon {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
field_146123_n = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
mc.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(xPosition, yPosition, k == 2 ? 109 : 98, 180, 11, 11);
|
||||
|
||||
@@ -43,7 +43,7 @@ public class GuiButtonOptions extends GuiButtonLexicon {
|
||||
|
||||
int tooltipY = (tooltip.size() - 1) * 10;
|
||||
if(k == 2)
|
||||
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
|
||||
RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,23 +24,23 @@ public class GuiButtonPage extends GuiButtonLexicon {
|
||||
|
||||
boolean right;
|
||||
|
||||
public GuiButtonPage(int par1, int par2, int par3, boolean right) {
|
||||
super(par1, par2, par3, 18, 10, "");
|
||||
public GuiButtonPage(int id, int xPos, int yPos, boolean right) {
|
||||
super(id, xPos, yPos, 18, 10, "");
|
||||
this.right = right;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
if(enabled) {
|
||||
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
field_146123_n = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
mc.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(xPosition, yPosition, k == 2 ? 18 : 0, right ? 180 : 190, 18, 10);
|
||||
|
||||
if(k == 2)
|
||||
RenderHelper.renderTooltip(par2, par3, Arrays.asList(StatCollector.translateToLocal(right ? "botaniamisc.nextPage" : "botaniamisc.prevPage")));
|
||||
RenderHelper.renderTooltip(mouseX, mouseY, Arrays.asList(StatCollector.translateToLocal(right ? "botaniamisc.nextPage" : "botaniamisc.prevPage")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,23 +24,23 @@ import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
|
||||
public class GuiButtonShare extends GuiButtonLexicon {
|
||||
|
||||
public GuiButtonShare(int par1, int par2, int par3) {
|
||||
super(par1, par2, par3, 10, 12, "");
|
||||
public GuiButtonShare(int id, int xPos, int yPos) {
|
||||
super(id, xPos, yPos, 10, 12, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
field_146123_n = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
mc.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(xPosition, yPosition, k == 2 ? 10 : 0 , 200, 10, 12);
|
||||
|
||||
List<String> tooltip = getTooltip();
|
||||
int tooltipY = (tooltip.size() - 1) * 10;
|
||||
if(k == 2)
|
||||
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
|
||||
RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
|
||||
}
|
||||
|
||||
public List<String> getTooltip() {
|
||||
|
||||
@@ -31,16 +31,16 @@ public class GuiButtonUpdateWarning extends GuiButtonLexicon {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
if(!visible || !enabled)
|
||||
return;
|
||||
|
||||
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
field_146123_n = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
|
||||
boolean red = k == 2 || ClientTickHandler.ticksInGame % 10 < 5;
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
mc.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(xPosition, yPosition, red ? 153 : 142, 180, 11, 11);
|
||||
|
||||
@@ -54,7 +54,7 @@ public class GuiButtonUpdateWarning extends GuiButtonLexicon {
|
||||
|
||||
int tooltipY = (tooltip.size() - 1) * 10 - 25;
|
||||
if(k == 2)
|
||||
RenderHelper.renderTooltip(par2 - 125, par3 + tooltipY, tooltip);
|
||||
RenderHelper.renderTooltip(mouseX - 125, mouseY + tooltipY, tooltip);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -29,18 +29,18 @@ public class GuiButtonViewOnline extends GuiButtonLexicon {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
field_146123_n = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
mc.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(xPosition, yPosition, k == 2 ? 41 : 30, 200, 11, 11);
|
||||
|
||||
List<String> tooltip = Arrays.asList(EnumChatFormatting.AQUA + StatCollector.translateToLocal("botaniamisc.viewOnline"));
|
||||
int tooltipY = (tooltip.size() - 1) * 10;
|
||||
if(k == 2)
|
||||
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
|
||||
RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,32 +27,30 @@ public class RenderDoubleFlower implements ISimpleBlockRenderingHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int p_147774_2_, int p_147774_3_, int p_147774_4_, Block block, int modelId, RenderBlocks renderer) {
|
||||
BlockDoublePlant p_147774_1_ = (BlockDoublePlant) block;
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
BlockDoublePlant flower = (BlockDoublePlant) block;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setBrightness(p_147774_1_.getMixedBrightnessForBlock(world, p_147774_2_, p_147774_3_, p_147774_4_));
|
||||
tessellator.setBrightness(flower.getMixedBrightnessForBlock(world, x, y, z));
|
||||
tessellator.setColorOpaque_F(1F, 1F, 1F);
|
||||
long j1 = p_147774_2_ * 3129871 ^ p_147774_4_ * 116129781L;
|
||||
j1 = j1 * j1 * 42317861L + j1 * 11L;
|
||||
int i1 = world.getBlockMetadata(p_147774_2_, p_147774_3_, p_147774_4_);
|
||||
boolean flag1 = BlockDoublePlant.func_149887_c(i1);
|
||||
if (flag1)
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
boolean isTopHalf = BlockDoublePlant.func_149887_c(meta);
|
||||
if (isTopHalf)
|
||||
{
|
||||
if (world.getBlock(p_147774_2_, p_147774_3_ - 1, p_147774_4_) != p_147774_1_)
|
||||
if (world.getBlock(x, y - 1, z) != flower)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockDoublePlant.func_149890_d(world.getBlockMetadata(p_147774_2_, p_147774_3_ - 1, p_147774_4_));
|
||||
BlockDoublePlant.func_149890_d(world.getBlockMetadata(x, y - 1, z));
|
||||
}
|
||||
else
|
||||
{
|
||||
BlockDoublePlant.func_149890_d(i1);
|
||||
BlockDoublePlant.func_149890_d(meta);
|
||||
}
|
||||
|
||||
// Only change here, to use xyz rather than side/meta
|
||||
IIcon icon = renderer.getBlockIcon(block, world, p_147774_2_, p_147774_3_, p_147774_4_, 0);
|
||||
RenderSpecialFlower.drawCrossedSquares(world, block, icon, p_147774_2_, p_147774_3_, p_147774_4_, p_147774_2_, p_147774_3_, p_147774_4_, 1F, renderer);
|
||||
IIcon icon = renderer.getBlockIcon(block, world, x, y, z, 0);
|
||||
RenderSpecialFlower.drawCrossedSquares(world, block, icon, x, y, z, x, y, z, 1F, renderer);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -63,17 +63,17 @@ public class RenderPixie extends RenderLiving {
|
||||
ShaderHelper.releaseShader();
|
||||
}
|
||||
|
||||
protected int setPixieBrightness(EntityPixie par1EntityPixie, int par2, float par3) {
|
||||
protected int setPixieBrightness(EntityPixie pixie, int par2, float par3) {
|
||||
if (par2 != 0)
|
||||
return -1;
|
||||
else {
|
||||
bindTexture(getEntityTexture(par1EntityPixie));
|
||||
bindTexture(getEntityTexture(pixie));
|
||||
float f1 = 1.0F;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
|
||||
|
||||
if (par1EntityPixie.isInvisible())
|
||||
if (pixie.isInvisible())
|
||||
GL11.glDepthMask(false);
|
||||
else
|
||||
GL11.glDepthMask(true);
|
||||
@@ -89,7 +89,7 @@ public class RenderPixie extends RenderLiving {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int shouldRenderPass(EntityLivingBase par1EntityLivingBase, int par2, float par3) {
|
||||
return setPixieBrightness((EntityPixie)par1EntityLivingBase, par2, par3);
|
||||
protected int shouldRenderPass(EntityLivingBase entity, int par2, float par3) {
|
||||
return setPixieBrightness((EntityPixie)entity, par2, par3);
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
|
||||
@@ -20,20 +20,21 @@ import net.minecraft.util.IIcon;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.common.block.BlockAlfPortal;
|
||||
import vazkii.botania.common.block.tile.TileAlfPortal;
|
||||
|
||||
public class RenderTileAlfPortal extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
|
||||
TileAlfPortal portal = (TileAlfPortal) tileentity;
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
TileAlfPortal portal = (TileAlfPortal) tileEntity;
|
||||
int meta = portal.getBlockMetadata();
|
||||
if(meta == 0)
|
||||
return;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
GL11.glTranslated(x, y, z);
|
||||
GL11.glTranslatef(-1F, 1F, 0.25F);
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
@@ -41,7 +42,7 @@ public class RenderTileAlfPortal extends TileEntitySpecialRenderer {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
float alpha = (float) Math.min(1F, (Math.sin((ClientTickHandler.ticksInGame + f) / 8D) + 1D) / 7D + 0.6D) * (Math.min(60, portal.ticksOpen) / 60F) * 0.5F;
|
||||
float alpha = (float) Math.min(1F, (Math.sin((ClientTickHandler.ticksInGame + partialTicks) / 8D) + 1D) / 7D + 0.6D) * (Math.min(60, portal.ticksOpen) / 60F) * 0.5F;
|
||||
GL11.glColor4f(1F, 1F, 1F, alpha);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
@@ -53,11 +54,11 @@ public class RenderTileAlfPortal extends TileEntitySpecialRenderer {
|
||||
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
renderIcon(0, 0, BlockAlfPortal.portalTex, 3, 3, 240);
|
||||
RenderHelper.renderIcon(0, 0, BlockAlfPortal.portalTex, 3, 3, 240);
|
||||
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glTranslated(0F, 0F, 0.5F);
|
||||
renderIcon(0, 0, BlockAlfPortal.portalTex, 3, 3, 240);
|
||||
RenderHelper.renderIcon(0, 0, BlockAlfPortal.portalTex, 3, 3, 240);
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
@@ -66,16 +67,4 @@ public class RenderTileAlfPortal extends TileEntitySpecialRenderer {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void renderIcon(int par1, int par2, IIcon par3Icon, int par4, int par5, int brightness) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setBrightness(brightness);
|
||||
tessellator.addVertexWithUV(par1 + 0, par2 + par5, 0, par3Icon.getMinU(), par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV(par1 + par4, par2 + par5, 0, par3Icon.getMaxU(), par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV(par1 + par4, par2 + 0, 0, par3Icon.getMaxU(), par3Icon.getMinV());
|
||||
tessellator.addVertexWithUV(par1 + 0, par2 + 0, 0, par3Icon.getMinU(), par3Icon.getMinV());
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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,18 +51,17 @@ 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;
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float pticks) {
|
||||
TileAltar altar = (TileAltar) tileentity;
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float partialTicks) {
|
||||
TileAltar altar = (TileAltar) tileEntity;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(altar.isMossy ? textureMossy : textures[Math.min(textures.length - 1, forceMeta == -1 ? tileentity.getBlockMetadata() : forceMeta)]);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(altar.isMossy ? textureMossy : textures[Math.min(textures.length - 1, forceMeta == -1 ? tileEntity.getBlockMetadata() : forceMeta)]);
|
||||
|
||||
GL11.glTranslated(d0 + 0.5, d1 + 1.5, d2 + 0.5);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
@@ -93,7 +91,7 @@ public class RenderTileAltar extends TileEntitySpecialRenderer {
|
||||
final float radiusBase = 1.2F;
|
||||
final float radiusMod = 0.1F;
|
||||
|
||||
double ticks = (ClientTickHandler.ticksInGame + pticks) * 0.5;
|
||||
double ticks = (ClientTickHandler.ticksInGame + partialTicks) * 0.5;
|
||||
float offsetPerPetal = 360 / petals;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
@@ -42,13 +42,13 @@ public class RenderTileAvatar extends TileEntitySpecialRenderer {
|
||||
private static final ModelAvatar model = new ModelAvatar();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float pticks) {
|
||||
TileAvatar avatar = (TileAvatar) tileentity;
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
TileAvatar avatar = (TileAvatar) tileEntity;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
int meta = avatar.getWorldObj() != null ? avatar.getBlockMetadata() : 0;
|
||||
|
||||
@@ -32,13 +32,13 @@ public class RenderTileBellows extends TileEntitySpecialRenderer {
|
||||
private static final ModelBellows model = new ModelBellows();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
|
||||
TileBellows bellows = (TileBellows) tileentity;
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
TileBellows bellows = (TileBellows) tileEntity;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
int meta = bellows.getWorldObj() != null ? bellows.getBlockMetadata() : 0;
|
||||
@@ -46,7 +46,7 @@ public class RenderTileBellows extends TileEntitySpecialRenderer {
|
||||
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
GL11.glRotatef(ROTATIONS[Math.max(Math.min(ROTATIONS.length, meta - 2), 0)], 0F, 1F, 0F);
|
||||
model.render(Math.max(0.1F, 1F - (bellows.movePos + bellows.moving * f + 0.1F)));
|
||||
model.render(Math.max(0.1F, 1F - (bellows.movePos + bellows.moving * partialTicks + 0.1F)));
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
@@ -43,24 +43,25 @@ public class RenderTileBrewery extends TileEntitySpecialRenderer {
|
||||
public static boolean rotate = true;
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
|
||||
brewery = (TileBrewery) tileentity;
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
brewery = (TileBrewery) tileEntity;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
GL11.glTranslatef(0.5F, -1.5F, -0.5F);
|
||||
|
||||
double time = ClientTickHandler.ticksInGame + f;
|
||||
double time = ClientTickHandler.ticksInGame + partialTicks;
|
||||
if(!rotate)
|
||||
time = -1;
|
||||
|
||||
model.render(this, time);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
brewery = null;
|
||||
}
|
||||
|
||||
public void renderItemStack(ItemStack stack) {
|
||||
|
||||
@@ -28,15 +28,16 @@ public class RenderTileCocoon extends TileEntitySpecialRenderer {
|
||||
ModelCocoon model = new ModelCocoon();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
|
||||
TileCocoon cocoon = (TileCocoon) tileentity;
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
TileCocoon cocoon = (TileCocoon) tileEntity;
|
||||
|
||||
float rot = 0F;
|
||||
float modval = 60F - (float) cocoon.timePassed / (float) TileCocoon.TOTAL_TIME * 30F;
|
||||
if(cocoon.timePassed % modval < 10) {
|
||||
float mod = (cocoon.timePassed + f) % modval;
|
||||
// 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 + f);
|
||||
rot = (float) Math.sin(v) * (float) Math.log(cocoon.timePassed + partialTicks);
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
@@ -44,7 +45,7 @@ public class RenderTileCocoon extends TileEntitySpecialRenderer {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
GL11.glTranslated(x, y, z);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
GL11.glTranslatef(0.5F, -0.5F - 3F / 16F, -0.5F + 1F / 16F);
|
||||
|
||||
@@ -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,21 +32,18 @@ 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 d0, double d1, double d2, float f) {
|
||||
TileCorporeaCrystalCube cube = (TileCorporeaCrystalCube) tileentity;
|
||||
|
||||
if(entity == null)
|
||||
entity = new EntityItem(cube.getWorldObj(), cube.xCoord, cube.yCoord, cube.zCoord, new ItemStack(Blocks.stone));
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
TileCorporeaCrystalCube cube = (TileCorporeaCrystalCube) tileEntity;
|
||||
|
||||
entity.age = ClientTickHandler.ticksInGame;
|
||||
ItemStack stack = cube.getRequestTarget();
|
||||
entity.setEntityItemStack(stack);
|
||||
|
||||
double time = ClientTickHandler.ticksInGame + f;
|
||||
double worldTicks = tileentity.getWorldObj() == null ? 0 : time;
|
||||
double time = ClientTickHandler.ticksInGame + partialTicks;
|
||||
double worldTicks = tileEntity.getWorldObj() == null ? 0 : time;
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
GL11.glPushMatrix();
|
||||
@@ -55,7 +51,7 @@ public class RenderTileCorporeaCrystalCube extends TileEntitySpecialRenderer {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
GL11.glTranslated(x, y, z);
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
@@ -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, f);
|
||||
RenderManager.instance.entityRenderMap.get(EntityItem.class).doRender(entity, 0, 0, 0, 1F, partialTicks);
|
||||
GL11.glPopMatrix();
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
}
|
||||
|
||||
@@ -29,15 +29,15 @@ public class RenderTileCorporeaIndex extends TileEntitySpecialRenderer {
|
||||
public static boolean move = true;
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partticks) {
|
||||
TileCorporeaIndex index = (TileCorporeaIndex) tile;
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
TileCorporeaIndex index = (TileCorporeaIndex) tileEntity;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y, z + 0.5);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
|
||||
float translation = move ? (float) ((Math.cos((index.ticksWithCloseby + (index.hasCloseby ? partticks : 0)) / 10F) * 0.5 + 0.5) * 0.25) : 0F;
|
||||
float rotation = move ? index.ticks * 2 + partticks : 0F;
|
||||
float translation = move ? (float) ((Math.cos((index.ticksWithCloseby + (index.hasCloseby ? partialTicks : 0)) / 10F) * 0.5 + 0.5) * 0.25) : 0F;
|
||||
float rotation = move ? index.ticks * 2 + partialTicks : 0F;
|
||||
float scale = 0.6F;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
crystal.render(null, 0F, rotation, translation, 0F, 0F, 1F / 16F);
|
||||
@@ -45,8 +45,8 @@ public class RenderTileCorporeaIndex extends TileEntitySpecialRenderer {
|
||||
|
||||
if(index.closeby > 0F) {
|
||||
float starScale = 0.02F;
|
||||
float starRadius = (float) TileCorporeaIndex.RADIUS * index.closeby + (index.closeby == 1F ? 0F : index.hasCloseby ? partticks : -partticks) * 0.2F;
|
||||
double rads = (index.ticksWithCloseby + partticks) * 2 * Math.PI / 180;
|
||||
float starRadius = (float) TileCorporeaIndex.RADIUS * index.closeby + (index.closeby == 1F ? 0F : index.hasCloseby ? partialTicks : -partialTicks) * 0.2F;
|
||||
double rads = (index.ticksWithCloseby + partialTicks) * 2 * Math.PI / 180;
|
||||
double starX = Math.cos(rads) * starRadius;
|
||||
double starZ = Math.sin(rads) * starRadius;
|
||||
int color = 0xFF00FF;
|
||||
|
||||
@@ -12,31 +12,29 @@ 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;
|
||||
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.common.block.mana.BlockEnchanter;
|
||||
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 d0, double d1, double d2, float f) {
|
||||
TileEnchanter enchanter = (TileEnchanter) tileentity;
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
TileEnchanter enchanter = (TileEnchanter) tileEntity;
|
||||
float alphaMod = 0F;
|
||||
|
||||
if(enchanter.stage == 2)
|
||||
@@ -47,20 +45,17 @@ 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, d0, d1, d2, 1F, f);
|
||||
RenderManager.instance.entityRenderMap.get(EntityItem.class).doRender(item, x, y, z, 1F, partialTicks);
|
||||
GL11.glTranslatef(-0.5F, -1.25F, -0.5F);
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
GL11.glRotated(90F, 1F, 0F, 0F);
|
||||
GL11.glTranslatef(-2F, -2F, -0.001F);
|
||||
@@ -69,7 +64,7 @@ public class RenderTileEnchanter extends TileEntitySpecialRenderer {
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
float alpha = (float) ((Math.sin((ClientTickHandler.ticksInGame + f) / 8D) + 1D) / 5D + 0.4D) * alphaMod;
|
||||
float alpha = (float) ((Math.sin((ClientTickHandler.ticksInGame + partialTicks) / 8D) + 1D) / 5D + 0.4D) * alphaMod;
|
||||
|
||||
if(alpha > 0) {
|
||||
if(ShaderHelper.useShaders())
|
||||
@@ -79,7 +74,7 @@ public class RenderTileEnchanter extends TileEntitySpecialRenderer {
|
||||
int lightmapX = light % 65536;
|
||||
int lightmapY = light / 65536;
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
|
||||
GL11.glColor4f(0.6F + (float) ((Math.cos((ClientTickHandler.ticksInGame + f) / 6D) + 1D) / 5D), 0.1F, 0.9F, alpha);
|
||||
GL11.glColor4f(0.6F + (float) ((Math.cos((ClientTickHandler.ticksInGame + partialTicks) / 6D) + 1D) / 5D), 0.1F, 0.9F, alpha);
|
||||
}
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
@@ -97,7 +92,7 @@ public class RenderTileEnchanter extends TileEntitySpecialRenderer {
|
||||
}
|
||||
|
||||
ShaderHelper.useShader(ShaderHelper.enchanterRune);
|
||||
renderIcon(0, 0, BlockEnchanter.overlay, 5, 5, 240);
|
||||
RenderHelper.renderIcon(0, 0, BlockEnchanter.overlay, 5, 5, 240);
|
||||
ShaderHelper.releaseShader();
|
||||
}
|
||||
|
||||
@@ -106,16 +101,4 @@ public class RenderTileEnchanter extends TileEntitySpecialRenderer {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void renderIcon(int par1, int par2, IIcon par3Icon, int par4, int par5, int brightness) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setBrightness(brightness);
|
||||
tessellator.addVertexWithUV(par1 + 0, par2 + par5, 0, par3Icon.getMinU(), par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV(par1 + par4, par2 + par5, 0, par3Icon.getMaxU(), par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV(par1 + par4, par2 + 0, 0, par3Icon.getMaxU(), par3Icon.getMinV());
|
||||
tessellator.addVertexWithUV(par1 + 0, par2 + 0, 0, par3Icon.getMinU(), par3Icon.getMinV());
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,21 +34,21 @@ public class RenderTileFloatingFlower extends TileEntitySpecialRenderer {
|
||||
private static final ModelMiniIsland model = new ModelMiniIsland();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double d0, double d1, double d2, float t) {
|
||||
IFloatingFlower flower = (IFloatingFlower) tile;
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
IFloatingFlower flower = (IFloatingFlower) tileEntity;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
double worldTime = tile.getWorldObj() == null ? 0 : (double) (ClientTickHandler.ticksInGame + t);
|
||||
if(tile.getWorldObj() != null)
|
||||
worldTime += new Random(tile.xCoord ^ tile.yCoord ^ tile.zCoord).nextInt(1000);
|
||||
double worldTime = tileEntity.getWorldObj() == null ? 0 : (double) (ClientTickHandler.ticksInGame + partialTicks);
|
||||
if(tileEntity.getWorldObj() != null)
|
||||
worldTime += new Random(tileEntity.xCoord ^ tileEntity.yCoord ^ tileEntity.zCoord).nextInt(1000);
|
||||
|
||||
GL11.glTranslatef(0.5F, 0F, 0.5F);
|
||||
GL11.glRotatef(-((float) worldTime * 0.5F), 0F, 1F, 0F);
|
||||
GL11.glTranslatef(-0.5F, 0F, -0.5F);
|
||||
|
||||
if(tile.getWorldObj() != null) {
|
||||
if(tileEntity.getWorldObj() != null) {
|
||||
GL11.glTranslatef(0F, (float) Math.sin(worldTime * 0.05F) * 0.1F, 0F);
|
||||
GL11.glRotatef(4F * (float) Math.sin(worldTime * 0.04F), 1F, 0F, 0F);
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ public class RenderTileHourglass extends TileEntitySpecialRenderer {
|
||||
ModelHourglass model = new ModelHourglass();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float ticks) {
|
||||
TileHourglass hourglass = (TileHourglass) tileentity;
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float partialTicks) {
|
||||
TileHourglass hourglass = (TileHourglass) tileEntity;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
@@ -41,11 +41,11 @@ public class RenderTileHourglass extends TileEntitySpecialRenderer {
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
|
||||
int wtime = tileentity.getWorldObj() == null ? 0 : ClientTickHandler.ticksInGame;
|
||||
int wtime = tileEntity.getWorldObj() == null ? 0 : ClientTickHandler.ticksInGame;
|
||||
if(wtime != 0)
|
||||
wtime += new Random(tileentity.xCoord ^ tileentity.yCoord ^ tileentity.zCoord).nextInt(360);
|
||||
wtime += new Random(tileEntity.xCoord ^ tileEntity.yCoord ^ tileEntity.zCoord).nextInt(360);
|
||||
|
||||
float time = wtime == 0 ? 0 : wtime + ticks;
|
||||
float time = wtime == 0 ? 0 : wtime + partialTicks;
|
||||
float x = 0.5F + (float) Math.cos(time * 0.05F) * 0.025F;
|
||||
float y = 0.55F + (float) (Math.sin(time * 0.04F) + 1F) * 0.05F;
|
||||
float z = 0.5F + (float) Math.sin(time * 0.05F) * 0.025F;
|
||||
@@ -57,7 +57,7 @@ public class RenderTileHourglass extends TileEntitySpecialRenderer {
|
||||
|
||||
float rot = hourglass.flip ? 180F : 1F;
|
||||
if(hourglass.flipTicks > 0)
|
||||
rot += (hourglass.flipTicks - ticks) * (180F / 4F);
|
||||
rot += (hourglass.flipTicks - partialTicks) * (180F / 4F);
|
||||
GL11.glRotatef(rot, 0F, 0F, 1F);
|
||||
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
|
||||
@@ -39,8 +39,8 @@ public class RenderTileIncensePlate extends TileEntitySpecialRenderer {
|
||||
ModelIncensePlate model = new ModelIncensePlate();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float ticks) {
|
||||
TileIncensePlate plate = (TileIncensePlate) tileentity;
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
TileIncensePlate plate = (TileIncensePlate) tileEntity;
|
||||
|
||||
int meta = plate.getWorldObj() != null ? plate.getBlockMetadata() : 0;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class RenderTileIncensePlate extends TileEntitySpecialRenderer {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
GL11.glTranslated(x, y, z);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
|
||||
@@ -28,9 +28,9 @@ import vazkii.botania.common.block.BlockLightRelay;
|
||||
public class RenderTileLightRelay extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float pticks) {
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
IIcon iicon = tile.getBlockMetadata() > 0 ? BlockLightRelay.worldIconRed : BlockLightRelay.worldIcon;
|
||||
IIcon iicon = tileEntity.getBlockMetadata() > 0 ? BlockLightRelay.worldIconRed : BlockLightRelay.worldIcon;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y + 0.3, z + 0.5);
|
||||
@@ -39,7 +39,7 @@ public class RenderTileLightRelay extends TileEntitySpecialRenderer {
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.05F);
|
||||
|
||||
double time = ClientTickHandler.ticksInGame + pticks;
|
||||
double time = ClientTickHandler.ticksInGame + partialTicks;
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
|
||||
float scale = 0.75F;
|
||||
|
||||
@@ -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;
|
||||
@@ -30,6 +28,7 @@ import org.lwjgl.opengl.GL12;
|
||||
import vazkii.botania.api.mana.IPoolOverlayProvider;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.core.handler.MultiblockRenderHandler;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.client.model.ModelPool;
|
||||
@@ -43,15 +42,14 @@ 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;
|
||||
public static int forceManaNumber = -1;
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
|
||||
TilePool pool = (TilePool) tileentity;
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
TilePool pool = (TilePool) tileEntity;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
@@ -59,10 +57,10 @@ public class RenderTilePool extends TileEntitySpecialRenderer {
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
float a = MultiblockRenderHandler.rendering ? 0.6F : 1F;
|
||||
GL11.glColor4f(1F, 1F, 1F, a);
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
boolean inf = tileentity.getWorldObj() == null ? forceMeta == 1 : tileentity.getBlockMetadata() == 1;
|
||||
boolean dil = tileentity.getWorldObj() == null ? forceMeta == 2 : tileentity.getBlockMetadata() == 2;
|
||||
boolean fab = tileentity.getWorldObj() == null ? forceMeta == 3 : tileentity.getBlockMetadata() == 3;
|
||||
GL11.glTranslated(x, y, z);
|
||||
boolean inf = tileEntity.getWorldObj() == null ? forceMeta == 1 : tileEntity.getBlockMetadata() == 1;
|
||||
boolean dil = tileEntity.getWorldObj() == null ? forceMeta == 2 : tileEntity.getBlockMetadata() == 2;
|
||||
boolean fab = tileEntity.getWorldObj() == null ? forceMeta == 3 : tileEntity.getBlockMetadata() == 3;
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(inf ? textureInf : dil ? textureDil : texture);
|
||||
|
||||
@@ -70,8 +68,8 @@ public class RenderTilePool extends TileEntitySpecialRenderer {
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
if(fab) {
|
||||
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
|
||||
if(tileentity != null)
|
||||
time += new Random(tileentity.xCoord ^ tileentity.yCoord ^ tileentity.zCoord).nextInt(100000);
|
||||
if(tileEntity != null)
|
||||
time += new Random(tileEntity.xCoord ^ tileEntity.yCoord ^ tileEntity.zCoord).nextInt(100000);
|
||||
|
||||
Color color = Color.getHSBColor(time * 0.005F, 0.6F, 1F);
|
||||
GL11.glColor4ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) 255);
|
||||
@@ -112,12 +110,12 @@ public class RenderTilePool extends TileEntitySpecialRenderer {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glColor4f(1F, 1F, 1F, a * (float) ((Math.sin((ClientTickHandler.ticksInGame + f) / 20.0) + 1) * 0.3 + 0.2));
|
||||
GL11.glColor4f(1F, 1F, 1F, a * (float) ((Math.sin((ClientTickHandler.ticksInGame + partialTicks) / 20.0) + 1) * 0.3 + 0.2));
|
||||
GL11.glTranslatef(-0.5F, -1F - 0.43F, -0.5F);
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
GL11.glScalef(s, s, s);
|
||||
|
||||
renderIcon(0, 0, overlay, 16, 16, 240);
|
||||
RenderHelper.renderIcon(0, 0, overlay, 16, 16, 240);
|
||||
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
@@ -138,7 +136,7 @@ public class RenderTilePool extends TileEntitySpecialRenderer {
|
||||
GL11.glScalef(s, s, s);
|
||||
|
||||
ShaderHelper.useShader(ShaderHelper.manaPool);
|
||||
renderIcon(0, 0, BlockPool.manaIcon, 16, 16, 240);
|
||||
RenderHelper.renderIcon(0, 0, BlockPool.manaIcon, 16, 16, 240);
|
||||
ShaderHelper.releaseShader();
|
||||
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
@@ -151,16 +149,4 @@ public class RenderTilePool extends TileEntitySpecialRenderer {
|
||||
forceMana = false;
|
||||
forceManaNumber = -1;
|
||||
}
|
||||
|
||||
public void renderIcon(int par1, int par2, IIcon par3Icon, int par4, int par5, int brightness) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setBrightness(brightness);
|
||||
tessellator.addVertexWithUV(par1 + 0, par2 + par5, 0, par3Icon.getMinU(), par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV(par1 + par4, par2 + par5, 0, par3Icon.getMaxU(), par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV(par1 + par4, par2 + 0, 0, par3Icon.getMaxU(), par3Icon.getMinV());
|
||||
tessellator.addVertexWithUV(par1 + 0, par2 + 0, 0, par3Icon.getMinU(), par3Icon.getMinV());
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,11 +26,11 @@ import vazkii.botania.common.block.tile.mana.TilePrism;
|
||||
public class RenderTilePrism extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partTicks) {
|
||||
TilePrism prism = (TilePrism) tile;
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
TilePrism prism = (TilePrism) tileEntity;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
float pos = (float) Math.sin((ClientTickHandler.ticksInGame + partTicks) * 0.05F) * 0.5F * (1F - 1F / 16F) - 0.5F;
|
||||
float pos = (float) Math.sin((ClientTickHandler.ticksInGame + partialTicks) * 0.05F) * 0.5F * (1F - 1F / 16F) - 0.5F;
|
||||
|
||||
ItemStack stack = prism.getStackInSlot(0);
|
||||
|
||||
|
||||
@@ -32,13 +32,13 @@ public class RenderTilePump extends TileEntitySpecialRenderer {
|
||||
private static final ModelPump model = new ModelPump();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
|
||||
TilePump pump = (TilePump) tileentity;
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
TilePump pump = (TilePump) tileEntity;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
int meta = pump.getWorldObj() != null ? pump.getBlockMetadata() : 0;
|
||||
@@ -46,7 +46,7 @@ public class RenderTilePump extends TileEntitySpecialRenderer {
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
GL11.glRotatef(ROTATIONS[Math.max(Math.min(ROTATIONS.length - 1, meta - 2), 0)], 0F, 1F, 0F);
|
||||
model.render(Math.max(0F, Math.min(8F, pump.innerRingPos + pump.moving * f)));
|
||||
model.render(Math.max(0F, Math.min(8F, pump.innerRingPos + pump.moving * partialTicks)));
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
@@ -46,7 +46,7 @@ public class RenderTilePylon extends TileEntitySpecialRenderer {
|
||||
public static boolean pink = false;
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float pticks) {
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
if(model == null)
|
||||
model = ConfigHandler.oldPylonModel ? new ModelPylonOld() : new ModelPylon();
|
||||
|
||||
@@ -56,25 +56,25 @@ public class RenderTilePylon extends TileEntitySpecialRenderer {
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
float a = MultiblockRenderHandler.rendering ? 0.6F : 1F;
|
||||
GL11.glColor4f(1F, 1F, 1F, a);
|
||||
if(tileentity.getWorldObj() != null) {
|
||||
green = tileentity.getBlockMetadata() == 1;
|
||||
pink = tileentity.getBlockMetadata() == 2;
|
||||
if(tileEntity.getWorldObj() != null) {
|
||||
green = tileEntity.getBlockMetadata() == 1;
|
||||
pink = tileEntity.getBlockMetadata() == 2;
|
||||
}
|
||||
|
||||
if(ConfigHandler.oldPylonModel)
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(pink ? texturePinkOld : green ? textureGreenOld : textureOld);
|
||||
else Minecraft.getMinecraft().renderEngine.bindTexture(pink ? texturePink : green ? textureGreen : texture);
|
||||
|
||||
double worldTime = tileentity.getWorldObj() == null ? 0 : (double) (ClientTickHandler.ticksInGame + pticks);
|
||||
double worldTime = tileEntity.getWorldObj() == null ? 0 : (double) (ClientTickHandler.ticksInGame + partialTicks);
|
||||
|
||||
if(tileentity != null)
|
||||
worldTime += new Random(tileentity.xCoord ^ tileentity.yCoord ^ tileentity.zCoord).nextInt(360);
|
||||
if(tileEntity != null)
|
||||
worldTime += new Random(tileEntity.xCoord ^ tileEntity.yCoord ^ tileEntity.zCoord).nextInt(360);
|
||||
|
||||
if(ConfigHandler.oldPylonModel) {
|
||||
GL11.glTranslated(d0 + 0.5, d1 + 2.2, d2 + 0.5);
|
||||
GL11.glTranslated(x + 0.5, y + 2.2, z + 0.5);
|
||||
GL11.glScalef(1F, -1.5F, -1F);
|
||||
} else {
|
||||
GL11.glTranslated(d0 + 0.2 + (green ? -0.1 : 0), d1 + 0.05, d2 + 0.8 + (green ? 0.1 : 0));
|
||||
GL11.glTranslated(x + 0.2 + (green ? -0.1 : 0), y + 0.05, z + 0.8 + (green ? 0.1 : 0));
|
||||
float scale = green ? 0.8F : 0.6F;
|
||||
GL11.glScalef(scale, 0.6F, scale);
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ import vazkii.botania.common.block.tile.string.TileRedString;
|
||||
public class RenderTileRedString extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partticks) {
|
||||
TileRedString trs = (TileRedString) tileentity;
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
TileRedString trs = (TileRedString) tileEntity;
|
||||
RedStringRenderer.redStringTiles.add(trs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +39,8 @@ public class RenderTileRuneAltar extends TileEntitySpecialRenderer {
|
||||
RenderBlocks renderBlocks = new RenderBlocks();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partticks) {
|
||||
TileRuneAltar altar = (TileRuneAltar) tileentity;
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
TileRuneAltar altar = (TileRuneAltar) tileEntity;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
@@ -58,7 +58,7 @@ public class RenderTileRuneAltar extends TileEntitySpecialRenderer {
|
||||
for(int i = 0; i < angles.length; i++)
|
||||
angles[i] = totalAngle += anglePer;
|
||||
|
||||
double time = ClientTickHandler.ticksInGame + partticks;
|
||||
double time = ClientTickHandler.ticksInGame + partialTicks;
|
||||
|
||||
for(int i = 0; i < altar.getSizeInventory(); i++) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
@@ -34,8 +34,8 @@ public class RenderTileSkullOverride extends TileEntitySkullRenderer {
|
||||
public static final ModelSkullOverride modelSkull = new ModelSkullOverride();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntitySkull p_147500_1_, double p_147500_2_, double p_147500_4_, double p_147500_6_, float p_147500_8_) {
|
||||
render(p_147500_1_, (float) p_147500_2_, (float) p_147500_4_, (float) p_147500_6_, p_147500_1_.getBlockMetadata() & 7, p_147500_1_.func_145906_b() * 360 / 16.0F, p_147500_1_.func_145904_a(), p_147500_1_.func_152108_a());
|
||||
public void renderTileEntityAt(TileEntitySkull skull, double p_147500_2_, double p_147500_4_, double p_147500_6_, float p_147500_8_) {
|
||||
render(skull, (float) p_147500_2_, (float) p_147500_4_, (float) p_147500_6_, skull.getBlockMetadata() & 7, skull.func_145906_b() * 360 / 16.0F, skull.func_145904_a(), skull.func_152108_a());
|
||||
}
|
||||
|
||||
public void render(TileEntitySkull skull, float par1, float par2, float par3, int par4, float par5, int par6, GameProfile gameProfile) {
|
||||
|
||||
@@ -28,13 +28,13 @@ import vazkii.botania.common.block.tile.TileSparkChanger;
|
||||
public class RenderTileSparkChanger extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float pticks) {
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
GL11.glTranslated(x, y, z);
|
||||
GL11.glRotated(90F, 1F, 0F, 0F);
|
||||
GL11.glTranslatef(0.8F, 0.2F, -0.22F);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
ItemStack stack = ((TileSparkChanger) tileentity).getStackInSlot(0);
|
||||
ItemStack stack = ((TileSparkChanger) tileEntity).getStackInSlot(0);
|
||||
if(stack != null) {
|
||||
GL11.glPushMatrix();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||
|
||||
@@ -27,11 +27,11 @@ public class RenderTileSpawnerClaw extends TileEntitySpecialRenderer {
|
||||
private static final ModelSpawnerClaw model = new ModelSpawnerClaw();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity var1, double d0, double d1, double d2, float var8) {
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
|
||||
|
||||
@@ -47,12 +47,12 @@ public class RenderTileSpreader extends TileEntitySpecialRenderer {
|
||||
private static final ModelSpreader model = new ModelSpreader();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float ticks) {
|
||||
TileSpreader spreader = (TileSpreader) tileentity;
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
TileSpreader spreader = (TileSpreader) tileEntity;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
|
||||
GL11.glRotatef(spreader.rotationX + 90F, 0F, 1F, 0F);
|
||||
@@ -67,7 +67,7 @@ public class RenderTileSpreader extends TileEntitySpecialRenderer {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(r);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
|
||||
double time = ClientTickHandler.ticksInGame + ticks;
|
||||
double time = ClientTickHandler.ticksInGame + partialTicks;
|
||||
|
||||
if(spreader.isULTRA_SPREADER()) {
|
||||
Color color = Color.getHSBColor((float) ((time * 5 + new Random(spreader.xCoord ^ spreader.yCoord ^ spreader.zCoord).nextInt(10000)) % 360) / 360F, 0.4F, 0.9F);
|
||||
@@ -77,7 +77,7 @@ public class RenderTileSpreader extends TileEntitySpecialRenderer {
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
double worldTicks = tileentity.getWorldObj() == null ? 0 : time;
|
||||
double worldTicks = tileEntity.getWorldObj() == null ? 0 : time;
|
||||
GL11.glRotatef((float) worldTicks % 360, 0F, 1F, 0F);
|
||||
GL11.glTranslatef(0F, (float) Math.sin(worldTicks / 20.0) * 0.05F, 0F);
|
||||
model.renderCube();
|
||||
|
||||
@@ -36,7 +36,7 @@ public class RenderTileStarfield extends TileEntitySpecialRenderer {
|
||||
private static final Random field_147527_e = new Random(31100L);
|
||||
FloatBuffer field_147528_b = GLAllocation.createDirectFloatBuffer(16);
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity p_147500_1_, double p_147500_2_, double p_147500_4_, double p_147500_6_, float p_147500_8_) {
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
float f1 = (float)field_147501_a.field_147560_j;
|
||||
float f2 = (float)field_147501_a.field_147561_k;
|
||||
float f3 = (float)field_147501_a.field_147558_l;
|
||||
@@ -66,11 +66,11 @@ public class RenderTileStarfield extends TileEntitySpecialRenderer {
|
||||
f6 = 0.5F;
|
||||
}
|
||||
|
||||
float f8 = (float)-(p_147500_4_ + f4);
|
||||
float f8 = (float)-(y + f4);
|
||||
float f9 = f8 + ActiveRenderInfo.objectY;
|
||||
float f10 = f8 + f5 + ActiveRenderInfo.objectY;
|
||||
float f11 = f9 / f10;
|
||||
f11 += (float)(p_147500_4_ + f4);
|
||||
f11 += (float)(y + f4);
|
||||
GL11.glTranslatef(f1, f11, f3);
|
||||
GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
|
||||
GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
|
||||
@@ -105,10 +105,10 @@ public class RenderTileStarfield extends TileEntitySpecialRenderer {
|
||||
float f13 = color.getBlue() / 255F;
|
||||
|
||||
tessellator.setColorRGBA_F(f11 * f7, f12 * f7, f13 * f7, 1.0F);
|
||||
tessellator.addVertex(p_147500_2_, p_147500_4_ + f4, p_147500_6_);
|
||||
tessellator.addVertex(p_147500_2_, p_147500_4_ + f4, p_147500_6_ + 1.0D);
|
||||
tessellator.addVertex(p_147500_2_ + 1.0D, p_147500_4_ + f4, p_147500_6_ + 1.0D);
|
||||
tessellator.addVertex(p_147500_2_ + 1.0D, p_147500_4_ + f4, p_147500_6_);
|
||||
tessellator.addVertex(x, y + f4, z);
|
||||
tessellator.addVertex(x, y + f4, z + 1.0D);
|
||||
tessellator.addVertex(x + 1.0D, y + f4, z + 1.0D);
|
||||
tessellator.addVertex(x + 1.0D, y + f4, z);
|
||||
tessellator.draw();
|
||||
GL11.glPopMatrix();
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.minecraft.util.IIcon;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.common.block.mana.BlockTerraPlate;
|
||||
import vazkii.botania.common.block.tile.TileTerraPlate;
|
||||
@@ -28,13 +29,13 @@ import vazkii.botania.common.block.tile.TileTerraPlate;
|
||||
public class RenderTileTerraPlate extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
|
||||
TileTerraPlate plate = (TileTerraPlate) tileentity;
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
TileTerraPlate plate = (TileTerraPlate) tileEntity;
|
||||
|
||||
float max = TileTerraPlate.MAX_MANA / 10F;
|
||||
float alphaMod = Math.min(max, plate.getCurrentMana()) / max;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
GL11.glRotated(90F, 1F, 0F, 0F);
|
||||
GL11.glTranslatef(0F, 0F, -3F / 16F - 0.001F);
|
||||
@@ -43,7 +44,7 @@ public class RenderTileTerraPlate extends TileEntitySpecialRenderer {
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
float alpha = (float) ((Math.sin((ClientTickHandler.ticksInGame + f) / 8D) + 1D) / 5D + 0.6D) * alphaMod;
|
||||
float alpha = (float) ((Math.sin((ClientTickHandler.ticksInGame + partialTicks) / 8D) + 1D) / 5D + 0.6D) * alphaMod;
|
||||
if(ShaderHelper.useShaders())
|
||||
GL11.glColor4f(1F, 1F, 1F, alpha);
|
||||
else {
|
||||
@@ -51,13 +52,13 @@ public class RenderTileTerraPlate extends TileEntitySpecialRenderer {
|
||||
int lightmapX = light % 65536;
|
||||
int lightmapY = light / 65536;
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
|
||||
GL11.glColor4f(0.6F + (float) ((Math.cos((ClientTickHandler.ticksInGame + f) / 6D) + 1D) / 5D), 0.1F, 0.9F, alpha);
|
||||
GL11.glColor4f(0.6F + (float) ((Math.cos((ClientTickHandler.ticksInGame + partialTicks) / 6D) + 1D) / 5D), 0.1F, 0.9F, alpha);
|
||||
}
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
|
||||
ShaderHelper.useShader(ShaderHelper.terraPlateRune);
|
||||
renderIcon(0, 0, BlockTerraPlate.overlay, 1, 1, 240);
|
||||
RenderHelper.renderIcon(0, 0, BlockTerraPlate.overlay, 1, 1, 240);
|
||||
ShaderHelper.releaseShader();
|
||||
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
@@ -65,16 +66,4 @@ public class RenderTileTerraPlate extends TileEntitySpecialRenderer {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void renderIcon(int par1, int par2, IIcon par3Icon, int par4, int par5, int brightness) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setBrightness(brightness);
|
||||
tessellator.addVertexWithUV(par1 + 0, par2 + par5, 0, par3Icon.getMinU(), par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV(par1 + par4, par2 + par5, 0, par3Icon.getMaxU(), par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV(par1 + par4, par2 + 0, 0, par3Icon.getMaxU(), par3Icon.getMinV());
|
||||
tessellator.addVertexWithUV(par1 + 0, par2 + 0, 0, par3Icon.getMinU(), par3Icon.getMinV());
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,20 +32,20 @@ public class RenderTileTeruTeruBozu extends TileEntitySpecialRenderer {
|
||||
ModelTeruTeruBozu model = new ModelTeruTeruBozu();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
GL11.glTranslated(x, y, z);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(ClientProxy.dootDoot ? textureHalloween : texture);
|
||||
GL11.glRotatef(180F, 1F, 0F, 0F);
|
||||
double time = Botania.proxy.getWorldElapsedTicks() + f;
|
||||
boolean hasWorld = tileentity.getWorldObj() != null;
|
||||
double time = Botania.proxy.getWorldElapsedTicks() + partialTicks;
|
||||
boolean hasWorld = tileEntity.getWorldObj() != null;
|
||||
if(hasWorld)
|
||||
time += new Random(tileentity.xCoord ^ tileentity.yCoord ^ tileentity.zCoord).nextInt(1000);
|
||||
time += new Random(tileEntity.xCoord ^ tileEntity.yCoord ^ tileEntity.zCoord).nextInt(1000);
|
||||
|
||||
GL11.glTranslatef(0.5F, -1.25F + (hasWorld ? (float) Math.sin(time * 0.01F) * 0.05F : 0F), -0.5F);
|
||||
if(hasWorld) {
|
||||
|
||||
@@ -49,12 +49,12 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer {
|
||||
private static final ModelTinyPotato model = new ModelTinyPotato();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity var1, double d0, double d1, double d2, float var8) {
|
||||
TileTinyPotato potato = (TileTinyPotato) var1;
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
TileTinyPotato potato = (TileTinyPotato) tileEntity;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
mc.renderEngine.bindTexture(ClientProxy.dootDoot ? textureHalloween : texture);
|
||||
@@ -91,7 +91,7 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer {
|
||||
|
||||
float jump = potato.jumpTicks;
|
||||
if(jump > 0)
|
||||
jump -= var8;
|
||||
jump -= partialTicks;
|
||||
|
||||
float up = (float) -Math.abs(Math.sin(jump / 10 * Math.PI)) * 0.2F;
|
||||
float rotZ = (float) Math.sin(jump / 10 * Math.PI) * 2;
|
||||
@@ -251,7 +251,7 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer {
|
||||
GL11.glScalef(1.5F, 1.5F, 1.5F);
|
||||
GL11.glTranslatef(0F, 0.7F, 0F);
|
||||
GL11.glRotatef(90F, 0F, 1F, 0F);
|
||||
ItemFlightTiara.renderHalo(null, var8);
|
||||
ItemFlightTiara.renderHalo(null, partialTicks);
|
||||
} else if(name.equals("nebris")) {
|
||||
mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
GL11.glRotatef(180F, 1F, 0F, 0F);
|
||||
@@ -326,7 +326,7 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer {
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
MinecraftForge.EVENT_BUS.post(new TinyPotatoRenderEvent(potato, potato.name, d0, d1, d2, var8));
|
||||
MinecraftForge.EVENT_BUS.post(new TinyPotatoRenderEvent(potato, potato.name, x, y, z, partialTicks));
|
||||
|
||||
GL11.glRotatef(-rotZ, 0F, 0F, 1F);
|
||||
GL11.glRotatef(-rotY, 0F, 1F, 0F);
|
||||
|
||||
@@ -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
|
||||
|
||||
Loaded 100 of 1281 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user