Compare commits

...
65 Commits
Author SHA1 Message Date
Mikhail 8c5c51e6fa Fix mana spreader entity ID leak (#162) 2026-10-25 10:21:09 +00:00
Ressed 37379acd3d Backport upstream commit to fix desyncs in statement of Elf Portal (#158) 2026-10-25 09:11:37 +01:00
Eldrinn Elantey 3f62d4b8fe Fix Cocoon of Caprice not rendering in inventory and NEI (#160) 2026-10-11 18:48:07 +02:00
slprime 2257f1648c Fix NPE in NEI brewery handler when brew can't fill a container (#159) 2026-10-10 19:04:38 +03:00
micvog cefdfd7ca6 Fix Ring of Far Reach stacking reach on every dimension change (#157) 2026-10-04 03:20:27 -04:00
AlexSocol c802a448e4 Fix identity assignment in TileSpreader (#155) 2026-09-11 06:33:25 +00:00
Jason Mitchell daae5de075 Add back deprecated constructor, mark it as such (#156) 2026-09-10 23:26:22 -07:00
boubou19 abd62c1076 Cache slab unlocalized name (#152) 2026-08-25 10:55:50 +02:00
Caedis 8e709b0190 fix: use renderViewEntity instead of player for rendering (#151) 2026-08-08 00:44:58 -05:00
Ben a16181c480 add null check for explosionsource (#150) 2026-08-04 22:00:33 +02:00
Dream Master 9f9c413b48 update+deps+gradle+bs 2026-08-04 11:32:51 +07:00
boubou19 31eb7b3516 Fix render allocations (#149) 2026-08-03 18:11:04 +00:00
FourIsTheNumber d213b7bf0a Pottable flowers and mushrooms (#146) 2026-08-02 20:15:00 -04:00
boubou19 c168882a48 Cache reflection (#147) 2026-08-02 16:52:34 +02:00
Nikolay S. 073ae658b5 Improve the NEI handler for the Botanical Brewery (#144) 2026-07-26 15:08:12 +00:00
Ranzu 0e88bd8a9c Implement ColorUtils class to NEI handler (#143) 2026-07-16 23:24:11 -04:00
UltraProdigy 9d1709dd74 Delete Botania Contributing.md (#140) 2026-07-04 20:46:27 +02:00
koolkrafter5 ffdce1834c Clean up NEI handlers (#131) 2026-06-04 19:06:36 +02:00
Ranzu 3fa2240e61 Added size parameter to lang file (#137) 2026-05-25 19:15:30 +02:00
Alexdoru ec99a884b6 fix three world leaks in TESR (#136) 2026-05-18 16:47:11 +00:00
Martin Robertz 944aec7441 update+gradle+deps+bs 2026-05-07 19:09:48 +02:00
guneykabelandguneykabel 9d677e7734 Fix Ring of Mantle re-applying Haste every tick (#133)
Co-authored-by: guneykabel <guneykabel@users.noreply.github.com>
2026-05-06 08:09:50 +02:00
UltraProdigy 0852f91ba7 Update dep&bs (#126) 2026-03-07 09:34:46 +00:00
UltraProdigy 38845602a9 Optimize Image & Workflow (#125) 2026-03-07 09:39:25 +01:00
Ranzu 4878e88fce GuiTitles Localization (#124) 2026-02-22 21:38:00 +01:00
fa850857e8 Refactor: tiered tool interface (#103)
Co-authored-by: Marcel Sondaar <noreply@combuster.nl>
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Co-authored-by: Ruling-0 <47913168+Ruling-0@users.noreply.github.com>
2026-02-05 18:50:27 +01:00
YoshyandRuling-0 e0a0b1ec53 fix typos (#120)
Co-authored-by: Ruling-0 <47913168+Ruling-0@users.noreply.github.com>
2026-01-29 21:14:14 +01:00
Martin Robertz d42076af69 update 2026-01-10 00:37:38 +01:00
ALongStringOfNumbers 610dad28b7 Fix crash when no IC2 is installed (#119) 2026-01-08 23:26:55 -06:00
Martin Robertz eb767ebeaa update bs+deps+gradle 2026-01-05 20:40:32 +01:00
ALongStringOfNumbers 1516aa495e Allow more explosion sources to generate mana via Entropinnyum (#117) 2026-01-05 19:07:43 +01:00
Nikolay S. bba06bcf46 Great Renaming 3 - Misc. (#110) 2025-11-17 10:33:05 +01:00
Martin Robertz d407ca2c31 update 2025-11-04 22:59:19 +01:00
koolkrafter5andNikolay S. c0daedcbd8 Backport modern Rosa Arcana behavior (#109)
Co-authored-by: Nikolay S. <nicksitnikov@gmail.com>
2025-11-03 17:03:15 -06:00
Martin Robertz 4ee06de9f0 update 2025-10-09 08:27:38 +02:00
Nikolay S. 506f2200ef Great Renaming, Part 2 - Items (#107) 2025-10-09 07:55:24 +02:00
Martin Robertz 98860ee317 pdate 2025-10-01 21:52:34 +02:00
Nikolay S.andglowredman 5ca552ce88 Great Renaming, Part 1 - Blocks & deobfParams (#106)
Co-authored-by: glowredman <35727266+glowredman@users.noreply.github.com>
2025-10-01 21:46:12 +02:00
Martin Robertz db1ad3a768 update 2025-10-01 17:29:01 +02:00
koolkrafter5 c047644908 Merge #104 to master (#105) 2025-09-29 20:17:26 +02:00
DarkShadow44andMartin Robertz 33be87e896 Fix reach ring (#95)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
2025-09-28 11:59:11 +00:00
Nikolay S.andMartin Robertz 7c42710a1a Activate Generic Injection (#100)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
2025-09-28 13:54:57 +02:00
Martin Robertz e4b5b2c2ff update 2025-09-26 17:50:27 +02:00
ABKQPOandghostflyby 8350bd9dc7 Modify line-breaking method for rendering fonts in PageText (#101)
Co-authored-by: ghostflyby <ghostflyby+git@outlook.com>
2025-09-26 20:09:24 +08:00
Martin Robertz 5dc4882038 update 2025-09-07 19:41:11 +02:00
koolkrafter5 9404223f53 Revert "Prevent overenchanting (#98)" (#99) 2025-09-07 05:19:10 -04:00
Caedis 9157df8e3b Prevent overenchanting (#98) 2025-09-06 12:59:34 -04:00
Martin Robertz 143b8286d8 update 2025-09-03 16:57:01 +02:00
sisyphussy 825758d639 Add Botania Multiblocks to StructureLib (#93) 2025-09-03 15:09:02 +02:00
Martin Robertz f4f7485a12 update 2025-08-28 09:22:54 +02:00
LewisSaber a0d7b4dde8 fix unbreaking not affecting instant repair (#94) 2025-08-27 15:44:43 +02:00
Matthew Bentham d3f4b99d23 Fix WAILA not displaying quartz pillar block name when placed on its side (#97) 2025-08-22 04:07:24 -05:00
boubou19andAlexdoru 96521a399b Restore methods so other addons work again (#92)
Co-authored-by: Alexdoru <57050655+Alexdoru@users.noreply.github.com>
2025-07-22 15:22:13 +00:00
koolkrafter5 c5ceef1a78 Improve Null Checking for Petal Apothecary (#91) 2025-07-20 19:40:03 +02:00
boubou19andAlexdoru c72988e435 Faster load (#89)
Co-authored-by: Alexdoru <57050655+Alexdoru@users.noreply.github.com>
2025-07-17 05:10:15 +02:00
koolkrafter5 26a8bd6a26 Fix achievement text typo (#88) 2025-07-13 05:36:01 +02:00
Martin Robertz 23e4f6760d update 2025-06-08 11:55:28 +02:00
Nikolay S. 72da2272d1 Fix the rest of the lang file mistakes in Botania (#84) 2025-06-06 20:57:18 +00:00
Nikolay S. 36deb60855 Add missing equals sign (#83) 2025-06-06 20:31:18 +00:00
Maya c387a30be8 update 2025-05-25 19:38:30 -06:00
brandynandMaya bcf96ed130 Add configurable F3 Debug (#78)
Co-authored-by: Maya <10861407+serenibyss@users.noreply.github.com>
2025-05-25 19:38:18 -06:00
Martin Robertz 7b767d52c5 update 2025-05-16 18:32:31 +02:00
Caedis e812d33caf Replace Baubles with Baubles Expanded (#81) 2025-05-13 19:09:33 -05:00
Martin Robertz a0ba2f2d6a update 2025-03-04 10:08:44 +01:00
miozune 10f4e05d37 Update build (#76) 2025-03-02 15:54:17 +00:00
1544 changed files with 5905 additions and 4966 deletions

No files matched your search

-33
View File
@@ -1,33 +0,0 @@
#!/usr/bin/env bash
RUNDIR="run"
CRASH="crash-reports"
SERVERLOG="server.log"
if [[ -d $RUNDIR/$CRASH ]]; then
echo "Crash reports detected:"
cat $RUNDIR/$CRASH/crash*.txt
exit 1
fi
if grep --quiet "Fatal errors were detected" $SERVERLOG; then
echo "Fatal errors detected:"
cat server.log
exit 1
fi
if grep --quiet "The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED" $SERVERLOG; then
echo "Server force stopped:"
cat server.log
exit 1
fi
if ! grep --quiet -Po '.+Done \(.+\)\! For help, type "help" or "\?"' $SERVERLOG; then
echo "Server didn't finish startup:"
cat server.log
exit 1
fi
echo "No crash reports detected"
exit 0
+17
View File
@@ -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
+7 -1
View File
@@ -26,7 +26,13 @@ whitelist.json
*.iml
*.ipr
*.iws
src/main/resources/mixins.*.json
src/main/resources/mixins.*([!.]).json
*.bat
*.DS_Store
!gradlew.bat
.factorypath
addon.local.gradle
addon.local.gradle.kts
addon.late.local.gradle
addon.late.local.gradle.kts
layout.json
-40
View File
@@ -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).
+11 -11
View File
@@ -1,19 +1,19 @@
// Add your dependencies here
dependencies {
api('com.github.GTNewHorizons:Baubles:1.0.4:dev')
api('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('com.github.GTNewHorizons:Railcraft:9.16.2:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.1.0-GTNH:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.6.0:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.7.18-GTNH:dev')
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.42:api') {transitive=false}
api('com.github.GTNewHorizons:GTNHLib:0.6.1: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.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')
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.7.18-GTNH:dev')
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.42:dev")
}
+43 -17
View File
@@ -14,7 +14,7 @@ modId = Botania
modGroup = vazkii.botania
# Whether to use modGroup as the maven publishing group.
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
# When false, com.github.GTNewHorizons is used.
useModGroupForPublishing = false
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
@@ -39,13 +39,37 @@ 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 = false
# Enables modern Java syntax support. Valid values:
# - false: No modern syntax, Java 8 only
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
# - modern: Native modern Java bytecode, no downgrading
enableModernJavaSyntax = jvmDowngrader
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
# and should *not* be used in most situations. -1 disables this.
# forceToolchainVersion = -1
# Target JVM version for JVM Downgrader bytecode downgrading.
# Only used when enableModernJavaSyntax = jvmDowngrader
# downgradeTargetVersion = 8
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
# Classes will be available in META-INF/versions/N/ for each version N in this list.
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
# jvmDowngraderMultiReleaseVersions = 21,25
# Specifies how JVM Downgrader API stubs are provided. Options:
# - shade: Shade minimized stubs into the jar
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
# - external: Another dependency provides stubs (no constraint, no warning)
# - (empty): Warning reminding you to configure stubs
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
jvmDowngraderStubsProvider = gtnhlib
# Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
enableGenericInjection = false
enableGenericInjection = true
# Generate a class with a String field for the mod version named as defined below.
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
@@ -55,22 +79,13 @@ generateGradleTokenClass = vazkii.botania.common.Tags
# Name of the token containing the project's current version to generate/replace.
gradleTokenVersion = VERSION
# [DEPRECATED] Mod ID replacement token.
gradleTokenModId =
# [DEPRECATED] Mod name replacement token.
gradleTokenModName =
# [DEPRECATED] Mod Group replacement token.
gradleTokenGroupName =
# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...]).
# Leave these properties empty to skip individual token replacements.
replaceGradleTokenInFile =
# replaceGradleTokenInFile =
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
@@ -96,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!
@@ -151,7 +168,7 @@ modrinthProjectId =
# type can be one of [project, version],
# and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
@@ -172,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.
@@ -201,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
+12
View File
@@ -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
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+5 -9
View File
@@ -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/.
@@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -115,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.
@@ -173,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" )
@@ -206,15 +203,14 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
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
View File
@@ -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
-20
View File
@@ -1,22 +1,2 @@
repositories {
maven {
name 'GTNH Maven'
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
allowInsecureProtocol
}
maven {
name 'ic2'
url 'https://maven.ic2.player.to/'
url 'https://maven2.ic2.player.to/'
metadataSources {
mavenPom()
artifact()
}
}
maven {
url 'https://cursemaven.com'
}
maven {
url 'https://jitpack.io'
}
}
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.31'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.27'
}
@@ -60,8 +60,8 @@ import cpw.mods.fml.common.Loader;
public final class BotaniaAPI {
private static List<LexiconCategory> categories = new ArrayList<>();
private static List<LexiconEntry> allEntries = new ArrayList<>();
private static final List<LexiconCategory> categories = new ArrayList<>();
private static final List<LexiconEntry> allEntries = new ArrayList<>();
public static Map<String, KnowledgeType> knowledgeTypes = new HashMap<>();
@@ -78,11 +78,11 @@ public final class BotaniaAPI {
public static List<RecipeBrew> brewRecipes = new ArrayList<>();
public static List<RecipeManaInfusion> miniFlowerRecipes = new ArrayList<>();
private static BiMap<String, Class<? extends SubTileEntity>> subTiles = HashBiMap.<String, Class<? extends SubTileEntity>> create();
private static Map<Class<? extends SubTileEntity>, SubTileSignature> subTileSignatures = new HashMap<>();
private static final BiMap<String, Class<? extends SubTileEntity>> subTiles = HashBiMap.create();
private static final Map<Class<? extends SubTileEntity>, SubTileSignature> subTileSignatures = new HashMap<>();
public static Set<String> subtilesForCreativeMenu = new LinkedHashSet<>();
public static Map<String, String> subTileMods = new HashMap<>();
public static BiMap<String, String> miniFlowers = HashBiMap.<String, String> create();
public static BiMap<String, String> miniFlowers = HashBiMap.create();
public static Map<String, Integer> oreWeights = new HashMap<>();
public static Map<String, Integer> oreWeightsNether = new HashMap<>();
@@ -108,7 +108,7 @@ public final class BotaniaAPI {
public static KnowledgeType basicKnowledge;
public static KnowledgeType elvenKnowledge;
// This is here for completeness sake, but you shouldn't use it
// This is here for completeness’s sake, but you shouldn't use it
public static KnowledgeType relicKnowledge;
// All of these categories are initialized during botania's PreInit stage.
@@ -290,14 +290,14 @@ public final class BotaniaAPI {
return fallbackBrew;
}
/*
/**
* Registers a Block as disposable using its Ore Dictionary Name.
*/
public static void registerDisposableBlock(String oreDictName) {
disposableBlocks.add(oreDictName);
}
/*
/**
* Registers a Block as semi disposable using its Ore Dictionary Name.
* This means it will not be trashed when sneaking.
*/
@@ -313,7 +313,7 @@ public final class BotaniaAPI {
return paintable;
}
/*
/**
* Blacklists an Entity from being affected by the Rod of the Shaded Mesa.
* Pass in the class for the Entity, e.g. EntityCow.class
*/
@@ -321,7 +321,7 @@ public final class BotaniaAPI {
gravityRodBlacklist.add(entity);
}
/*
/**
* Checks if the provided Entity is contained in the Blacklist.
* Pass in the class for the Entity, e.g. entity.getClass()
*/
@@ -476,7 +476,7 @@ public final class BotaniaAPI {
/**
* Registers a Brew Recipe (for the Botanical Brewery).
* @param brew The brew in to be set in this recipe.
* @inputs The items used in the recipe, no more than 6.
* @param inputs The items used in the recipe, no more than 6.
*/
public static RecipeBrew registerBrewRecipe(Brew brew, Object... inputs) {
RecipeBrew recipe = new RecipeBrew(brew, inputs);
@@ -592,7 +592,7 @@ public final class BotaniaAPI {
* https://gist.github.com/Vazkii/9493322
*/
public static void addOreWeightNether(String ore, int weight) {
if(ore.contains("Nether") && OreDictionary.getOres(ore.replace("Nether", "")).size() == 0)
if(ore.contains("Nether") && OreDictionary.getOres(ore.replace("Nether", "")).isEmpty())
return;
oreWeightsNether.put(ore, weight);
@@ -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);
}
@@ -15,10 +15,15 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import cpw.mods.fml.common.FMLLog;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates;
import org.apache.logging.log4j.Level;
import vazkii.botania.api.lexicon.multiblock.compat.MultiblockCompatRegistry;
import vazkii.botania.api.lexicon.multiblock.component.MultiblockComponent;
import vazkii.botania.common.Botania;
/**
* This class describes a Mutiblock object. It's used to display a
@@ -39,10 +44,14 @@ public class Multiblock {
* coords should be pivoted to the center of the structure.
*/
public void addComponent(MultiblockComponent component) {
if(getComponentForLocation(component.relPos.posX, component.relPos.posY, component.relPos.posZ) != null)
throw new IllegalArgumentException("Location in multiblock already occupied");
ChunkCoordinates pos = component.relPos;
if(getComponentForLocation(pos.posX, pos.posY, pos.posZ) != null) {
MultiblockComponent comp = getComponentForLocation(pos.posX, pos.posY, pos.posZ);
throw new IllegalArgumentException(
"Location in multiblock {x=" + pos.posX + " y=" + pos.posY + " z=" + pos.posZ + "} already occupied by block " + comp.getBlock().getLocalizedName());
}
components.add(component);
changeAxisForNewComponent(component.relPos.posX, component.relPos.posY, component.relPos.posZ);
changeAxisForNewComponent(pos.posX, pos.posY, pos.posZ);
calculateCostForNewComponent(component);
addComponentToLocationCache(component);
}
@@ -138,6 +147,28 @@ public class Multiblock {
return blocks;
}
public <T extends TileEntity> MultiblockSet makeSetRegisterStructure(
Class<T> controllerTileClass, Block controllerBlock, MultiblockComponent... extra
) {
registerStructure(controllerTileClass, controllerBlock, extra);
return makeSet();
}
public <T extends TileEntity> void registerStructure(
Class<T> controllerTileClass, Block controllerBlock, MultiblockComponent... extra
) {
if (Botania.structureLibLoaded) {
try {
MultiblockCompatRegistry.registerMultiblock(
this, controllerTileClass, controllerBlock, extra
);
} catch (Exception e) {
e.printStackTrace();
FMLLog.log(Level.ERROR, "Failed to load a Botania Multiblock into StructureLib.");
}
}
}
/**
* Makes a MultiblockSet from this Multiblock and its rotations using
* createRotations().
@@ -176,7 +207,7 @@ public class Multiblock {
pos.posX,
pos.posY,
pos.posZ
), comp);
), comp);
}
/**
@@ -0,0 +1,228 @@
package vazkii.botania.api.lexicon.multiblock.compat;
import com.gtnewhorizon.structurelib.alignment.constructable.IMultiblockInfoContainer;
import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureUtility;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates;
import vazkii.botania.api.lexicon.multiblock.Multiblock;
import vazkii.botania.api.lexicon.multiblock.component.MultiblockComponent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Only gets loaded if StructureLib is present inside the Modpack
*/
public class MultiblockCompatRegistry {
public static <T extends TileEntity> void registerMultiblock(
Multiblock mb, Class<T> controllerTileClass,
Block controllerBlock,
MultiblockComponent... extra
) {
List<MultiblockComponent> components = mb.getComponents();
if (extra.length != 0) {
components = new ArrayList<>(components);
Collections.addAll(components, extra);
}
Map<Integer, RawStructureData> structureDataMap = new HashMap<>();
int min_x = Integer.MAX_VALUE, max_x = Integer.MIN_VALUE;
int min_y = Integer.MAX_VALUE, max_y = Integer.MIN_VALUE;
int min_z = Integer.MAX_VALUE, max_z = Integer.MIN_VALUE;
char ch = 'a';
for (MultiblockComponent component : components) {
int hash = getHash(component.getBlock(), component.getMeta());
ChunkCoordinates pos = component.getRelativePosition();
RawStructureData structureData = structureDataMap.get(hash);
if (structureData == null) {
List<ChunkCoordinates> coordinates = new ArrayList<>();
structureData = new RawStructureData(
coordinates,
component.getBlock(),
component.getMeta(),
ch++
);
structureDataMap.put(hash, structureData);
}
structureData.getPositions().add(pos);
min_x = Math.min(min_x, pos.posX); max_x = Math.max(max_x, pos.posX);
min_y = Math.min(min_y, pos.posY); max_y = Math.max(max_y, pos.posY);
min_z = Math.min(min_z, pos.posZ); max_z = Math.max(max_z, pos.posZ);
}
int x_size = max_x - min_x + 1;
int y_size = max_y - min_y + 1;
int z_size = max_z - min_z + 1;
//Data is saved in [z][y][x] format
String[][] stringData = new String[z_size][y_size];
char[] buffer = new char[x_size];
Arrays.fill(buffer, ' ');
//Since Strings and their content are immutable, this is fine.
String filledWithSpaces = new String(buffer);
for (int z = 0; z < z_size; z++) {
for (int y = 0; y < y_size; y++) {
stringData[z][y] = filledWithSpaces;
}
}
int controller_x = 0, controller_y = 0, controller_z = 0;
StringBuilder builder = new StringBuilder(x_size);
for (RawStructureData data : structureDataMap.values()) {
for (ChunkCoordinates pos : data.getPositions()) {
int x = pos.posX - min_x;
int z = pos.posZ - min_z;
//Data has to get flipped
int y = (stringData[z].length - 1) - (pos.posY - min_y);
if (data.getBlock() == controllerBlock) {
controller_x = x;
controller_y = y;
controller_z = z;
}
String s = stringData[z][y];
builder.append(s);
builder.setCharAt(x, data.getBlockIdentifier());
stringData[z][y] = builder.toString();
builder.setLength(0);
}
}
StructureDefinition.Builder<? super T> structureBuilder = IStructureDefinition.builder()
.addShape("main", stringData);
for (RawStructureData data : structureDataMap.values()) {
structureBuilder.addElement(
data.getBlockIdentifier(),
StructureUtility.ofBlock(
data.getBlock(),
data.getMetadata()
)
);
}
IMultiblockInfoContainer.registerTileClass(
controllerTileClass,
new BotaniaMultiblockInfoContainer<>(
structureBuilder.build(),
controller_x,
controller_y,
controller_z
)
);
}
private static int getHash(Block block, int metadata) {
return block.hashCode() * 31 + metadata;
}
private static class BotaniaMultiblockInfoContainer<T extends TileEntity> implements IMultiblockInfoContainer<T> {
private final IStructureDefinition<? super T> structure;
private final int x_offset, y_offset, z_offset;
public BotaniaMultiblockInfoContainer(
IStructureDefinition<? super T> structure,
int x_offset, int y_offset, int z_offset
) {
this.structure = structure;
this.x_offset = x_offset;
this.y_offset = y_offset;
this.z_offset = z_offset;
}
@Override
public void construct(ItemStack stackSize, boolean hintsOnly, T tileEntity, ExtendedFacing aSide) {
structure.buildOrHints(
tileEntity,
stackSize,
"main",
tileEntity.getWorldObj(),
noSideWay(aSide),
tileEntity.xCoord,
tileEntity.yCoord,
tileEntity.zCoord,
x_offset,
y_offset,
z_offset,
hintsOnly
);
}
@Override
public int survivalConstruct(ItemStack stackSize, int elementBudge, ISurvivalBuildEnvironment env, T tileEntity, ExtendedFacing aSide) {
return structure.survivalBuild(
tileEntity,
stackSize,
"main",
tileEntity.getWorldObj(),
noSideWay(aSide),
tileEntity.xCoord,
tileEntity.yCoord,
tileEntity.zCoord,
x_offset,
y_offset,
z_offset,
elementBudge,
env,
false
);
}
@Override
public String[] getDescription(ItemStack stackSize) {
return new String[0];
}
private static ExtendedFacing noSideWay(ExtendedFacing aSide) {
return aSide.getDirection().offsetY != 0 ? ExtendedFacing.DEFAULT : aSide.getOppositeDirection();
}
}
private static class RawStructureData {
private final List<ChunkCoordinates> positions;
private final char identifier;
private final Block block;
private final int metadata;
public RawStructureData(List<ChunkCoordinates> positions, Block block, int metadata, char identifier) {
this.positions = positions;
this.identifier = identifier;
this.block = block;
this.metadata = metadata;
}
public Block getBlock() {
return block;
}
public int getMetadata() {
return metadata;
}
public List<ChunkCoordinates> getPositions() {
return positions;
}
public char getBlockIdentifier() {
return identifier;
}
}
}
@@ -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);
}
@@ -23,10 +23,9 @@ public final class SparkHelper {
return SparkHelper.getEntitiesAround(ISparkEntity.class, world, x, y, z);
}
public static <T> List<T> getEntitiesAround(Class<? extends T> clazz, World world, double x, double y, double z) {
public static <T> List<T> getEntitiesAround(Class<T> clazz, World world, double x, double y, double z) {
int r = SPARK_SCAN_RANGE;
List<T> entities = world.getEntitiesWithinAABB(clazz, AxisAlignedBB.getBoundingBox(x - r, y - r, z - r, x + r, y + r, z + r));
return entities;
return world.getEntitiesWithinAABB(clazz, AxisAlignedBB.getBoundingBox(x - r, y - r, z - r, x + r, y + r, z + r));
}
}
@@ -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)) {
@@ -35,7 +35,7 @@ public final class DebugHandler {
@SubscribeEvent
public void onDrawDebugText(RenderGameOverlayEvent.Text event) {
World world = Minecraft.getMinecraft().theWorld;
if(Minecraft.getMinecraft().gameSettings.showDebugInfo) {
if(Minecraft.getMinecraft().gameSettings.showDebugInfo && ConfigHandler.showF3Debug) {
event.left.add(null);
String version = LibMisc.VERSION;
if(version.contains("GRADLE"))
@@ -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;
}
@@ -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,23 +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;
if(entity == player) {
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;
}
// Player object might have changed, need to check the UUID.
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,17 +17,17 @@ 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;
}
@Override
public boolean isItemValid(ItemStack p_75214_1_) {
public boolean isItemValid(ItemStack stack) {
return false;
}
@@ -51,15 +51,15 @@ public abstract class ContainerMagicPlantBag extends Container {
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
ItemStack itemstack = null;
Slot slot = (Slot)inventorySlots.get(p_82846_2_);
Slot slot = (Slot)inventorySlots.get(index);
if(slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if(p_82846_2_ < 16) {
if(index < 16) {
if(!mergeItemStack(itemstack1, 16, 52, true))
return null;
} else {
@@ -78,7 +78,7 @@ public abstract class ContainerMagicPlantBag extends Container {
if(itemstack1.stackSize == itemstack.stackSize)
return null;
slot.onPickupFromSlot(p_82846_1_, itemstack1);
slot.onPickupFromSlot(player, itemstack1);
}
return itemstack;
@@ -24,14 +24,14 @@ public abstract class GuiMagicPlantBag extends GuiContainer {
}
@Override
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
String s = StatCollector.translateToLocal(getLocalizedNameKey());
fontRendererObj.drawString(s, xSize / 2 - fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(texture);
int k = (width - xSize) / 2;
@@ -55,7 +55,7 @@ public abstract class GuiMagicPlantBag extends GuiContainer {
}
@Override
protected boolean checkHotbarKeys(int p_146983_1_) {
protected boolean checkHotbarKeys(int keyCode) {
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,22 +83,22 @@ 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
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
ItemStack itemstack = null;
Slot slot = (Slot)inventorySlots.get(p_82846_2_);
Slot slot = (Slot)inventorySlots.get(index);
if(slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
System.out.println(p_82846_2_ + " " + itemstack);
if(p_82846_2_ < 28) {
System.out.println(index + " " + itemstack);
if(index < 28) {
if(!mergeItemStack(itemstack1, 28, 64, true))
return null;
} else {
@@ -113,7 +113,7 @@ public class ContainerBaubleBox extends Container {
if(itemstack1.stackSize == itemstack.stackSize)
return null;
slot.onPickupFromSlot(p_82846_1_, itemstack1);
slot.onPickupFromSlot(player, itemstack1);
}
return itemstack;
@@ -29,12 +29,12 @@ public class GuiBaubleBox extends InventoryEffectRenderer {
}
@Override
protected boolean checkHotbarKeys(int p_146983_1_) {
protected boolean checkHotbarKeys(int keyCode) {
return false;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(texture);
int k = (width - xSize) / 2;
@@ -47,7 +47,7 @@ public class GuiBaubleBox extends InventoryEffectRenderer {
drawTexturedModalRect(k+slot.xDisplayPosition, l+slot.yDisplayPosition, 200, 0, 16, 16);
}
GuiInventory.func_147046_a(guiLeft + 43, guiTop + 61, 20, guiLeft + 43 - p_146976_2_, guiTop + 45 - 30 - p_146976_3_, mc.thePlayer);
GuiInventory.func_147046_a(guiLeft + 43, guiTop + 61, 20, guiLeft + 43 - mouseX, guiTop + 45 - 30 - mouseY, mc.thePlayer);
}
}
@@ -57,7 +57,7 @@ public class ContainerCraftingHalo extends ContainerWorkbench {
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_) {
public boolean canInteractWith(EntityPlayer player) {
return true;
}
}
@@ -28,13 +28,13 @@ public class GuiCraftingHalo extends GuiContainer {
}
@Override
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
fontRendererObj.drawString(I18n.format("container.crafting", new Object[0]), 28, 6, 4210752);
fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(craftingTableGuiTextures);
int k = (width - xSize) / 2;
@@ -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);
}
@@ -284,7 +284,7 @@ public class GuiLexicon extends GuiScreen {
boolean unicode = fontRendererObj.getUnicodeFlag();
fontRendererObj.setUnicodeFlag(true);
PageText.renderText(x + 5, y - 3, 92, 120, 0, noteDisplay);
PageText.renderText(x + 5, y - 3, 92, 0, noteDisplay);
fontRendererObj.setUnicodeFlag(unicode);
}
@@ -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,13 +17,13 @@ import net.minecraft.util.ResourceLocation;
public class GuiButtonLexicon extends GuiButton {
public GuiButtonLexicon(int p_i1021_1_, int p_i1021_2_, int p_i1021_3_, int p_i1021_4_, int p_i1021_5_, String p_i1021_6_) {
super(p_i1021_1_, p_i1021_2_, 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
public void func_146113_a(SoundHandler p_146113_1_) {
p_146113_1_.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("botania:lexiconPage"), 1.0F));
public void func_146113_a(SoundHandler soundHandlerIn) {
soundHandlerIn.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("botania:lexiconPage"), 1.0F));
}
}
@@ -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);
@@ -3,6 +3,7 @@ package vazkii.botania.client.integration.nei.recipe;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
@@ -11,10 +12,15 @@ import net.minecraftforge.oredict.OreDictionary;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.brew.Brew;
import vazkii.botania.api.brew.BrewUtilities;
import vazkii.botania.api.brew.IBrewContainer;
import vazkii.botania.api.brew.IBrewItem;
import vazkii.botania.api.recipe.RecipeBrew;
import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.client.core.helper.BrewHelper;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.block.tile.mana.TilePool;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.item.ModItems;
import codechicken.lib.gui.GuiDraw;
@@ -23,118 +29,149 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
public class RecipeHandlerBrewery extends TemplateRecipeHandler {
public class CachedBreweryRecipe extends CachedRecipe {
public static final String OVERLAY = "botania.brewery";
public List<PositionedStack> inputs = new ArrayList<>();
public PositionedStack output;
public int mana;
public class CachedBreweryRecipe extends CachedRecipe {
public CachedBreweryRecipe(RecipeBrew recipe, ItemStack vial) {
if(recipe == null)
return;
public List<PositionedStack> inputs = new ArrayList<>();
public PositionedStack output;
public int mana;
setIngredients(recipe.getInputs());
ItemStack toVial;
if (vial == null)
toVial = new ItemStack(ModItems.vial);
else
toVial = vial.copy();
toVial.stackSize = 1;
inputs.add(new PositionedStack(toVial, 39, 42));
public CachedBreweryRecipe(RecipeBrew recipe, ItemStack vial) {
if (recipe == null) return;
output = new PositionedStack(recipe.getOutput(toVial), 87, 42);
}
setIngredients(recipe.getInputs());
ItemStack toVial;
if (vial == null) {
toVial = new ItemStack(ModItems.vial);
} else {
toVial = vial.copy();
toVial.stackSize = 1;
}
inputs.add(new PositionedStack(toVial, 39, 42));
public CachedBreweryRecipe(RecipeBrew recipe) {
this(recipe, null);
}
output = new PositionedStack(recipe.getOutput(toVial), 87, 42);
mana = ((IBrewContainer) toVial.getItem()).getManaCost(recipe.getBrew(), toVial);
}
public void setIngredients(List<Object> inputs) {
int left = 96 - inputs.size() * 18 / 2;
public CachedBreweryRecipe(RecipeBrew recipe) {
this(recipe, null);
}
int i = 0;
for (Object o : inputs) {
if (o instanceof String)
this.inputs.add(new PositionedStack(OreDictionary.getOres((String) o), left + i * 18, 6));
else
this.inputs.add(new PositionedStack(o, left + i * 18, 6));
public void setIngredients(List<Object> inputs) {
int left = 96 - inputs.size() * 18 / 2;
i++;
}
}
for (int i = 0; i < inputs.size(); i++) {
Object o = inputs.get(i);
if (o instanceof String oreName) {
o = OreDictionary.getOres(oreName);
}
this.inputs.add(new PositionedStack(o, left + i * 18, 6));
}
}
@Override
public List<PositionedStack> getIngredients() {
return getCycledIngredients(cycleticks / 20, inputs);
}
@Override
public List<PositionedStack> getIngredients() {
return inputs;
}
@Override
public PositionedStack getResult() {
return output;
}
@Override
public PositionedStack getResult() {
return output;
}
}
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("botania.nei.brewery");
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("botania.nei.brewery");
}
@Override
public String getGuiTexture() {
return LibResources.GUI_NEI_BREWERY;
}
@Override
public String getOverlayIdentifier() {
return OVERLAY;
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(87, 25, 15, 14), "botania.brewery"));
}
@Override
public String getGuiTexture() {
return LibResources.GUI_NEI_BREWERY;
}
@Override
public void drawBackground(int recipe) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GuiDraw.changeTexture(getGuiTexture());
GuiDraw.drawTexturedModalRect(0, 0, 0, 0, 166, 65);
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(87, 25, 15, 14), getOverlayIdentifier()));
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if(outputId.equals("botania.brewery"))
for(RecipeBrew recipe : BotaniaAPI.brewRecipes)
arecipes.add(new CachedBreweryRecipe(recipe));
else super.loadCraftingRecipes(outputId, results);
}
@Override
public void drawBackground(int recipe) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
@Override
public void loadCraftingRecipes(ItemStack result) {
if(result.getItem() instanceof IBrewItem)
for(RecipeBrew recipe : BotaniaAPI.brewRecipes) {
if(recipe == null)
continue;
// Arrows
GuiDraw.changeTexture(getGuiTexture());
GuiDraw.drawTexturedModalRect(0, 0, 0, 0, 166, 65);
if(((IBrewItem) result.getItem()).getBrew(result) == recipe.getBrew())
arecipes.add(new CachedBreweryRecipe(recipe));
}
}
// Mana Bar
HUDHandler.renderManaBar(32, 67, 0x0000FF, 0.75F, ((CachedBreweryRecipe) arecipes.get(recipe)).mana, TilePool.MAX_MANA / 10);
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
if(ingredient.getItem() instanceof IBrewContainer) {
for(RecipeBrew recipe : BotaniaAPI.brewRecipes) {
if(recipe == null)
continue;
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getOverlayIdentifier())) {
for (RecipeBrew recipe : BotaniaAPI.brewRecipes) {
arecipes.add(new CachedBreweryRecipe(recipe));
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
if(recipe.getOutput(ingredient) != null)
arecipes.add(new CachedBreweryRecipe(recipe, ingredient));
}
} else for(RecipeBrew recipe : BotaniaAPI.brewRecipes) {
if(recipe == null)
continue;
@Override
public void loadCraftingRecipes(ItemStack result) {
if (!(result.getItem() instanceof IBrewItem brew)) return;
final Brew targetBrew = brew.getBrew(result);
if (targetBrew == null || targetBrew == BotaniaAPI.fallbackBrew) return;
CachedBreweryRecipe crecipe = new CachedBreweryRecipe(recipe);
if(ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.inputs, ingredient))
arecipes.add(crecipe);
}
}
// Find the container(s) that can be filled to produce this result
for (RecipeBrew recipe : BotaniaAPI.brewRecipes) {
if (recipe == null || targetBrew != recipe.getBrew()) continue;
for (ItemStack emptyContainer : BrewHelper.getBrewContainers()) {
final ItemStack filledContainer = recipe.getOutput(emptyContainer);
if (filledContainer != null && result.isItemEqual(filledContainer) && Objects.equals(result.stackTagCompound, filledContainer.stackTagCompound)) {
arecipes.add(new CachedBreweryRecipe(recipe, emptyContainer));
}
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
if (BrewUtilities.isFilledBrew(ingredient)) {
// Filled brews cannot be inserted into a Botanical Brewery.
return;
}
if (ingredient.getItem() instanceof IBrewContainer) {
// Show all possible brews that can fill this empty container
for (RecipeBrew recipe : BotaniaAPI.brewRecipes) {
if (recipe != null && recipe.getOutput(ingredient) != null) {
arecipes.add(new CachedBreweryRecipe(recipe, ingredient));
}
}
} else {
// Show all brew recipes that can use this ingredient
for (RecipeBrew recipe : BotaniaAPI.brewRecipes) {
if (recipe == null) continue;
CachedBreweryRecipe crecipe = new CachedBreweryRecipe(recipe);
if (ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.inputs, ingredient)) {
arecipes.add(crecipe);
}
}
}
}
@Override
public int getRecipeHeight(int recipe) {
return 80;
}
}
@@ -4,8 +4,8 @@ import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import com.google.common.collect.Iterables;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.item.ItemStack;
@@ -26,144 +26,122 @@ import vazkii.botania.common.core.helper.ItemNBTHelper;
public class RecipeHandlerElvenTrade extends TemplateRecipeHandler {
public class CachedElvenTradeRecipe extends CachedRecipe {
public static final String OVERLAY = "botania.elvenTrade";
public List<PositionedStack> inputs = new ArrayList<>();
public PositionedStack output;
public class CachedElvenTradeRecipe extends CachedRecipe {
public CachedElvenTradeRecipe(RecipeElvenTrade recipe) {
if(recipe == null)
return;
public List<PositionedStack> inputs = new ArrayList<>();
public PositionedStack output;
setIngredients(recipe.getInputs());
output = new PositionedStack(recipe.getOutput(), 107, 46);
}
public CachedElvenTradeRecipe(RecipeElvenTrade recipe) {
if (recipe == null) return;
setIngredients(recipe.getInputs());
output = new PositionedStack(recipe.getOutput(), 107, 46);
}
public void setIngredients(List<Object> inputs) {
int i = 0;
for(Object o : inputs) {
if(o instanceof String)
this.inputs.add(new PositionedStack(OreDictionary.getOres((String) o), 60 + i * 18, 6));
else this.inputs.add(new PositionedStack(o, 60 + i * 18, 6));
public void setIngredients(List<Object> inputs) {
for (int i = 0; i < inputs.size(); i++) {
Object o = inputs.get(i);
if (o instanceof String oreName) {
o = OreDictionary.getOres(oreName);
}
this.inputs.add(new PositionedStack(o, 60 + i * 18, 6));
}
}
i++;
}
}
@Override
public List<PositionedStack> getIngredients() {
return inputs;
}
@Override
public List<PositionedStack> getIngredients() {
return getCycledIngredients(cycleticks / 20, inputs);
}
@Override
public PositionedStack getResult() {
return output;
}
}
@Override
public PositionedStack getResult() {
return output;
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("botania.nei.elvenTrade");
}
}
@Override
public String getOverlayIdentifier() {
return OVERLAY;
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("botania.nei.elvenTrade");
}
@Override
public String getGuiTexture() {
return LibResources.GUI_NEI_BLANK;
}
@Override
public String getGuiTexture() {
return LibResources.GUI_NEI_BLANK;
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(35, 30, 48, 48), getOverlayIdentifier()));
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(35, 30, 48, 48), "botania.elvenTrade"));
}
@Override
public void drawBackground(int recipe) {
super.drawBackground(recipe);
GL11.glEnable(GL11.GL_BLEND);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.7F);
GuiDraw.changeTexture(LibResources.GUI_ELVEN_TRADE_OVERLAY);
GuiDraw.drawTexturedModalRect(30, 10, 17, 17, 100, 80);
GL11.glDisable(GL11.GL_BLEND);
GuiDraw.changeTexture(TextureMap.locationBlocksTexture);
RenderItem.getInstance().renderIcon(35, 29, BlockAlfPortal.portalTex, 48, 48);
}
@Override
public int recipiesPerPage() {
return 1;
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getOverlayIdentifier())) {
for (RecipeElvenTrade recipe : filteredElvenTradeRecipes()) {
arecipes.add(new CachedElvenTradeRecipe(recipe));
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void drawBackground(int recipe) {
super.drawBackground(recipe);
GL11.glEnable(GL11.GL_BLEND);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.7F);
GuiDraw.changeTexture(LibResources.GUI_ELVEN_TRADE_OVERLAY);
GuiDraw.drawTexturedModalRect(30, 10, 17, 17, 100, 80);
GL11.glDisable(GL11.GL_BLEND);
GuiDraw.changeTexture(TextureMap.locationBlocksTexture);
RenderItem.getInstance().renderIcon(35, 29, BlockAlfPortal.portalTex, 48, 48);
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for (RecipeElvenTrade recipe : filteredElvenTradeRecipes()) {
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result)) {
arecipes.add(new CachedElvenTradeRecipe(recipe));
}
}
}
private static boolean hasElvenKnowledge() {
/*EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (player != null) {
for (ItemStack stack : player.inventory.mainInventory) {
if (stack != null && stack.getItem() instanceof ILexicon) {
ILexicon lexicon = (ILexicon) stack.getItem();
if (lexicon.isKnowledgeUnlocked(stack, BotaniaAPI.elvenKnowledge)) {
return true;
}
}
}
}
return false;*/
return true;
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for (RecipeElvenTrade recipe : filteredElvenTradeRecipes()) {
CachedElvenTradeRecipe crecipe = new CachedElvenTradeRecipe(recipe);
if (crecipe.contains(crecipe.inputs, ingredient)) {
arecipes.add(crecipe);
}
}
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if(outputId.equals("botania.elvenTrade") && hasElvenKnowledge()) {
if(hasElvenKnowledge()) {
for(RecipeElvenTrade recipe : filteredElvenTradeRecipes()) {
arecipes.add(new CachedElvenTradeRecipe(recipe));
}
}
} else super.loadCraftingRecipes(outputId, results);
}
private Iterable<RecipeElvenTrade> filteredElvenTradeRecipes() {
return Iterables.filter(
BotaniaAPI.elvenTradeRecipes,
recipe -> recipe != null
&& (recipe.getInputs().size() != 1
|| !stackSame(recipe.getOutput(), recipe.getInputs().getFirst())));
}
@Override
public void loadCraftingRecipes(ItemStack result) {
if(hasElvenKnowledge()) {
for(RecipeElvenTrade recipe : filteredElvenTradeRecipes()) {
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result))
arecipes.add(new CachedElvenTradeRecipe(recipe));
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
if(hasElvenKnowledge()) {
for(RecipeElvenTrade recipe : filteredElvenTradeRecipes()) {
CachedElvenTradeRecipe crecipe = new CachedElvenTradeRecipe(recipe);
if(crecipe.contains(crecipe.inputs, ingredient))
arecipes.add(crecipe);
}
}
}
// hide dummy recipes
private List<RecipeElvenTrade> filteredElvenTradeRecipes() {
return BotaniaAPI.elvenTradeRecipes
.stream()
.filter(recipe -> {
if (recipe == null) {
return false;
}
if (recipe.getInputs().size() == 1) {
return !stackSame(recipe.getOutput(), recipe.getInputs().get(0));
}
return true;
})
.collect(Collectors.toList());
}
private boolean stackSame(ItemStack stack, Object obj) {
if (obj instanceof String) {
return OreDictionary.getOres((String) obj).stream().anyMatch(s -> ItemNBTHelper.areStacksSameTypeCraftingWithNBT(stack, s));
} else {
return Arrays.stream(NEIServerUtils.extractRecipeItems(obj)).anyMatch(s -> ItemNBTHelper.areStacksSameTypeCraftingWithNBT(stack, s));
}
}
private boolean stackSame(ItemStack stack, Object obj) {
if (obj instanceof String oreName) {
return Iterables.any(
OreDictionary.getOres(oreName),
s -> ItemNBTHelper.areStacksSameTypeCraftingWithNBT(stack, s)
);
} else {
return Iterables.any(
Arrays.asList(NEIServerUtils.extractRecipeItems(obj)),
s -> ItemNBTHelper.areStacksSameTypeCraftingWithNBT(stack, s)
);
}
}
}
@@ -17,65 +17,70 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
public class RecipeHandlerFloatingFlowers extends TemplateRecipeHandler {
public class CachedFloatingFlowerRecipe extends CachedRecipe {
public class CachedFloatingFlowerRecipe extends CachedRecipe {
public List<PositionedStack> inputs = new ArrayList<>();
public PositionedStack output;
public List<PositionedStack> inputs = new ArrayList<>();
public PositionedStack output;
public CachedFloatingFlowerRecipe(ItemStack floatingFlower, ItemStack specialFlower, ItemStack output) {
inputs.add(new PositionedStack(floatingFlower, 25, 6));
inputs.add(new PositionedStack(specialFlower, 43, 6));
this.output = new PositionedStack(output, 119, 24);
this.output.setMaxSize(1);
}
public CachedFloatingFlowerRecipe(ItemStack floatingFlower, ItemStack specialFlower, ItemStack output) {
inputs.add(new PositionedStack(floatingFlower, 25, 6));
inputs.add(new PositionedStack(specialFlower, 43, 6));
this.output = new PositionedStack(output, 119, 24);
this.output.setMaxSize(1);
}
@Override
public List<PositionedStack> getIngredients() {
return getCycledIngredients(cycleticks / 20, inputs);
}
@Override
public List<PositionedStack> getIngredients() {
return inputs;
}
@Override
public PositionedStack getResult() {
return output;
}
@Override
public PositionedStack getResult() {
return output;
}
}
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("botania.nei.floatingFlowers");
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("botania.nei.floatingFlowers");
public String getOverlayIdentifier() {
return "crafting2x2";
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting"));
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting"));
}
@Override
public String getGuiTexture() {
return "textures/gui/container/crafting_table.png";
}
@Override
public String getGuiTexture() {
return "textures/gui/container/crafting_table.png";
}
@Override
public void loadCraftingRecipes(ItemStack result) {
if(Block.getBlockFromItem(result.getItem()) instanceof BlockFloatingSpecialFlower) {
ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower, 1, OreDictionary.WILDCARD_VALUE);
ItemStack specialFlower = new ItemStack(ModBlocks.specialFlower);
specialFlower.setTagCompound((NBTTagCompound) result.getTagCompound().copy());
@Override
public void loadCraftingRecipes(ItemStack result) {
if (Block.getBlockFromItem(result.getItem()) instanceof BlockFloatingSpecialFlower) {
ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower, 1, OreDictionary.WILDCARD_VALUE);
ItemStack specialFlower = new ItemStack(ModBlocks.specialFlower);
specialFlower.setTagCompound((NBTTagCompound) result.getTagCompound().copy());
arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower, specialFlower, result.copy()));
}
}
arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower, specialFlower, result.copy()));
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
if(Block.getBlockFromItem(ingredient.getItem()) instanceof BlockSpecialFlower) {
ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower, 1, OreDictionary.WILDCARD_VALUE);
ItemStack result = new ItemStack(ModBlocks.floatingSpecialFlower);
result.setTagCompound((NBTTagCompound) ingredient.getTagCompound().copy());
@Override
public void loadUsageRecipes(ItemStack ingredient) {
if (Block.getBlockFromItem(ingredient.getItem()) instanceof BlockSpecialFlower) {
ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower, 1, OreDictionary.WILDCARD_VALUE);
ItemStack result = new ItemStack(ModBlocks.floatingSpecialFlower);
result.setTagCompound((NBTTagCompound) ingredient.getTagCompound().copy());
arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower, ingredient.copy(), result));
}
}
arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower, ingredient.copy(), result));
}
}
}
@@ -2,21 +2,19 @@
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* <p>
* File Created @ [12/12/2015, 23:25:47 (GMT)]
*/
package vazkii.botania.client.integration.nei.recipe;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
@@ -26,129 +24,149 @@ import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.KnowledgeType;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
import vazkii.botania.client.integration.nei.NEIHelper;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.lib.LibColorUtils;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lexicon.page.PageText;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
public class RecipeHandlerLexicaBotania extends TemplateRecipeHandler {
private static final ItemStack LEXICA = new ItemStack(ModItems.lexicon);
public class CachedLexicaBotaniaRecipe extends CachedRecipe {
public class CachedLexicaBotaniaRecipe extends CachedRecipe {
public LexiconEntry entry;
public PositionedStack item;
public List<PositionedStack> otherStacks = new ArrayList<>();
public LexiconEntry entry;
public PositionedStack item;
public CachedLexicaBotaniaRecipe(ItemStack stack, LexiconEntry entry) {
otherStacks.add(new PositionedStack(new ItemStack(ModItems.lexicon), 51, 5));
item = new PositionedStack(stack, 91, 5);
this.entry = entry;
}
public CachedLexicaBotaniaRecipe(ItemStack stack, LexiconEntry entry) {
item = new PositionedStack(stack, 91, 5);
this.entry = entry;
}
@Override
public List<PositionedStack> getIngredients() {
return otherStacks;
}
@Override
public PositionedStack getResult() {
return item;
}
@Override
public PositionedStack getResult() {
return item;
}
@Override
public boolean contains(Collection<PositionedStack> ingredients, ItemStack ingredient) {
return ingredient.getItem() == ModItems.lexicon;
}
@Override
public List<PositionedStack> getOtherStacks() {
return otherStacks;
}
}
@Override
public boolean contains(Collection<PositionedStack> ingredients, ItemStack ingredient) {
return ingredient.getItem() == ModItems.lexicon;
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("botania.nei.lexica");
}
}
@Override
public String getOverlayIdentifier() {
return "botania.lexica";
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("botania.nei.lexica");
}
@Override
public String getGuiTexture() {
return LibResources.GUI_NEI_BLANK;
}
@Override
public String getGuiTexture() {
return LibResources.GUI_NEI_BLANK;
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(50, 4, 18, 18), getOverlayIdentifier()));
}
@Override
public int recipiesPerPage() {
return 1;
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(50, 4, 18, 18), "botania.lexica"));
}
@Override
public void drawBackground(int recipe) {
super.drawBackground(recipe);
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
CachedLexicaBotaniaRecipe recipeObj = ((CachedLexicaBotaniaRecipe) arecipes.get(recipe));
@Override
public void drawBackground(int recipe) {
super.drawBackground(recipe);
String s = EnumChatFormatting.UNDERLINE + StatCollector.translateToLocal(recipeObj.entry.getUnlocalizedName());
font.drawString(s, 82 - font.getStringWidth(s) / 2, 30, 4210752);
KnowledgeType type = recipeObj.entry.getKnowledgeType();
s = type.color + StatCollector.translateToLocal(type.getUnlocalizedName()).replaceAll("\\&.", "");
font.drawString(s, 82 - font.getStringWidth(s) / 2, 42, 4210752);
s = "\"" + StatCollector.translateToLocal(recipeObj.entry.getTagline()) + "\"";
PageText.renderText(5, 42, 160, 200, s);
String key = LexiconRecipeMappings.stackToString(recipeObj.item.item);
String quickInfo = "botania.nei.quickInfo:" + key;
String quickInfoLocal = StatCollector.translateToLocal(quickInfo);
if(GuiScreen.isShiftKeyDown() && GuiScreen.isCtrlKeyDown() && Minecraft.getMinecraft().gameSettings.advancedItemTooltips)
s = "name: " + key;
else if(quickInfo.equals(quickInfoLocal))
s = StatCollector.translateToLocal("botania.nei.lexicaNoInfo");
else {
s = StatCollector.translateToLocal("botania.nei.lexicaSeparator");
font.drawString(s, 82 - font.getStringWidth(s) / 2, 80, 4210752);
s = quickInfoLocal;
}
PageText.renderText(5, 80, 160, 200, s);
}
CachedLexicaBotaniaRecipe recipeObj = ((CachedLexicaBotaniaRecipe) arecipes.get(recipe));
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if(outputId.equals("botania.lexica")) {
for(LexiconEntry entry : BotaniaAPI.getAllEntries()) {
List<ItemStack> stacks = entry.getDisplayedRecipes();
for(ItemStack stack : stacks)
arecipes.add(new CachedLexicaBotaniaRecipe(stack, entry));
}
} else super.loadCraftingRecipes(outputId, results);
}
NEIHelper.renderItemIntoGUI(LEXICA, 51, 5);
@Override
public void loadCraftingRecipes(ItemStack result) {
for(LexiconEntry entry : BotaniaAPI.getAllEntries()) {
List<ItemStack> stacks = entry.getDisplayedRecipes();
for(ItemStack stack : stacks) {
String key1 = LexiconRecipeMappings.stackToString(stack);
String key2 = LexiconRecipeMappings.stackToString(result);
if(key1.equals(key2))
arecipes.add(new CachedLexicaBotaniaRecipe(stack, entry));
}
}
}
GuiDraw.drawStringC(
EnumChatFormatting.UNDERLINE + StatCollector.translateToLocal(recipeObj.entry.getUnlocalizedName()),
82,
30,
LibColorUtils.neiHandlerBotaniaLexicaTitle.getColor(),
false);
@Override
public void loadUsageRecipes(ItemStack ingredient) {
// NO-OP
}
KnowledgeType type = recipeObj.entry.getKnowledgeType();
GuiDraw.drawStringC(
type.color + StatCollector.translateToLocal(type.getUnlocalizedName()).replaceAll("&[0-9a-fklmnor]", ""),
82,
42,
LibColorUtils.neiHandlerBotaniaLexicaKnowledge.getColor(),
false);
PageText.renderText(
5,
42,
160,
200,
10,
LibColorUtils.neiHandlerBotaniaLexicaTagline.getColor(),
"\"" + StatCollector.translateToLocal(recipeObj.entry.getTagline()) + "\"");
String key = LexiconRecipeMappings.stackToString(recipeObj.item.item);
String quickInfo = "botania.nei.quickInfo:" + key;
String quickInfoLocal = StatCollector.translateToLocal(quickInfo);
String s;
if (GuiScreen.isShiftKeyDown() && GuiScreen.isCtrlKeyDown() && Minecraft.getMinecraft().gameSettings.advancedItemTooltips)
s = "name: " + key;
else if (quickInfo.equals(quickInfoLocal))
s = StatCollector.translateToLocal("botania.nei.lexicaNoInfo");
else {
GuiDraw.drawStringC(
StatCollector.translateToLocal("botania.nei.lexicaSeparator"),
82,
80,
LibColorUtils.neiHandlerBotaniaLexicaExtraInfo.getColor(),
false);
s = quickInfoLocal;
}
PageText.renderText(5, 80, 160, 200, 10, LibColorUtils.neiHandlerBotaniaLexicaExtraInfoDesc.getColor(), s);
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getOverlayIdentifier())) {
for (LexiconEntry entry : BotaniaAPI.getAllEntries()) {
List<ItemStack> stacks = entry.getDisplayedRecipes();
for (ItemStack stack : stacks)
arecipes.add(new CachedLexicaBotaniaRecipe(stack, entry));
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for (LexiconEntry entry : BotaniaAPI.getAllEntries()) {
List<ItemStack> stacks = entry.getDisplayedRecipes();
for (ItemStack stack : stacks) {
String key1 = LexiconRecipeMappings.stackToString(stack);
String key2 = LexiconRecipeMappings.stackToString(result);
if (key1.equals(key2)) {
arecipes.add(new CachedLexicaBotaniaRecipe(stack, entry));
}
}
}
}
@Override
public void loadUsageRecipes(String outputId, Object... ingredients) {
loadCraftingRecipes(outputId, ingredients);
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
loadCraftingRecipes(ingredient);
}
}
@@ -1,13 +1,9 @@
package vazkii.botania.client.integration.nei.recipe;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.item.Item;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraftforge.oredict.OreDictionary;
@@ -17,6 +13,7 @@ import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipeManaInfusion;
import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.client.integration.nei.NEIHelper;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.client.render.tile.RenderTilePool;
import vazkii.botania.common.block.ModBlocks;
@@ -28,120 +25,138 @@ import vazkii.botania.common.core.helper.ItemNBTHelper;
public class RecipeHandlerManaPool extends TemplateRecipeHandler {
public class CachedManaPoolRecipe extends CachedRecipe {
private static final ItemStack POOL = new ItemStack(ModBlocks.pool);
public List<PositionedStack> inputs = new ArrayList<>();
public PositionedStack output;
public List<PositionedStack> otherStacks = new ArrayList<>();
public int mana;
public class CachedManaPoolRecipe extends CachedRecipe {
public CachedManaPoolRecipe(RecipeManaInfusion recipe) {
if(recipe == null)
return;
inputs.add(new PositionedStack(new ItemStack(ModBlocks.pool, 1, recipe.getOutput().getItem() == Item.getItemFromBlock(ModBlocks.pool) ? 2 : 0), 71, 37));
private static final PositionedStack ALCHEMY = new PositionedStack(new ItemStack(ModBlocks.alchemyCatalyst), 10, 37);
private static final PositionedStack CONJURATION = new PositionedStack(new ItemStack(ModBlocks.conjurationCatalyst), 10, 37);
public PositionedStack input;
public PositionedStack output;
public PositionedStack catalyst;
public int mana;
if(recipe.getInput() instanceof String)
inputs.add(new PositionedStack(OreDictionary.getOres((String) recipe.getInput()), 42, 37));
else inputs.add(new PositionedStack(recipe.getInput(), 42, 37));
public CachedManaPoolRecipe(RecipeManaInfusion recipe) {
if (recipe == null) return;
if(recipe.isAlchemy())
otherStacks.add(new PositionedStack(new ItemStack(ModBlocks.alchemyCatalyst), 10, 37));
else if (recipe.isConjuration())
otherStacks.add(new PositionedStack(new ItemStack(ModBlocks.conjurationCatalyst), 10, 37));
Object o = recipe.getInput();
if (o instanceof String oreName) {
o = OreDictionary.getOres(oreName);
}
input = new PositionedStack(o, 42, 37);
output = new PositionedStack(recipe.getOutput(), 101, 37);
// This value is where the mana bar is stored initially
mana = recipe.getManaToConsume();
}
if (recipe.isAlchemy()) {
catalyst = ALCHEMY;
} else if (recipe.isConjuration()) {
catalyst = CONJURATION;
}
@Override
public List<PositionedStack> getIngredients() {
return getCycledIngredients(cycleticks / 20, inputs);
}
output = new PositionedStack(recipe.getOutput(), 101, 37);
mana = recipe.getManaToConsume();
}
@Override
public PositionedStack getResult() {
return output;
}
@Override
public PositionedStack getIngredient() {
return input;
}
@Override
public List<PositionedStack> getOtherStacks() {
return otherStacks;
}
@Override
public PositionedStack getResult() {
return output;
}
}
@Override
public PositionedStack getOtherStack() {
return catalyst;
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("botania.nei.manaPool");
}
}
@Override
public String getGuiTexture() {
return LibResources.GUI_NEI_BLANK;
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("botania.nei.manaPool");
}
@Override
public int recipiesPerPage() {
return 1;
}
@Override
public String getOverlayIdentifier() {
return "botania.manaPool";
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(70, 36, 18, 18), "botania.manaPool"));
}
@Override
public String getGuiTexture() {
return LibResources.GUI_NEI_BLANK;
}
@Override
public void drawBackground(int recipe) {
super.drawBackground(recipe);
GL11.glEnable(GL11.GL_BLEND);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
// Mana infusion is the mana pool, super weird.
GuiDraw.changeTexture(LibResources.GUI_MANA_INFUSION_OVERLAY);
GuiDraw.drawTexturedModalRect(45, 20, 38, 35, 92, 50);
// Below is where the mana bar actually drawn.
int tempMana = ((CachedManaPoolRecipe) arecipes.get(recipe)).mana;
HUDHandler.renderManaBar(32, 80, 0x0000FF, 0.75F, GuiScreen.isShiftKeyDown() ? tempMana : tempMana * 10, TilePool.MAX_MANA / 10);
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
String size = GuiScreen.isShiftKeyDown() ? "1x " : "10x ";
String localized = StatCollector.translateToLocal("botaniamisc.neiratio");
font.drawString(size + localized, 84 - font.getStringWidth(size + localized) / 2, 71, 0x000000);
RenderTilePool.forceMana = true;
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(70, 36, 18, 18), getOverlayIdentifier()));
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if(outputId.equals("botania.manaPool")) {
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
if(recipe == null)
continue;
@Override
public void drawBackground(int recipe) {
super.drawBackground(recipe);
GL11.glEnable(GL11.GL_BLEND);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
// Arrows
GuiDraw.changeTexture(LibResources.GUI_MANA_INFUSION_OVERLAY);
GuiDraw.drawTexturedModalRect(45, 20, 38, 35, 92, 50);
// Mana bar
int tempMana = ((CachedManaPoolRecipe) arecipes.get(recipe)).mana;
HUDHandler.renderManaBar(
32,
80,
0x0000FF,
0.75F,
GuiScreen.isShiftKeyDown() ? tempMana : tempMana * 10,
TilePool.MAX_MANA / 10);
String size = GuiScreen.isShiftKeyDown() ? "1x" : "10x";
String localized = StatCollector.translateToLocalFormatted("botaniamisc.neiratio", size);
GuiDraw.drawStringC(localized, 84, 71, 0x000000, false);
GL11.glDisable(GL11.GL_BLEND);
// Mana pool item
RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(GL11.GL_DEPTH_TEST);
RenderTilePool.forceMana = true;
NEIHelper.renderItemIntoGUI(POOL, 71, 37);
GL11.glDisable(GL11.GL_DEPTH_TEST);
RenderHelper.disableStandardItemLighting();
}
arecipes.add(new CachedManaPoolRecipe(recipe));
}
} else super.loadCraftingRecipes(outputId, results);
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getOverlayIdentifier())) {
for (RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
if (recipe == null) continue;
@Override
public void loadCraftingRecipes(ItemStack result) {
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
if(recipe == null)
continue;
arecipes.add(new CachedManaPoolRecipe(recipe));
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
if(ItemNBTHelper.areStacksSameTypeCraftingWithNBT(recipe.getOutput(), result))
arecipes.add(new CachedManaPoolRecipe(recipe));
}
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for (RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
if (recipe == null) continue;
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
if(recipe == null)
continue;
if (ItemNBTHelper.areStacksSameTypeCraftingWithNBT(recipe.getOutput(), result)) {
arecipes.add(new CachedManaPoolRecipe(recipe));
}
}
}
CachedManaPoolRecipe crecipe = new CachedManaPoolRecipe(recipe);
if(ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getIngredients(), ingredient) || ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getOtherStacks(), ingredient))
arecipes.add(crecipe);
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for (RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
if (recipe == null) continue;
CachedManaPoolRecipe crecipe = new CachedManaPoolRecipe(recipe);
if (ItemNBTHelper.positionedStackContainsWithNBT(crecipe.input, ingredient) ||
ItemNBTHelper.positionedStackContainsWithNBT(crecipe.catalyst, ingredient)) {
arecipes.add(crecipe);
}
}
}
}
@@ -4,6 +4,7 @@ import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
@@ -13,6 +14,7 @@ import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipePetals;
import vazkii.botania.client.integration.nei.NEIHelper;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.block.ModBlocks;
import codechicken.lib.gui.GuiDraw;
@@ -22,122 +24,144 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
import vazkii.botania.common.core.helper.ItemNBTHelper;
public class RecipeHandlerPetalApothecary extends TemplateRecipeHandler {
private static final ItemStack APOTHECARY = new ItemStack(ModBlocks.altar);
public class CachedPetalApothecaryRecipe extends CachedRecipe {
public class CachedPetalApothecaryRecipe extends CachedRecipe {
public List<PositionedStack> inputs = new ArrayList<>();
public PositionedStack output;
public List<PositionedStack> inputs = new ArrayList<>();
public PositionedStack output;
public CachedPetalApothecaryRecipe(RecipePetals recipe, PositionedStack centerItem) {
this(recipe);
inputs.add(centerItem);
}
public CachedPetalApothecaryRecipe(RecipePetals recipe, boolean addCenterItem) {
setIngredients(recipe.getInputs());
output = new PositionedStack(recipe.getOutput(), 111, 21);
if(addCenterItem)
inputs.add(new PositionedStack(new ItemStack(ModBlocks.altar), 73, 55));
}
public CachedPetalApothecaryRecipe(RecipePetals recipe) {
setIngredients(recipe.getInputs());
output = new PositionedStack(recipe.getOutput(), 111, 21);
}
public CachedPetalApothecaryRecipe(RecipePetals recipe) {
this(recipe, true);
}
// Kept for Alfheim, which calls super(recipe, false) from its NEI handler.
@Deprecated
@SuppressWarnings("unused")
public CachedPetalApothecaryRecipe(RecipePetals recipe, boolean addCenterItem) {
this(recipe);
}
public void setIngredients(List<Object> inputs) {
float degreePerInput = 360F / inputs.size();
float currentDegree = -90F;
public void setIngredients(List<Object> inputs) {
float degreePerInput = 360F / inputs.size();
float currentDegree = -90F;
for(Object o : inputs) {
int posX = (int) Math.round(73 + Math.cos(currentDegree * Math.PI / 180D) * 32);
int posY = (int) Math.round(55 + Math.sin(currentDegree * Math.PI / 180D) * 32);
for (Object o : inputs) {
int posX = (int) Math.round(73 + Math.cos(currentDegree * Math.PI / 180D) * 32);
int posY = (int) Math.round(55 + Math.sin(currentDegree * Math.PI / 180D) * 32);
if(o instanceof String)
this.inputs.add(new PositionedStack(OreDictionary.getOres((String) o), posX, posY));
else this.inputs.add(new PositionedStack(o, posX, posY));
currentDegree += degreePerInput;
}
}
if (o instanceof String oreName) {
o = OreDictionary.getOres(oreName);
}
this.inputs.add(new PositionedStack(o, posX, posY));
currentDegree += degreePerInput;
}
}
@Override
public List<PositionedStack> getIngredients() {
return getCycledIngredients(cycleticks / 20, inputs);
}
@Override
public List<PositionedStack> getIngredients() {
return inputs;
}
@Override
public PositionedStack getResult() {
return output;
}
@Override
public PositionedStack getResult() {
return output;
}
}
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("botania.nei.petalApothecary");
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("botania.nei.petalApothecary");
}
@Override
public String getOverlayIdentifier() {
return getRecipeID();
}
public String getRecipeID() {
return "botania.petalApothecary";
}
// Kept for Alfheim, which overrides this instead of getOverlayIdentifier().
@Deprecated
public String getRecipeID() {
return "botania.petalApothecary";
}
@Override
public String getGuiTexture() {
return LibResources.GUI_NEI_BLANK;
}
@Override
public String getGuiTexture() {
return LibResources.GUI_NEI_BLANK;
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(72, 54, 18, 18), getRecipeID()));
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(73, 56, 16, 16), getOverlayIdentifier()));
}
@Override
public int recipiesPerPage() {
return 1;
}
@Override
public void drawBackground(int recipe) {
super.drawBackground(recipe);
// Background circle graphic
GL11.glEnable(GL11.GL_BLEND);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
GuiDraw.changeTexture(LibResources.GUI_PETAL_OVERLAY);
GuiDraw.drawTexturedModalRect(45, 10, 38, 7, 92, 92);
// Item
RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(GL11.GL_DEPTH_TEST);
NEIHelper.renderItemIntoGUI(getRenderItem(), 73, 55);
GL11.glDisable(GL11.GL_DEPTH_TEST);
RenderHelper.disableStandardItemLighting();
}
@Override
public void drawBackground(int recipe) {
super.drawBackground(recipe);
GL11.glEnable(GL11.GL_BLEND);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
GuiDraw.changeTexture(LibResources.GUI_PETAL_OVERLAY);
GuiDraw.drawTexturedModalRect(45, 10, 38, 7, 92, 92);
}
protected ItemStack getRenderItem() {
return APOTHECARY;
}
public List<? extends RecipePetals> getRecipes() {
return BotaniaAPI.petalRecipes;
}
public List<? extends RecipePetals> getRecipes() {
return BotaniaAPI.petalRecipes;
}
public CachedPetalApothecaryRecipe getCachedRecipe(RecipePetals recipe) {
return new CachedPetalApothecaryRecipe(recipe);
}
public CachedPetalApothecaryRecipe getCachedRecipe(RecipePetals recipe) {
ItemStack seedStack = new ItemStack(Items.wheat_seeds);
seedStack.setStackDisplayName(StatCollector.translateToLocal("botania.nei.anySeed"));
return new CachedPetalApothecaryRecipe(recipe, new PositionedStack(seedStack, 73, 39));
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if(outputId.equals(getRecipeID())) {
for(RecipePetals recipe : getRecipes())
if(recipe.getOutput().getItem() != Items.skull)
arecipes.add(getCachedRecipe(recipe));
} else super.loadCraftingRecipes(outputId, results);
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getOverlayIdentifier())) {
for (RecipePetals recipe : getRecipes())
if (recipe.getOutput().getItem() != Items.skull)
arecipes.add(getCachedRecipe(recipe));
} else {
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for(RecipePetals recipe : getRecipes()){
if(recipe == null)
continue;
@Override
public void loadCraftingRecipes(ItemStack result) {
for (RecipePetals recipe : getRecipes()) {
if (recipe == null) continue;
if(recipe.getOutput().stackTagCompound != null && ItemNBTHelper.areStacksSameTypeWithNBT(recipe.getOutput(), result) || recipe.getOutput().stackTagCompound == null && NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result) && recipe.getOutput().getItem() != Items.skull)
arecipes.add(getCachedRecipe(recipe));
}
}
if (recipe.getOutput().stackTagCompound != null && ItemNBTHelper.areStacksSameTypeWithNBT(recipe.getOutput(), result) || recipe.getOutput().stackTagCompound == null && NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result) && recipe.getOutput().getItem() != Items.skull) {
arecipes.add(getCachedRecipe(recipe));
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for(RecipePetals recipe : getRecipes()) {
if(recipe == null)
continue;
CachedPetalApothecaryRecipe crecipe = getCachedRecipe(recipe);
if(ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.inputs, ingredient) && recipe.getOutput().getItem() != Items.skull)
arecipes.add(crecipe);
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for (RecipePetals recipe : getRecipes()) {
if (recipe == null) continue;
CachedPetalApothecaryRecipe crecipe = getCachedRecipe(recipe);
if (ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.inputs, ingredient) && recipe.getOutput().getItem() != Items.skull) {
arecipes.add(crecipe);
}
}
}
}
@@ -1,8 +1,6 @@
package vazkii.botania.client.integration.nei.recipe;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
@@ -13,6 +11,7 @@ import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipePureDaisy;
import vazkii.botania.client.integration.nei.NEIHelper;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
@@ -23,103 +22,102 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
public class RecipeHandlerPureDaisy extends TemplateRecipeHandler {
public class CachedPureDaisyRecipe extends CachedRecipe {
private static final ItemStack DAISY = ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY);
public List<PositionedStack> inputs = new ArrayList<>();
public PositionedStack output;
public List<PositionedStack> otherStacks = new ArrayList<>();
public class CachedPureDaisyRecipe extends CachedRecipe {
public CachedPureDaisyRecipe(RecipePureDaisy recipe) {
if(recipe == null)
return;
inputs.add(new PositionedStack(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY), 71, 23));
public PositionedStack inputs;
public PositionedStack output;
if(recipe.getInput() instanceof String)
inputs.add(new PositionedStack(OreDictionary.getOres((String) recipe.getInput()), 42, 23));
else inputs.add(new PositionedStack(new ItemStack((Block) recipe.getInput()), 42, 23));
public CachedPureDaisyRecipe(RecipePureDaisy recipe) {
if (recipe == null) return;
output = new PositionedStack(new ItemStack(recipe.getOutput()), 101, 23);
}
Object o = recipe.getInput();
if (o instanceof String oreName) {
o = OreDictionary.getOres(oreName);
} else {
o = new ItemStack((Block) o);
}
inputs = new PositionedStack(o, 42, 23);
output = new PositionedStack(new ItemStack(recipe.getOutput()), 101, 23);
}
@Override
public List<PositionedStack> getIngredients() {
return getCycledIngredients(cycleticks / 20, inputs);
}
@Override
public PositionedStack getIngredient() {
return inputs;
}
@Override
public PositionedStack getResult() {
return output;
}
@Override
public PositionedStack getResult() {
return output;
}
@Override
public List<PositionedStack> getOtherStacks() {
return otherStacks;
}
}
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("botania.nei.pureDaisy");
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("botania.nei.pureDaisy");
public String getOverlayIdentifier() {
return "botania.pureDaisy";
}
@Override
public String getGuiTexture() {
return LibResources.GUI_NEI_BLANK;
}
@Override
public String getGuiTexture() {
return LibResources.GUI_NEI_BLANK;
}
@Override
public int recipiesPerPage() {
return 2;
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(70, 22, 18, 18), getOverlayIdentifier()));
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(70, 22, 18, 18), "botania.pureDaisy"));
}
@Override
public void drawBackground(int recipe) {
super.drawBackground(recipe);
// Arrows
GL11.glEnable(GL11.GL_BLEND);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
GuiDraw.changeTexture(LibResources.GUI_PURE_DAISY_OVERLAY);
GuiDraw.drawTexturedModalRect(48, 10, 0, 0, 65, 44);
// Flower item
NEIHelper.renderItemIntoGUI(DAISY, 71, 23);
}
@Override
public void drawBackground(int recipe) {
super.drawBackground(recipe);
GL11.glEnable(GL11.GL_BLEND);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
GuiDraw.changeTexture(LibResources.GUI_PURE_DAISY_OVERLAY);
GuiDraw.drawTexturedModalRect(45, 10, 0, 0, 65, 44);
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getOverlayIdentifier())) {
for (RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
if (recipe != null) arecipes.add(new CachedPureDaisyRecipe(recipe));
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if(outputId.equals("botania.pureDaisy")) {
for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
if(recipe == null)
continue;
@Override
public void loadCraftingRecipes(ItemStack result) {
for (RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
if (recipe == null) continue;
arecipes.add(new CachedPureDaisyRecipe(recipe));
}
} else super.loadCraftingRecipes(outputId, results);
}
if (ItemNBTHelper.areStacksSameTypeCraftingWithNBT(new ItemStack(recipe.getOutput()), result)) {
arecipes.add(new CachedPureDaisyRecipe(recipe));
}
}
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
if(recipe == null)
continue;
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for (RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
if (recipe == null) continue;
if(ItemNBTHelper.areStacksSameTypeCraftingWithNBT(new ItemStack(recipe.getOutput()), result))
arecipes.add(new CachedPureDaisyRecipe(recipe));
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
if(recipe == null)
continue;
CachedPureDaisyRecipe crecipe = new CachedPureDaisyRecipe(recipe);
if(ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getIngredients(), ingredient) || ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getOtherStacks(), ingredient))
arecipes.add(crecipe);
}
}
CachedPureDaisyRecipe crecipe = new CachedPureDaisyRecipe(recipe);
if (ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getIngredients(), ingredient) || ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getOtherStacks(), ingredient)) {
arecipes.add(crecipe);
}
}
}
}
@@ -14,44 +14,48 @@ import codechicken.nei.PositionedStack;
public class RecipeHandlerRunicAltar extends RecipeHandlerPetalApothecary {
public class CachedRunicAltarRecipe extends CachedPetalApothecaryRecipe {
private static final ItemStack ALTAR = new ItemStack(ModBlocks.runeAltar);
private static final PositionedStack LIVINGROCK = new PositionedStack(new ItemStack(ModBlocks.livingrock), 73, 39);
public int manaUsage;
public class CachedRunicAltarRecipe extends CachedPetalApothecaryRecipe {
public CachedRunicAltarRecipe(RecipeRuneAltar recipe) {
super(recipe, false);
if(recipe == null)
return;
manaUsage = recipe.getManaUsage();
inputs.add(new PositionedStack(new ItemStack(ModBlocks.runeAltar), 73, 55));
}
public int manaUsage;
}
public CachedRunicAltarRecipe(RecipeRuneAltar recipe, PositionedStack centerItem) {
super(recipe, centerItem);
manaUsage = recipe.getManaUsage();
}
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("botania.nei.runicAltar");
}
@Override
public String getOverlayIdentifier() {
return "botania.runicAltar";
}
@Override
public void drawBackground(int recipe) {
super.drawBackground(recipe);
HUDHandler.renderManaBar(32, 113, 0x0000FF, 0.75F, ((CachedRunicAltarRecipe) arecipes.get(recipe)).manaUsage, TilePool.MAX_MANA / 10);
}
@Override
public List<? extends RecipePetals> getRecipes() {
return BotaniaAPI.runeAltarRecipes;
}
@Override
public CachedPetalApothecaryRecipe getCachedRecipe(RecipePetals recipe) {
return new CachedRunicAltarRecipe((RecipeRuneAltar) recipe, LIVINGROCK);
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("botania.nei.runicAltar");
}
@Override
public String getRecipeID() {
return "botania.runicAltar";
}
@Override
public void drawBackground(int recipe) {
super.drawBackground(recipe);
HUDHandler.renderManaBar(32, 113, 0x0000FF, 0.75F, ((CachedRunicAltarRecipe) arecipes.get(recipe)).manaUsage, TilePool.MAX_MANA / 10);
}
@Override
public List<? extends RecipePetals> getRecipes() {
return BotaniaAPI.runeAltarRecipes;
}
@Override
public CachedPetalApothecaryRecipe getCachedRecipe(RecipePetals recipe) {
return new CachedRunicAltarRecipe((RecipeRuneAltar) recipe);
}
protected ItemStack getRenderItem() {
return ALTAR;
}
}
@@ -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);
}
Loaded 100 of 1544 files, more files were not shown because too many files have changed in this diff. Show more