Compare commits

...
84 Commits
Author SHA1 Message Date
Martin Robertz d5c4e9217b update 2024-05-06 18:28:40 +02:00
LuluTheDog 6610499e7c Added GoG Skybox support for all dimensions (#42)
* Added GoG Skybox support for all dimensions

- Added a boolean to toggle the feature to the config
- Added an int array to contain the dimension you would like to recieve the Skybox

-Changed the GoG Skybox render check to include above changes

Basically this allows you to display the Garden of Glass in any dimension you wish, instead of just in the overworld. I like to use this to have the skybox in my personal void dimension.

* Changed dimension ID to HashSet

- Changed the dimension ID handling from int[] to a HashSet of Integers

-Added loadPropIntSet()

Im sorry if there is better ways to handle the loading of the IDs from the file, this is what i was able to come up with, if theres a way to directly save a set to file please do tell
2024-05-06 18:27:49 +02:00
Martin Robertz ebcca54ad4 update 2024-03-24 13:12:23 +01:00
Abdiel Kavash 89237f644a Optimize Alf Portal logic (#49) 2024-03-24 08:17:05 +01:00
Martin Robertz 052041f846 update 2024-03-08 18:24:33 +01:00
Glease 8f1d0abbeb fix elv portal treating lexicon as illegal item (#47) 2024-03-07 11:04:18 +01:00
Martin Robertz d179ee57e9 update 2024-02-21 13:27:26 +01:00
Батьків Нестор-Євген Васильович 1e2c85f898 Bug fix and small refactor (#45) 2024-02-21 13:26:57 +01:00
Батьків Нестор-Євген Васильович f1900cd9b3 The ring of ikoL awakens! (#43)
* moving master block dont reset structure

* Add mirroring

* opsie

* Mirror look

* Mirror final round

* refractor + new hud message

* Cost balancing

* F*ck you idea, you are not my homie now

* Thanks idea, love you

* Thanks Raven

* This should be it
2024-02-18 10:57:54 +01:00
Martin Robertz 398af04ea5 update 2024-02-18 10:50:52 +01:00
Jason Mitchell d5beca8e52 Reduce number of item copies. Backport from 1.12 https://github.com/VazkiiMods/Botania/commit/8595d27f4181f11006586442e42e03988a329c58 (#44) 2024-02-17 16:07:32 -08:00
Raven Szewczyk db3e5b6388 [ci skip] upgraded build system 2024-02-04 19:57:14 +00:00
Martin Robertz 177cb6af04 update bs+deps 2024-01-29 18:44:42 +01:00
Jason Mitchell 0c89751e53 Keep a cache of time uniforms instead of querying them every time (#41) 2024-01-29 18:42:27 +01:00
Martin Robertz 98cb2bb68c update bs+deps 2024-01-17 21:57:17 +01:00
Батьків Нестор-Євген Васильович 7d615a0ceb Clarify some misunderstanding (#39) 2024-01-17 21:56:24 +01:00
Martin Robertz d2be71b4e3 update bs+deps 2024-01-11 23:00:07 +01:00
Raven Szewczyk d03a0c697c [ci skip] upgraded build system 2024-01-08 21:24:18 +00:00
Martin Robertz e8da80454b update bs+deps 2023-11-05 12:50:35 +01:00
Hubry 272075dd51 Fix Alfheim portal storing items not used in recipes (VazkiiMods/Botania#2721)
* Fix VazkiiMods/Botania#2403 (Alfheim portal storing items not used in recipes)

Possibly mitigates VazkiiMods/Botania#2669, as recipe checks are a bit simplified to not
create stack copies posting capability events and the portal will not
check items with no uses more than once.

* Don't teleport bread, Bord.
2023-11-04 19:24:45 +08:00
Martin Robertz 56bd18670f update bs+deps 2023-10-30 08:30:07 +01:00
Ryan Nasers 29f0c6af40 This fixes Botania creative tab breaking and shouldn't affect the ring itself (#34)
* This fixes creative tab breaking and shouldn't affect the ring itself

* Adding change suggest by OneEyeMaker, placed check for tag compound inside of isRingEnabled and isRingBreaking methods.

* Forgot that bit. :)
2023-10-29 21:23:06 +01:00
Ryan Nasers 5ed33dfa4f Adding mushroom bag and minor refactor (#33)
* Refactors flower bag into a generic bag
* Adds a mushroom bag
2023-10-29 21:20:52 +01:00
Dream-MasterXXL 7a74dabcea fix wildcard imports 2023-10-09 23:18:50 +02:00
Dream-MasterXXL 68518a7858 update bs+deps 2023-10-09 22:56:33 +02:00
LewisSaber f83cd1ab0b Made letter purple instead of dark blue 2023-10-06 20:57:28 +02:00
LewisSaber 5595d0377c I love you combuster 2023-10-06 20:57:28 +02:00
LewisSaber 6c4d37a345 compressed 2 keybinds, added tooltip 2023-10-06 20:57:28 +02:00
LewisSaber 77e14f3c8a I love identation I love identation I love identation I love identation I love identation I love identation I love identation 2023-10-06 20:57:28 +02:00
LewisSaber 71e00772b7 identation 2023-10-06 20:57:28 +02:00
LewisSaber cf60696c68 Add keybind to clear selected blocks
also stop selected blocks from drawing with ring turned off
2023-10-06 20:57:28 +02:00
Martin Robertz d24f3facfe update gradle 2023-09-16 20:06:16 +02:00
Батьків Нестор-Євген Васильович 5cdf19daac Add Breaking To Ring Of Loki (#31)
Add Breaking to Ring of Loki
2023-09-16 20:00:47 +02:00
Pyromanc3r 93e6a1f7ba Updated Russian localization (#30)
* Updated Russian localization

The mod is now fully translated

* перевод подправлен

* доп. правки

* доп. правки2
2023-07-22 17:05:54 +02:00
梅天佑 1039b52854 Fixes a dupe with the crafting halos
adds a check that will be redundant for 99% of items (#29)
2023-05-17 22:17:37 +02:00
quentin452 33a26a5059 Fix tps lag in orespawn dimensions caused by the onSpawn methods (#28)
* Fix tps lag introduced by onSpawn methods

Especially in Orespawn dimensions like unstable dimension theses methods destroys tps before

Tested in my modpack

spark profiler before : ~ 13 ms
https://spark.lucko.me/6KkG1Tq4Su

spark profiler after :  ~ 8.5 ms
https://spark.lucko.me/6m2vv9Hb1X

However, originals versions may be more appropriate in some situations where you need to find all players in a given area rather than the closest player.

* Revert "Fix tps lag introduced by onSpawn methods"

This reverts commit 76a23a28db.

* Fix tps lags in orespawn dimension
2023-05-05 20:02:07 +02:00
Dane Strandboge 5ba45cb86d Fix Lexica Botania handling of GT tools (#27)
* fix tool handling in lexicon, improve oredict display

* update buildscript

* fix missed wrapper update, manually fix formatting (since no spotless)
2023-05-01 22:38:21 +02:00
Батьків Нестор-Євген Васильович 2f47326c7f Fix ring of loki range (#26)
Moves the player closer to the target in question so that some items' range safety checks will pass with the ring's extended reach.
2023-04-28 20:16:35 +02:00
Батьків Нестор-Євген Васильович 876b18328d Ring of loki improvement (#25)
* fix deps

* make ring trigger block activation

* remove runtime dep

* AdReSs ReVieW
2023-04-24 20:24:17 +02:00
Martin Robertz 391406e1de update gradle+BS 2023-03-17 19:34:41 +01:00
Zereff06 dfaa6dde5a Mobs not spawning on blocks (#23)
and config to disable this
2023-02-06 21:31:32 +01:00
Raven Szewczyk c14b5d4ddb [ci skip] upgraded build system 2023-01-31 09:51:31 +00:00
Jason Mitchell c90e492a66 [ci skip] Update buildscript to RetroFuturaGradle 2023-01-29 10:49:19 -08:00
AlexCatze 8a5fa6c441 Make flowers enabled by default (#22)
PR like #21 but for flowers. This will helpful to players, who using this fork of botania outside of any modpacks. This will not affect GTNH modpack(and other modpacks) because they are alredy have Botania.cfg. Also in config descripton sayed that this option should be 2 by default: "The quantity of Botania flower patches to generate in the world, defaults to 2, the lower the number the less patches generate.".
2023-01-03 18:11:43 +01:00
AlexCatze 3caf8954ad Make default recipes enabled by default (#21)
As said in description of this option, this is expert option. And, i think, recipes should be enabled by default for non-expert users. Modpack author will disable it, if needed. But it will be hard for common user to adress why there are no recipes.
2023-01-01 13:32:32 +01:00
Maxim 09ccf50fde Fix accidental double toggle of ring of loki (#20) 2022-12-30 00:17:34 +01:00
jss2a98ajandMartin Robertz 54f79398b1 Prevent Botania's bauble item tooltips breaking in some situations (#19)
* Fixed bauble tooltips breaking with certain bindings

Prevents some items tooltips and in-inventory rendering from breaking if the Baubles key is unbound, bound to a mouse button, or an abnormal keyboard key.

* update BS

Co-authored-by: Martin Robertz <dream-master@gmx.net>
2022-12-28 00:45:29 +01:00
Glease 84e758e450 fix memory leak in ManaNetworkHandler 2022-10-19 10:25:10 -07:00
Martin Robertz 751640ccec Merge pull request #17 from Kiwi233/master
Update zh_CN.lang
2022-09-24 12:40:48 +02:00
[Kiwi233] 4013121abf Update zh_CN.lang 2022-09-24 11:29:02 +08:00
Martin Robertz 9be15c8ecd Merge pull request #16 from GTNewHorizons/QuickFixLoki
Fix Loki Ring text being wrong most of the time on servers
2022-09-20 22:58:00 +02:00
BlueWeabo 0c87c31d1d revert to old text get method 2022-09-20 23:37:10 +03:00
BlueWeabo b25ef783b3 remove unneeded variable 2022-09-20 23:24:30 +03:00
BlueWeabo b2b13d9328 FixLokiText 2022-09-20 19:42:57 +03:00
Martin Robertz 9e0c82ce36 Merge pull request #15 from GTNewHorizons/KeybindForRingOfLoki
Adds a keybind to the Ring of Loki
2022-09-15 22:22:52 +02:00
BlueWeabo b002bbdd44 more ordering
think this is the last one
2022-09-15 21:05:02 +03:00
BlueWeabo d33b0cc836 ordering and fixing server crash 2022-09-15 20:35:53 +03:00
BlueWeabo 5d5277c50b add the keybind 2022-09-14 11:06:21 +03:00
Martin Robertz a3345d26d3 Merge pull request #14 from GTNewHorizons/elven-nbt-revert
Revert partial NBT match for elven recipes
2022-08-24 19:27:40 +02:00
miozune 6dce0d9e7b Revert partial NBT match for elven recipes 2022-08-25 02:05:56 +09:00
Martin Robertz 6826c25e30 Merge pull request #13 from GTNewHorizons/worldgen-black-white
Add whitelist and blacklist for generating flowers / mushrooms
2022-08-19 13:22:34 +02:00
Martin Robertz 528a9a4010 Update settings.gradle 2022-08-19 13:19:10 +02:00
miozune c6f94fabc9 updateBuildScript & disableSpotless 2022-08-19 17:53:25 +09:00
miozune 443aa9733b Revert "updateBuildScript & spotlessApply"
This reverts commit 9bf784e82c.
2022-08-19 16:50:37 +09:00
miozune 9bf784e82c updateBuildScript & spotlessApply 2022-08-19 11:52:26 +09:00
miozune 21ce111286 Add whitelist and blacklist for generating flowers / mushrooms 2022-08-19 11:48:24 +09:00
Jason Mitchell 19a4028e94 [ci skip] Migrate github actions to GTNH-Actions-Workflows 2022-07-16 10:47:08 -07:00
Martin Robertz ef026803d4 Merge pull request #12 from GTNewHorizons/terrapick-harvestlevel
Set harvest level for Terra Shatterer based on mana tier
2022-06-29 18:29:41 +02:00
miozune a5e1140a2b Set harvest level for Terra Shatterer based on mana tier 2022-06-29 19:33:23 +09:00
Martin Robertz 8648533ca9 Merge pull request #11 from GTNewHorizons/elven-dummy
Hide dummy recipes from Elven NEI handler
2022-05-25 23:48:58 +02:00
miozune d9042019e5 address reviews 2022-05-04 13:12:36 +09:00
miozune 538256cc45 ic2 maven 2022-05-02 19:37:23 +09:00
miozune 8b85a621e1 Hide dummy recipes from Elven NEI handler 2022-05-02 19:21:37 +09:00
Martin Robertz 12de9b630d Merge pull request #10 from GTNewHorizons/nbt-again
Remove dependency on GTNH fork of NEI
2022-03-05 12:25:56 +01:00
miozune 7102cc427f Remove dependency on GTNH fork of NEI 2022-02-27 12:51:56 +09:00
Martin Robertz 27053bfeab Merge pull request #4 from GTNewHorizons/nbt-nei
Fix irrelevant flowers show up in NEI
2022-02-25 12:17:48 +01:00
Martin Robertz da9019451b Merge pull request #7 from GTNewHorizons/allow-higher-potion-limit
Remove the >127 potion limit for known bugfixing coremods
2022-02-21 17:35:18 +01:00
Marcel '(Com)Buster' Sondaar b8f7f4ee03 Remove the >127 potion limit for known bugfixing coremods 2022-02-20 22:08:13 +01:00
Martin Robertz fe754d3733 Merge pull request #6 from GTNewHorizons/fix-recipe-ordering
Fix recipe ordering
2022-02-20 13:25:00 +01:00
Marcel '(Com)Buster' Sondaar 8c685b42bc Merge branch 'gtnh-master' into fix-recipe-ordering 2022-02-20 12:56:39 +01:00
Marcel '(Com)Buster' Sondaar a7fb7e7b7d Force recipes with catalysts to be on top of the search queue 2022-02-20 01:35:54 +01:00
miozune c0b8fffc40 Fix irrelevant flowers show up in NEI 2022-02-19 12:17:10 +09:00
Martin Robertz 208c74d877 Merge pull request #3 from GTNewHorizons/maven
update and optimize buildscripts
2022-02-13 13:09:54 +01:00
bombcar 74f0f48fd7 update and optimize buildscripts 2022-02-12 21:30:56 -06:00
122 changed files with 6071 additions and 3148 deletions

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
* text eol=lf
*.[jJ][aA][rR] binary
*.[pP][nN][gG] binary
*.[jJ][pP][gG] binary
*.[jJ][pP][eE][gG] binary
*.[gG][iI][fF] binary
*.[tT][iI][fF] binary
*.[tT][iI][fF][fF] binary
*.[iI][cC][oO] binary
*.[sS][vV][gG] text
*.[eE][pP][sS] binary
*.[xX][cC][fF] binary
*.[kK][aA][rR] binary
*.[mM]4[aA] binary
*.[mM][iI][dD] binary
*.[mM][iI][dD][iI] binary
*.[mM][pP]3 binary
*.[oO][gG][gG] binary
*.[rR][aA] binary
*.7[zZ] binary
*.[gG][zZ] binary
*.[tT][aA][rR] binary
*.[tT][gG][zZ] binary
*.[zZ][iI][pP] binary
*.[tT][cC][nN] binary
*.[sS][oO] binary
*.[dD][lL][lL] binary
*.[dD][yY][lL][iI][bB] binary
*.[pP][sS][dD] binary
*.[tT][tT][fF] binary
*.[oO][tT][fF] binary
*.[pP][aA][tT][cC][hH] -text
*.[bB][aA][tT] text eol=crlf
*.[cC][mM][dD] text eol=crlf
*.[pP][sS]1 text eol=crlf
*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary
-9
View File
@@ -1,9 +0,0 @@
directory="run/crash-reports"
if [ -d $directory ]; then
echo "Crash reports detected:"
cat $directory/*
exit 1
else
echo "No crash reports detected"
exit 0
fi
+33
View File
@@ -0,0 +1,33 @@
#!/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
+2 -34
View File
@@ -1,5 +1,3 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Build and test
@@ -11,35 +9,5 @@ on:
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup the workspace
run: ./gradlew setupCIWorkspace
- name: Build the mod
run: ./gradlew build
- name: Run server for 1 minute
run: |
mkdir run
echo "eula=true" > run/eula.txt
timeout 60 ./gradlew runServer || true
- name: Test no crashes happend
run: |
chmod +x .github/scripts/test-no-crash-reports.sh
.github/scripts/test-no-crash-reports.sh
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
secrets: inherit
+7 -44
View File
@@ -1,51 +1,14 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Release tagged build
on:
push:
tags:
- '*'
tags: [ '*' ]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup the workspace
run: ./gradlew setupCIWorkspace
- name: Build the mod
run: ./gradlew build
- name: Release under current tag
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ env.RELEASE_VERSION }}"
prerelease: false
title: "${{ env.RELEASE_VERSION }}"
files: build/libs/*.jar
- name: Publish to Maven
run: ./gradlew publish
env:
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
release-tags:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master
secrets: inherit
+3
View File
@@ -1,6 +1,7 @@
.gradle
.settings
/.idea/
/.vscode/
/run/
/build/
/eclipse/
@@ -27,3 +28,5 @@ whitelist.json
*.iws
src/main/resources/mixins.*.json
*.bat
*.DS_Store
!gradlew.bat
+2 -591
View File
@@ -1,594 +1,5 @@
//version: 1642484596
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates.
*/
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import java.util.concurrent.TimeUnit
buildscript {
repositories {
maven {
name = "forge"
url = "https://maven.minecraftforge.net"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
name = "Scala CI dependencies"
url = "https://repo1.maven.org/maven2/"
}
maven {
name = "jitpack"
url = "https://jitpack.io"
}
}
dependencies {
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.5'
}
}
//version: 1707058017
plugins {
id 'idea'
id 'scala'
id("org.ajoberstar.grgit") version("3.1.1")
id("com.github.johnrengelman.shadow") version("4.0.4")
id("com.palantir.git-version") version("0.12.3")
id("maven-publish")
}
apply plugin: 'forge'
def projectJavaVersion = JavaLanguageVersion.of(8)
java {
toolchain {
languageVersion.set(projectJavaVersion)
}
}
idea {
module {
inheritOutputDirs = true
downloadJavadoc = true
downloadSources = true
}
}
if(JavaVersion.current() != JavaVersion.VERSION_1_8) {
throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current())
}
checkPropertyExists("modName")
checkPropertyExists("modId")
checkPropertyExists("modGroup")
checkPropertyExists("autoUpdateBuildScript")
checkPropertyExists("minecraftVersion")
checkPropertyExists("forgeVersion")
checkPropertyExists("replaceGradleTokenInFile")
checkPropertyExists("gradleTokenModId")
checkPropertyExists("gradleTokenModName")
checkPropertyExists("gradleTokenVersion")
checkPropertyExists("gradleTokenGroupName")
checkPropertyExists("apiPackage")
checkPropertyExists("accessTransformersFile")
checkPropertyExists("usesMixins")
checkPropertyExists("mixinPlugin")
checkPropertyExists("mixinsPackage")
checkPropertyExists("coreModClass")
checkPropertyExists("containsMixinsAndOrCoreModOnly")
checkPropertyExists("usesShadowedDependencies")
checkPropertyExists("developmentEnvironmentUserName")
boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false
String javaSourceDir = "src/main/java/"
String scalaSourceDir = "src/main/scala/"
String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
}
if(apiPackage) {
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
}
}
if(accessTransformersFile) {
String targetFile = "src/main/resources/META-INF/" + accessTransformersFile
if(getFile(targetFile).exists() == false) {
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
}
}
if(usesMixins.toBoolean()) {
if(mixinsPackage.isEmpty() || mixinPlugin.isEmpty()) {
throw new GradleException("\"mixinPlugin\" requires \"mixinsPackage\" and \"mixinPlugin\" to be set!")
}
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
}
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala"
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) {
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava)
}
}
if(coreModClass) {
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala"
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) {
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava)
}
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS)
// Make sure GregTech build won't time out
System.setProperty("org.gradle.internal.http.connectionTimeout", 120000 as String)
System.setProperty("org.gradle.internal.http.socketTimeout", 120000 as String)
}
// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version
'git config core.fileMode false'.execute()
// Pulls version first from the VERSION env and then git tag
String identifiedVersion
try {
String versionOverride = System.getenv("VERSION") ?: null
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
version = minecraftVersion + "-" + identifiedVersion
}
catch (Exception e) {
throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag, or the VERSION override must be set!");
}
group = modGroup
if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
archivesBaseName = customArchiveBaseName
}
else {
archivesBaseName = modId
}
minecraft {
version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion
runDir = "run"
if (replaceGradleTokenInFile) {
replaceIn replaceGradleTokenInFile
if(gradleTokenModId) {
replace gradleTokenModId, modId
}
if(gradleTokenModName) {
replace gradleTokenModName, modName
}
if(gradleTokenVersion) {
replace gradleTokenVersion, versionDetails().lastTag
}
if(gradleTokenGroupName) {
replace gradleTokenGroupName, modGroup
}
}
}
if(file("addon.gradle").exists()) {
apply from: "addon.gradle"
}
apply from: 'repositories.gradle'
configurations {
implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored
implementation.extendsFrom(shadowCompile)
implementation.extendsFrom(shadeCompile)
}
repositories {
maven {
name = "Overmind forge repo mirror"
url = "https://gregtech.overminddl1.com/"
}
if(usesMixins.toBoolean()) {
maven {
name = "sponge"
url = "https://repo.spongepowered.org/repository/maven-public"
}
maven {
url = "https://jitpack.io"
}
}
}
dependencies {
if(usesMixins.toBoolean()) {
annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3")
annotationProcessor("com.google.guava:guava:24.1.1-jre")
annotationProcessor("com.google.code.gson:gson:2.8.6")
annotationProcessor("org.spongepowered:mixin:0.8-SNAPSHOT")
// using 0.8 to workaround a issue in 0.7 which fails mixin application
compile("com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH") {
// Mixin includes a lot of dependencies that are too up-to-date
exclude module: "launchwrapper"
exclude module: "guava"
exclude module: "gson"
exclude module: "commons-io"
exclude module: "log4j-core"
}
compile("com.github.GTNewHorizons:SpongeMixins:1.5.0")
}
}
apply from: 'dependencies.gradle'
def mixingConfigRefMap = "mixins." + modId + ".refmap.json"
def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap
def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg"
task generateAssets {
if(usesMixins.toBoolean()) {
getFile("/src/main/resources/mixins." + modId + ".json").text = """{
"required": true,
"minVersion": "0.7.11",
"package": "${modGroup}.${mixinsPackage}",
"plugin": "${modGroup}.${mixinPlugin}",
"refmap": "${mixingConfigRefMap}",
"target": "@env(DEFAULT)",
"compatibilityLevel": "JAVA_8"
}
"""
}
}
task relocateShadowJar(type: ConfigureShadowRelocation) {
target = tasks.shadowJar
prefix = modGroup + ".shadow"
}
shadowJar {
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
manifest {
attributes(getManifestAttributes())
}
minimize() // This will only allow shading for actually used classes
configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile]
dependsOn(relocateShadowJar)
}
jar {
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
manifest {
attributes(getManifestAttributes())
}
if(usesShadowedDependencies.toBoolean()) {
dependsOn(shadowJar)
enabled = false
}
}
reobf {
if(usesMixins.toBoolean()) {
addExtraSrgFile mixinSrg
}
}
afterEvaluate {
if(usesMixins.toBoolean()) {
tasks.compileJava {
options.compilerArgs += [
"-AreobfSrgFile=${tasks.reobf.srg}",
"-AoutSrgFile=${mixinSrg}",
"-AoutRefMapFile=${refMap}",
// Elan: from what I understand they are just some linter configs so you get some warning on how to properly code
"-XDenableSunApiLintControl",
"-XDignore.symbol.file"
]
}
}
}
runClient {
def arguments = []
if(usesMixins.toBoolean()) {
arguments += [
"--mods=../build/libs/$modId-${version}.jar",
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
]
}
if(developmentEnvironmentUserName) {
arguments += [
"--username",
developmentEnvironmentUserName
]
}
args(arguments)
}
runServer {
def arguments = []
if (usesMixins.toBoolean()) {
arguments += [
"--mods=../build/libs/$modId-${version}.jar",
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
]
}
args(arguments)
}
tasks.withType(JavaExec).configureEach {
javaLauncher.set(
javaToolchains.launcherFor {
languageVersion = projectJavaVersion
}
)
}
processResources
{
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand "minecraftVersion": project.minecraft.version,
"modVersion": versionDetails().lastTag,
"modId": modId,
"modName": modName
}
if(usesMixins.toBoolean()) {
from refMap
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
def getManifestAttributes() {
def manifestAttributes = [:]
if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) {
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
}
if(accessTransformersFile) {
manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
}
if(coreModClass) {
manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass]
}
if(usesMixins.toBoolean()) {
manifestAttributes += [
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
"MixinConfigs" : "mixins." + modId + ".json",
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
]
}
return manifestAttributes
}
task sourcesJar(type: Jar) {
from (sourceSets.main.allJava)
from (file("$projectDir/LICENSE"))
getArchiveClassifier().set('sources')
}
task shadowDevJar(type: ShadowJar) {
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
from sourceSets.main.output
getArchiveClassifier().set("dev")
manifest {
attributes(getManifestAttributes())
}
minimize() // This will only allow shading for actually used classes
configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile]
}
task relocateShadowDevJar(type: ConfigureShadowRelocation) {
target = tasks.shadowDevJar
prefix = modGroup + ".shadow"
}
task circularResolverJar(type: Jar) {
dependsOn(relocateShadowDevJar)
dependsOn(shadowDevJar)
enabled = false
}
task devJar(type: Jar) {
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
from sourceSets.main.output
getArchiveClassifier().set("dev")
manifest {
attributes(getManifestAttributes())
}
if(usesShadowedDependencies.toBoolean()) {
dependsOn(circularResolverJar)
enabled = false
}
}
task apiJar(type: Jar) {
from (sourceSets.main.allJava) {
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
}
from (sourceSets.main.output) {
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
}
from (sourceSets.main.resources.srcDirs) {
include("LICENSE")
}
getArchiveClassifier().set('api')
}
artifacts {
if(!noPublishedSources) {
archives sourcesJar
}
archives devJar
if(apiPackage) {
archives apiJar
}
}
// publishing
publishing {
publications {
maven(MavenPublication) {
artifact source: usesShadowedDependencies.toBoolean() ? shadowJar : jar, classifier: ""
if(!noPublishedSources) {
artifact source: sourcesJar, classifier: "src"
}
artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev"
if (apiPackage) {
artifact source: apiJar, classifier: "api"
}
groupId = System.getenv("ARTIFACT_GROUP_ID") ?: "com.github.GTNewHorizons"
artifactId = System.getenv("ARTIFACT_ID") ?: project.name
// Using the identified version, not project.version as it has the prepended 1.7.10
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
}
}
repositories {
maven {
url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases"
credentials {
username = System.getenv("MAVEN_USER") ?: "NONE"
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
}
}
}
}
// Updating
task updateBuildScript {
doLast {
if (performBuildScriptUpdate(projectDir.toString())) return
print("Build script already up-to-date!")
}
}
if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
if (autoUpdateBuildScript.toBoolean()) {
performBuildScriptUpdate(projectDir.toString())
} else {
println("Build script update available! Run 'gradle updateBuildScript'")
}
}
static URL availableBuildScriptUrl() {
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/build.gradle")
}
boolean performBuildScriptUpdate(String projectDir) {
if (isNewBuildScriptVersionAvailable(projectDir)) {
def buildscriptFile = getFile("build.gradle")
availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
return true
}
return false
}
boolean isNewBuildScriptVersionAvailable(String projectDir) {
Map parameters = ["connectTimeout": 2000, "readTimeout": 2000]
String currentBuildScript = getFile("build.gradle").getText()
String currentBuildScriptHash = getVersionHash(currentBuildScript)
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
String availableBuildScriptHash = getVersionHash(availableBuildScript)
boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash
return !isUpToDate
}
static String getVersionHash(String buildScriptContent) {
String versionLine = buildScriptContent.find("^//version: [a-z0-9]*")
if(versionLine != null) {
return versionLine.split(": ").last()
}
return ""
}
configure(updateBuildScript) {
group = 'forgegradle'
description = 'Updates the build script to the latest version'
}
// Helper methods
def checkPropertyExists(String propertyName) {
if (project.hasProperty(propertyName) == false) {
throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties")
}
}
def getFile(String relativePath) {
return new File(projectDir, relativePath)
id 'com.gtnewhorizons.gtnhconvention'
}
+11 -26
View File
@@ -1,33 +1,18 @@
// Add your dependencies here
dependencies {
compile("com.github.GTNewHorizons:Baubles:1.0.1.14:dev")
compile('com.github.GTNewHorizons:Baubles:1.0.4:dev')
compile("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev")
compile('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly("com.github.GTNewHorizons:Railcraft:9.13.5:api") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:StorageDrawers:1.11.11-GTNH:api") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.2.7:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.1.22-GTNH:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:CodeChickenLib:1.1.5.1:dev") {
transitive = false
}
compileOnly('com.github.GTNewHorizons:Railcraft:9.15.8:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.13.5-GTNH:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.4.8:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.6.0-GTNH:dev')
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.39:api') {transitive=false}
compile('com.github.GTNewHorizons:GTNHLib:0.2.11:dev')
compileOnly("curse.maven:cofh-lib-220333:2388749") {
transitive = false
}
compileOnly("com.mod-buildcraft:buildcraft:7.1.23:api") {
transitive = false
}
compileOnly("curse.maven:minefactory-reloaded-66672:2366150") {
transitive = false
}
compileOnly('curse.maven:cofh-lib-220333:2388748')
compileOnly('curse.maven:minefactory-reloaded-66672:2366150')
}
+157 -29
View File
@@ -1,64 +1,192 @@
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
# LOCAL to test local config updates.
gtnh.settings.blowdryerTag = 0.2.0
# Human-readable mod name, available for mcmod.info population.
modName = Botania
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
# Conventionally lowercase.
modId = Botania
# Root package of the mod, used to find various classes in other properties,
# mcmod.info substitution, enabling assertions in run tasks, etc.
modGroup = vazkii.botania
# WHY is there no version field?
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
# 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.
useModGroupForPublishing = false
# Will update your build.gradle automatically whenever an update is available
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
autoUpdateBuildScript = false
# Version of Minecraft to target
minecraftVersion = 1.7.10
# Version of Minecraft Forge to target
forgeVersion = 10.13.4.1614
# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name each time you
# restart Minecraft in development. Choose this dependent on your mod:
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
developmentEnvironmentUserName = "Developer"
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
channel = stable
# Define a source file of your project with:
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mods 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 = LibMisc.java
gradleTokenModId =
gradleTokenModName =
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
mappingsVersion = 12
# Defines other MCP mappings for dependency deobfuscation.
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
# Select a default username for testing your mod. You can always override this per-run by running
# `./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 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
# 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.
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
generateGradleTokenClass =
# Name of the token containing the project's current version to generate/replace.
gradleTokenVersion = GRADLETOKEN_VERSION
# [DEPRECATED] Mod ID replacement token.
gradleTokenModId =
# [DEPRECATED] Mod name replacement token.
gradleTokenModName =
# [DEPRECATED] Mod Group replacement token.
gradleTokenGroupName =
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can
# [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 = LibMisc.java
# 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.
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
apiPackage = api
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
# Example value: mymodid_at.cfg
accessTransformersFile =
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# There can be multiple files in a space-separated list.
# Example value: mymodid_at.cfg nei_at.cfg
accessTransformersFile = botania_at.cfg
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
# Adds some debug arguments like verbose output and class export.
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!
mixinsPackage =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatability only
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
# This parameter is for legacy compatibility only
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
coreModClass =
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly = false
# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required.
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
forceEnableMixins = false
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
# responsibility to check the license and request permission for distribution if required.
usesShadowedDependencies = false
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
# their own classes, making the minimization unreliable.
minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true
# Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
usesMavenPublishing = true
# Maven repository to publish the mod to.
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
#
# The project's ID on Modrinth. Can be either the slug or the ID.
# Leave this empty if you don't want to publish to Modrinth.
modrinthProjectId =
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
# Syntax: scope1-type1:name1;scope2-type2:name2;...
# Where scope can be one of [required, optional, incompatible, embedded],
# 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
modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
#
# The project's numeric ID on CurseForge. You can find this in the About Project box.
# Leave this empty if you don't want to publish on CurseForge.
curseForgeProjectId =
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
# Syntax: type1:name1;type2:name2;...
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
# and the name is the CurseForge project slug of the other mod.
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
curseForgeRelations =
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
# projects. New projects should not use this parameter.
#customArchiveBaseName =
# customArchiveBaseName =
# 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.
# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+
# versionPattern =
# Uncomment to prevent the source code from being published.
# noPublishedSources = true
# Uncomment this to disable Spotless checks.
# This should only be uncommented to keep it easier to sync with upstream/other forks.
# That is, if there is no other active fork/upstream, NEVER change this.
disableSpotless = true
# Uncomment this to disable Checkstyle checks (currently wildcard import check).
# disableCheckstyle = true
# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
# (force use delegated build).
# This is meant to be set in $HOME/.gradle/gradle.properties.
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build.
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
# ideaOverrideBuildType = idea
# Whether IDEA should run spotless checks when pressing the Build button.
# This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true
Binary file not shown.
+7 -5
View File
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+178 -117
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env sh
#!/bin/sh
#
# Copyright 2015 the original author or authors.
# Copyright © 2015-2021 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.
@@ -17,78 +17,111 @@
#
##############################################################################
##
## Gradle start up script for UN*X
##
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# This is normally unused
# 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 "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
MAX_FD=maximum
warn () {
echo "$*"
}
} >&2
die () {
echo
echo "$*"
echo
exit 1
}
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -97,92 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# 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" )
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
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,
# 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 \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
Vendored
+25 -33
View File
@@ -14,7 +14,7 @@
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -25,10 +25,14 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@@ -37,13 +41,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@@ -51,48 +55,36 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
: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 %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
+14 -6
View File
@@ -1,14 +1,22 @@
// Add any additional repositories for your dependencies here
repositories {
maven {
name = "GTNH Maven"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
name 'GTNH Maven'
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
allowInsecureProtocol
}
maven {
url "https://cursemaven.com"
name 'ic2'
url 'https://maven.ic2.player.to/'
url 'https://maven2.ic2.player.to/'
metadataSources {
mavenPom()
artifact()
}
}
maven {
url = "https://jitpack.io"
url 'https://cursemaven.com'
}
maven {
url 'https://jitpack.io'
}
}
+23
View File
@@ -0,0 +1,23 @@
pluginManagement {
repositories {
maven {
// RetroFuturaGradle
name "GTNH Maven"
url "https://nexus.gtnewhorizons.com/repository/public/"
mavenContent {
includeGroup("com.gtnewhorizons")
includeGroupByRegex("com\\.gtnewhorizons\\..+")
}
}
gradlePluginPortal()
mavenCentral()
mavenLocal()
}
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22'
}
@@ -443,8 +443,9 @@ public final class BotaniaAPI {
* @see BotaniaAPI#registerManaInfusionRecipe
*/
public static RecipeManaInfusion registerManaAlchemyRecipe(ItemStack output, Object input, int mana) {
RecipeManaInfusion recipe = registerManaInfusionRecipe(output, input, mana);
RecipeManaInfusion recipe = new RecipeManaInfusion(output, input, mana);
recipe.setAlchemy(true);
manaInfusionRecipes.add(0, recipe);
return recipe;
}
@@ -454,8 +455,9 @@ public final class BotaniaAPI {
* @see BotaniaAPI#registerManaInfusionRecipe
*/
public static RecipeManaInfusion registerManaConjurationRecipe(ItemStack output, Object input, int mana) {
RecipeManaInfusion recipe = registerManaInfusionRecipe(output, input, mana);
RecipeManaInfusion recipe = new RecipeManaInfusion(output, input, mana);
recipe.setConjuration(true);
manaInfusionRecipes.add(0, recipe);
return recipe;
}
@@ -1,26 +1,26 @@
/**
* This class was created by <Vindex>. 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
*
*/
package vazkii.botania.api.corporea;
public class CorporeaRequest {
public Object matcher;
public boolean checkNBT;
public int count;
public int foundItems = 0;
public int extractedItems = 0;
public CorporeaRequest(Object matcher, boolean checkNBT, int count) {
super();
this.matcher = matcher;
this.checkNBT = checkNBT;
this.count = count;
}
}
/**
* This class was created by <Vindex>. 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
*
*/
package vazkii.botania.api.corporea;
public class CorporeaRequest {
public Object matcher;
public boolean checkNBT;
public int count;
public int foundItems = 0;
public int extractedItems = 0;
public CorporeaRequest(Object matcher, boolean checkNBT, int count) {
super();
this.matcher = matcher;
this.checkNBT = checkNBT;
this.count = count;
}
}
@@ -1,57 +1,57 @@
/**
* This class was created by <Vindex>. 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
*
*/
package vazkii.botania.api.corporea;
import java.util.List;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
/**
* This interface wraps IInventory corporea works with in order to provide
* compatibility with different storage mods.
*
*/
public interface IWrappedInventory {
/**
* Break encapsulation and exposes original inventory.
*/
IInventory getWrappedObject();
/**
* Counts items in the inventory matching the request
*
* @param request
* - specifies what should be found
* @return List of ItemStack, individual stacks may exceed maxStackSize for
* purposes of counting huge amounts. To get final count requestor
* should sum stackSize of all stacks.
*/
List<ItemStack> countItems(CorporeaRequest request);
/**
* Convenience method for accessing spark over inventory
*/
ICorporeaSpark getSpark();
/**
* Extracts items matching request from the inventory.<br/>
* {@link CorporeaRequest#count} is updated to reflect how many items are
* yet to be extracted.<br/>
* {@link CorporeaRequest#foundItems} and
* {@link CorporeaRequest#extractedItems} are updated to reflect how many
* items were found and extracted.
*
* @param request
* @return List of ItemStacks to be delivered to the destination.
*/
List<ItemStack> extractItems(CorporeaRequest request);
}
/**
* This class was created by <Vindex>. 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
*
*/
package vazkii.botania.api.corporea;
import java.util.List;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
/**
* This interface wraps IInventory corporea works with in order to provide
* compatibility with different storage mods.
*
*/
public interface IWrappedInventory {
/**
* Break encapsulation and exposes original inventory.
*/
IInventory getWrappedObject();
/**
* Counts items in the inventory matching the request
*
* @param request
* - specifies what should be found
* @return List of ItemStack, individual stacks may exceed maxStackSize for
* purposes of counting huge amounts. To get final count requestor
* should sum stackSize of all stacks.
*/
List<ItemStack> countItems(CorporeaRequest request);
/**
* Convenience method for accessing spark over inventory
*/
ICorporeaSpark getSpark();
/**
* Extracts items matching request from the inventory.<br/>
* {@link CorporeaRequest#count} is updated to reflect how many items are
* yet to be extracted.<br/>
* {@link CorporeaRequest#foundItems} and
* {@link CorporeaRequest#extractedItems} are updated to reflect how many
* items were found and extracted.
*
* @param request
* @return List of ItemStacks to be delivered to the destination.
*/
List<ItemStack> extractItems(CorporeaRequest request);
}
@@ -0,0 +1,13 @@
package vazkii.botania.api.item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
* An item that implements this will allow some custom render. This will be called while the item is in the inventory,
* armor slot or bauble slots.
*/
public interface IInWorldRenderable
{
public void renderInWorld(EntityPlayer player, ItemStack stack);
}
@@ -43,11 +43,7 @@ public class RecipeElvenTrade {
List<ItemStack> validStacks = OreDictionary.getOres((String) input);
boolean found = false;
for(ItemStack ostack : validStacks) {
ItemStack cstack = ostack.copy();
if(cstack.getItemDamage() == Short.MAX_VALUE)
cstack.setItemDamage(stack.getItemDamage());
if(stack.isItemEqual(cstack)) {
if(OreDictionary.itemMatches(ostack, stack, false)) {
if(!stacksToRemove.contains(stack))
stacksToRemove.add(stack);
oredictIndex = j;
@@ -10,10 +10,6 @@
*/
package vazkii.botania.api.recipe;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@@ -22,8 +18,6 @@ import vazkii.botania.api.subtile.SubTileEntity;
public class RecipePureDaisy {
private static final Map<String, List<ItemStack>> oreMap = new HashMap();
Object input;
Block output;
int outputMeta;
@@ -53,21 +47,10 @@ public class RecipePureDaisy {
if(stack == null || stack.getItem() == null)
return false;
List<ItemStack> ores;
if(oreMap.containsKey(entry))
ores = oreMap.get(entry);
else {
ores = OreDictionary.getOres(entry);
oreMap.put(entry, ores);
}
for(ItemStack ostack : ores) {
ItemStack cstack = ostack.copy();
if(cstack.getItemDamage() == Short.MAX_VALUE)
cstack.setItemDamage(stack.getItemDamage());
if(stack.isItemEqual(cstack))
for(ItemStack ostack : OreDictionary.getOres(entry, false)) {
if(OreDictionary.itemMatches(ostack, stack, false)) {
return true;
}
}
return false;
@@ -29,6 +29,7 @@ import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.item.IExtendedWireframeCoordinateListProvider;
import vazkii.botania.api.item.IInWorldRenderable;
import vazkii.botania.api.item.IWireframeCoordinateListProvider;
import vazkii.botania.api.wand.ICoordBoundItem;
import vazkii.botania.api.wand.IWireframeAABBProvider;
@@ -36,6 +37,10 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public final class BoundTileRenderer {
public static int getWireframeColor(){
return Color.HSBtoRGB(ClientTickHandler.ticksInGame % 200 / 200F, 0.6F, 1F);
}
@SubscribeEvent
public void onWorldRenderLast(RenderWorldLastEvent event) {
GL11.glPushMatrix();
@@ -49,7 +54,7 @@ public final class BoundTileRenderer {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
ItemStack stack = player.getCurrentEquippedItem();
int color = Color.HSBtoRGB(ClientTickHandler.ticksInGame % 200 / 200F, 0.6F, 1F);
int color = getWireframeColor();
if(stack != null && stack.getItem() instanceof ICoordBoundItem) {
ChunkCoordinates coords = ((ICoordBoundItem) stack.getItem()).getBinding(stack);
if(coords != null)
@@ -82,6 +87,11 @@ public final class BoundTileRenderer {
renderBlockOutlineAt(coords, color, 5F);
}
}
if(stackInSlot != null && stackInSlot.getItem() instanceof IInWorldRenderable) {
IInWorldRenderable provider = (IInWorldRenderable) stackInSlot.getItem();
provider.renderInWorld(player,stackInSlot);
}
}
GL11.glEnable(GL11.GL_DEPTH_TEST);
@@ -0,0 +1,56 @@
package vazkii.botania.client.core.handler;
import net.minecraft.client.settings.KeyBinding;
import vazkii.botania.common.network.PacketHandler;
import vazkii.botania.common.network.PacketLokiClear;
import vazkii.botania.common.network.PacketLokiMirror;
import vazkii.botania.common.network.PacketLokiToggle;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class KeyHandler {
private static final KeyBinding keyToggleRingOfLoki= new KeyBinding("botaniamisc.toggleLoki", 0, "botaniamisc.keyCategory");
private static final KeyBinding keyRingOfLokiClear= new KeyBinding("botaniamisc.ringOfLokiClear", 0, "botaniamisc.keyCategory");
private static final KeyBinding keyRingOfLokiMirror= new KeyBinding("botaniamisc.ringOfLokiMirror", 0, "botaniamisc.keyCategory");
public KeyHandler() {
FMLCommonHandler.instance().bus().register(this);
ClientRegistry.registerKeyBinding(keyToggleRingOfLoki);
ClientRegistry.registerKeyBinding(keyRingOfLokiClear);
ClientRegistry.registerKeyBinding(keyRingOfLokiMirror);
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void key(InputEvent.KeyInputEvent event){
checkAndPerformKeyActions();
}
private void checkAndPerformKeyActions(){
if (keyToggleRingOfLoki.isPressed()){
toggleRingLoki();
}
if(keyRingOfLokiClear.isPressed()){
ringOfLokiClear();
}
if(keyRingOfLokiMirror.isPressed()){
toggleRingLokiMirroring();
}
}
private static void toggleRingLoki() {
PacketHandler.INSTANCE.sendToServer(new PacketLokiToggle());
}
private static void ringOfLokiClear() {
PacketHandler.INSTANCE.sendToServer(new PacketLokiClear());
}
private static void toggleRingLokiMirroring() {
PacketHandler.INSTANCE.sendToServer(new PacketLokiMirror());
}
}
@@ -17,11 +17,11 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.Tessellator;
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.ResourceLocation;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.core.handler.ClientTickHandler;
@@ -243,7 +243,7 @@ public final class RenderHelper {
KeyBinding[] keys = Minecraft.getMinecraft().gameSettings.keyBindings;
for(KeyBinding otherKey : keys)
if(otherKey.getKeyDescription().equals(keyName)) {
key = Keyboard.getKeyName(otherKey.getKeyCode());
key = GameSettings.getKeyDisplayString(otherKey.getKeyCode());
break;
}
@@ -14,6 +14,8 @@ import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import it.unimi.dsi.fastutil.ints.Int2IntMap;
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
import net.minecraft.client.renderer.OpenGlHelper;
import org.apache.logging.log4j.Level;
@@ -33,6 +35,8 @@ public final class ShaderHelper {
private static final int VERT = ARBVertexShader.GL_VERTEX_SHADER_ARB;
private static final int FRAG = ARBFragmentShader.GL_FRAGMENT_SHADER_ARB;
private static final Int2IntMap TIME_UNIFORM_LOCATIONS = new Int2IntOpenHashMap();
public static int pylonGlow = 0;
public static int enchanterRune = 0;
public static int manaPool = 0;
@@ -67,8 +71,8 @@ public final class ShaderHelper {
ARBShaderObjects.glUseProgramObjectARB(shader);
if(shader != 0) {
int time = ARBShaderObjects.glGetUniformLocationARB(shader, "time");
ARBShaderObjects.glUniform1iARB(time, ClientTickHandler.ticksInGame);
int timeUniform = TIME_UNIFORM_LOCATIONS.computeIfAbsent(shader, s -> ARBShaderObjects.glGetUniformLocationARB(shader, "time"));
ARBShaderObjects.glUniform1iARB(timeUniform, ClientTickHandler.ticksInGame);
if(callback != null)
callback.call(shader);
@@ -55,6 +55,7 @@ import vazkii.botania.client.core.handler.PersistentVariableHelper;
import vazkii.botania.client.core.handler.SubTileRadiusRenderHandler;
import vazkii.botania.client.core.handler.TooltipHandler;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.client.core.handler.KeyHandler;
import vazkii.botania.client.fx.FXSparkle;
import vazkii.botania.client.fx.FXWisp;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
@@ -219,6 +220,7 @@ public class ClientProxy extends CommonProxy {
MinecraftForge.EVENT_BUS.register(new SubTileRadiusRenderHandler());
MinecraftForge.EVENT_BUS.register(new MultiblockRenderHandler());
MinecraftForge.EVENT_BUS.register(new SkyblockRenderEvents());
MinecraftForge.EVENT_BUS.register(new KeyHandler());
FMLCommonHandler.instance().bus().register(new CorporeaAutoCompleteHandler());
if(ConfigHandler.enableSeasonalFeatures) {
@@ -1,99 +0,0 @@
/**
* 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
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Mar 16, 2015, 6:42:40 PM (GMT)]
*/
package vazkii.botania.client.gui.bag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import vazkii.botania.client.gui.SlotLocked;
public class ContainerFlowerBag extends Container {
InventoryFlowerBag flowerBagInv;
public ContainerFlowerBag(EntityPlayer player) {
int i;
int j;
int slot = player.inventory.currentItem;
IInventory playerInv = player.inventory;
flowerBagInv = new InventoryFlowerBag(player, slot);
for(i = 0; i < 2; ++i)
for(j = 0; j < 8; ++j) {
int k = j + i * 8;
addSlotToContainer(new SlotFlower(flowerBagInv, k, 17 + j * 18, 26 + i * 18, k));
}
for(i = 0; i < 3; ++i)
for(j = 0; j < 9; ++j)
addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
for(i = 0; i < 9; ++i) {
if(player.inventory.currentItem == i)
addSlotToContainer(new SlotLocked(playerInv, i, 8 + i * 18, 142));
else addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {
boolean can = flowerBagInv.isUseableByPlayer(player);
if(!can)
onContainerClosed(player);
return can;
}
@Override
public void onContainerClosed(EntityPlayer player) {
super.onContainerClosed(player);
flowerBagInv.pushInventory();
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
ItemStack itemstack = null;
Slot slot = (Slot)inventorySlots.get(p_82846_2_);
if(slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if(p_82846_2_ < 16) {
if(!mergeItemStack(itemstack1, 16, 52, true))
return null;
} else {
int i = itemstack.getItemDamage();
if(i < 16) {
Slot slot1 = (Slot)inventorySlots.get(i);
if(slot1.isItemValid(itemstack) && !mergeItemStack(itemstack1, i, i + 1, true))
return null;
}
}
if(itemstack1.stackSize == 0)
slot.putStack((ItemStack)null);
else slot.onSlotChanged();
if(itemstack1.stackSize == itemstack.stackSize)
return null;
slot.onPickupFromSlot(p_82846_1_, itemstack1);
}
return itemstack;
}
}
@@ -1,74 +0,0 @@
/**
* 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
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Mar 16, 2015, 6:42:43 PM (GMT)]
*/
package vazkii.botania.client.gui.bag;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.block.ModBlocks;
public class GuiFlowerBag extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_FLOWER_BAG);
public GuiFlowerBag(EntityPlayer player) {
super(new ContainerFlowerBag(player));
}
@Override
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String s = StatCollector.translateToLocal("item.botania:flowerBag.name");
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_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(texture);
int k = (width - xSize) / 2;
int l = (height - ySize) / 2;
drawTexturedModalRect(k, l, 0, 0, xSize, ySize);
List<Slot> slotList = inventorySlots.inventorySlots;
for(Slot slot : slotList)
if(slot instanceof SlotFlower) {
SlotFlower slotf = (SlotFlower) slot;
if(!slotf.getHasStack()) {
ItemStack stack = new ItemStack(ModBlocks.flower, 0, slotf.color);
int x = guiLeft + slotf.xDisplayPosition;
int y = guiTop + slotf.yDisplayPosition;
RenderHelper.enableGUIStandardItemLighting();
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, stack, x, y);
RenderHelper.disableStandardItemLighting();
mc.fontRenderer.drawStringWithShadow("0", x + 11, y + 9, 0xFF6666);
}
}
}
@Override
protected boolean checkHotbarKeys(int p_146983_1_) {
return false;
}
}
@@ -1,160 +0,0 @@
/**
* 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
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Mar 16, 2015, 6:42:56 PM (GMT)]
*/
package vazkii.botania.client.gui.bag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import vazkii.botania.common.item.ItemFlowerBag;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibItemNames;
public class InventoryFlowerBag implements IInventory {
private static final ItemStack[] FALLBACK_INVENTORY = new ItemStack[16];
EntityPlayer player;
int slot;
ItemStack[] stacks = null;
boolean invPushed = false;
ItemStack storedInv = null;
public InventoryFlowerBag(EntityPlayer player, int slot) {
this.player = player;
this.slot = slot;
}
public static boolean isFlowerBag(ItemStack stack) {
return stack != null && stack.getItem() == ModItems.flowerBag;
}
ItemStack getStack() {
ItemStack stack = player.inventory.getStackInSlot(slot);
if(stack != null)
storedInv = stack;
return stack;
}
ItemStack[] getInventory() {
if(stacks != null)
return stacks;
ItemStack stack = getStack();
if(isFlowerBag(getStack())) {
stacks = ItemFlowerBag.loadStacks(stack);
return stacks;
}
return FALLBACK_INVENTORY;
}
public void pushInventory() {
if(invPushed)
return;
ItemStack stack = getStack();
if(stack == null)
stack = storedInv;
if(stack != null) {
ItemStack[] inv = getInventory();
ItemFlowerBag.setStacks(stack, inv);
}
invPushed = true;
}
@Override
public int getSizeInventory() {
return 16;
}
@Override
public ItemStack getStackInSlot(int i) {
return getInventory()[i];
}
@Override
public ItemStack decrStackSize(int i, int j) {
ItemStack[] inventorySlots = getInventory();
if (inventorySlots[i] != null) {
ItemStack stackAt;
if (inventorySlots[i].stackSize <= j) {
stackAt = inventorySlots[i];
inventorySlots[i] = null;
return stackAt;
} else {
stackAt = inventorySlots[i].splitStack(j);
if (inventorySlots[i].stackSize == 0)
inventorySlots[i] = null;
return stackAt;
}
}
return null;
}
@Override
public ItemStack getStackInSlotOnClosing(int i) {
return getStackInSlot(i);
}
@Override
public void setInventorySlotContents(int i, ItemStack itemstack) {
ItemStack[] inventorySlots = getInventory();
inventorySlots[i] = itemstack;
}
@Override
public int getInventoryStackLimit() {
return isFlowerBag(getStack()) ? 64 : 0;
}
@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
return isFlowerBag(getStack());
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
return isFlowerBag(getStack());
}
@Override
public boolean hasCustomInventoryName() {
return false;
}
@Override
public void openInventory() {
// NO-OP
}
@Override
public void closeInventory() {
// NO-OP
}
@Override
public String getInventoryName() {
return LibItemNames.FLOWER_BAG;
}
@Override
public void markDirty() {
// NO-OP
}
}
@@ -1,39 +0,0 @@
/**
* 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
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Mar 16, 2015, 7:20:05 PM (GMT)]
*/
package vazkii.botania.client.gui.bag;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import vazkii.botania.common.block.ModBlocks;
public class SlotFlower extends Slot {
InventoryFlowerBag inv;
int color;
public SlotFlower(InventoryFlowerBag p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_, int color) {
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
this.color = color;
inv = p_i1824_1_;
}
@Override
public void onSlotChange(ItemStack oldStack, ItemStack newStack) {
inv.setInventorySlotContents(color, newStack);
}
@Override
public boolean isItemValid(ItemStack stack) {
return stack.getItem() == Item.getItemFromBlock(ModBlocks.flower) && stack.getItemDamage() == color;
}
}
@@ -0,0 +1,89 @@
package vazkii.botania.client.gui.bags;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import vazkii.botania.client.gui.SlotLocked;
public abstract class ContainerMagicPlantBag extends Container {
protected InventoryMagicPlantBag magicPlantInv;
public ContainerMagicPlantBag(EntityPlayer player) {
int i;
int j;
IInventory playerInv = player.inventory;
addMagicPlantSlots(player);
for(i = 0; i < 3; ++i) {
for(j = 0; j < 9; ++j) {
addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for(i = 0; i < 9; ++i) {
if(player.inventory.currentItem == i) {
addSlotToContainer(new SlotLocked(playerInv, i, 8 + i * 18, 142));
}
else addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 142));
}
}
public abstract void addMagicPlantSlots(EntityPlayer player);
@Override
public boolean canInteractWith(EntityPlayer player) {
boolean can = magicPlantInv.isUseableByPlayer(player);
if(!can)
onContainerClosed(player);
return can;
}
@Override
public void onContainerClosed(EntityPlayer player) {
super.onContainerClosed(player);
magicPlantInv.pushInventory();
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
ItemStack itemstack = null;
Slot slot = (Slot)inventorySlots.get(p_82846_2_);
if(slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if(p_82846_2_ < 16) {
if(!mergeItemStack(itemstack1, 16, 52, true))
return null;
} else {
int i = itemstack.getItemDamage();
if(i < 16) {
Slot slot1 = (Slot)inventorySlots.get(i);
if(slot1.isItemValid(itemstack) && !mergeItemStack(itemstack1, i, i + 1, true))
return null;
}
}
if(itemstack1.stackSize == 0)
slot.putStack((ItemStack)null);
else slot.onSlotChanged();
if(itemstack1.stackSize == itemstack.stackSize)
return null;
slot.onPickupFromSlot(p_82846_1_, itemstack1);
}
return itemstack;
}
}
@@ -0,0 +1,65 @@
package vazkii.botania.client.gui.bags;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
public abstract class GuiMagicPlantBag extends GuiContainer {
private final ResourceLocation texture;
public GuiMagicPlantBag(ContainerMagicPlantBag container, ResourceLocation texture) {
super(container);
this.texture = texture;
}
@Override
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
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_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(texture);
int k = (width - xSize) / 2;
int l = (height - ySize) / 2;
drawTexturedModalRect(k, l, 0, 0, xSize, ySize);
List<Slot> slotList = inventorySlots.inventorySlots;
for(Slot slot : slotList)
if(slot instanceof SlotMagicPlant) {
SlotMagicPlant slotf = (SlotMagicPlant) slot;
if(!slotf.getHasStack()) {
ItemStack stack = new ItemStack(itemTypeAllowed(), 0, slotf.color);
int x = guiLeft + slotf.xDisplayPosition;
int y = guiTop + slotf.yDisplayPosition;
RenderHelper.enableGUIStandardItemLighting();
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, stack, x, y);
RenderHelper.disableStandardItemLighting();
mc.fontRenderer.drawStringWithShadow("0", x + 11, y + 9, 0xFF6666);
}
}
}
@Override
protected boolean checkHotbarKeys(int p_146983_1_) {
return false;
}
protected abstract Block itemTypeAllowed();
protected abstract String getLocalizedNameKey();
}
@@ -0,0 +1,148 @@
package vazkii.botania.client.gui.bags;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import vazkii.botania.common.item.bag.ItemBagBase;
public abstract class InventoryMagicPlantBag implements IInventory {
private static final ItemStack[] FALLBACK_INVENTORY = new ItemStack[16];
EntityPlayer player;
int slot;
ItemStack[] stacks = null;
boolean invPushed = false;
ItemStack storedInv = null;
public InventoryMagicPlantBag(EntityPlayer player, int slot) {
this.player = player;
this.slot = slot;
}
ItemStack getStack() {
ItemStack stack = player.inventory.getStackInSlot(slot);
if(stack != null)
storedInv = stack;
return stack;
}
public void pushInventory() {
if(invPushed)
return;
ItemStack stack = getStack();
if(stack == null)
stack = storedInv;
if(stack != null) {
ItemStack[] inv = getInventory();
ItemBagBase.setStacks(stack, inv);
}
invPushed = true;
}
ItemStack[] getInventory() {
if(stacks != null)
return stacks;
ItemStack stack = getStack();
if(isMagicPlantBag(getStack())) {
stacks = ItemBagBase.loadStacks(stack);
return stacks;
}
return FALLBACK_INVENTORY;
}
@Override
public int getSizeInventory() {
return 16;
}
@Override
public ItemStack getStackInSlot(int slotIn) {
return getInventory()[slotIn];
}
@Override
public ItemStack decrStackSize(int index, int count) {
ItemStack[] inventorySlots = getInventory();
if (inventorySlots[index] != null) {
ItemStack stackAt;
if (inventorySlots[index].stackSize <= count) {
stackAt = inventorySlots[index];
inventorySlots[index] = null;
return stackAt;
} else {
stackAt = inventorySlots[index].splitStack(count);
if (inventorySlots[index].stackSize == 0)
inventorySlots[index] = null;
return stackAt;
}
}
return null;
}
@Override
public ItemStack getStackInSlotOnClosing(int index) {
return getStackInSlot(index);
}
@Override
public void setInventorySlotContents(int index, ItemStack stack) {
ItemStack[] inventorySlots = getInventory();
inventorySlots[index] = stack;
}
@Override
public String getInventoryName() {
return getBagName();
}
@Override
public boolean hasCustomInventoryName() {
return false;
}
@Override
public int getInventoryStackLimit() {
return isMagicPlantBag(getStack()) ? 64 : 0;
}
@Override
public void markDirty() {
// NO-OP
}
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
return isMagicPlantBag(getStack());
}
@Override
public void openInventory() {
// NO-OP
}
@Override
public void closeInventory() {
// NO-OP
}
@Override
public boolean isItemValidForSlot(int index, ItemStack stack) {
return isMagicPlantBag(getStack());
}
protected abstract String getBagName();
public abstract boolean isMagicPlantBag(ItemStack stack);
}
@@ -0,0 +1,32 @@
package vazkii.botania.client.gui.bags;
import net.minecraft.block.Block;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import vazkii.botania.common.block.ModBlocks;
public abstract class SlotMagicPlant extends Slot {
InventoryMagicPlantBag inv;
int color;
public SlotMagicPlant(InventoryMagicPlantBag p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_, int color) {
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
this.color = color;
inv = p_i1824_1_;
}
@Override
public void onSlotChange(ItemStack oldStack, ItemStack newStack) {
inv.setInventorySlotContents(color, newStack);
}
@Override
public boolean isItemValid(ItemStack stack) {
return stack.getItem() == Item.getItemFromBlock(getValidBlock()) && stack.getItemDamage() == color;
}
protected abstract Block getValidBlock();
}
@@ -0,0 +1,23 @@
package vazkii.botania.client.gui.bags.flowerBag;
import net.minecraft.entity.player.EntityPlayer;
import vazkii.botania.client.gui.bags.ContainerMagicPlantBag;
public class ContainerFlowerBag extends ContainerMagicPlantBag {
public ContainerFlowerBag(EntityPlayer player) {
super(player);
}
@Override
public void addMagicPlantSlots(EntityPlayer player) {
int slot = player.inventory.currentItem;
magicPlantInv = new InventoryFlowerBag(player, slot);
for(int i = 0; i < 2; ++i) {
for (int j = 0; j < 8; ++j) {
int k = j + i * 8;
addSlotToContainer(new SlotFlower(magicPlantInv, k, 17 + j * 18, 26 + i * 18, k));
}
}
}
}
@@ -0,0 +1,27 @@
package vazkii.botania.client.gui.bags.flowerBag;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import vazkii.botania.client.gui.bags.GuiMagicPlantBag;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.block.ModBlocks;
public class GuiFlowerBag extends GuiMagicPlantBag {
private static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_FLOWER_BAG);
public GuiFlowerBag(EntityPlayer player) {
super(new ContainerFlowerBag(player), texture);
}
@Override
protected Block itemTypeAllowed() {
return ModBlocks.flower;
}
@Override
protected String getLocalizedNameKey() {
return "item.botania:flowerBag.name";
}
}
@@ -0,0 +1,23 @@
package vazkii.botania.client.gui.bags.flowerBag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import vazkii.botania.client.gui.bags.InventoryMagicPlantBag;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibItemNames;
public class InventoryFlowerBag extends InventoryMagicPlantBag {
public InventoryFlowerBag(EntityPlayer player, int slot) {
super(player, slot);
}
@Override
public boolean isMagicPlantBag(ItemStack stack) {
return stack != null && stack.getItem() == ModItems.flowerBag;
}
@Override
protected String getBagName() {
return LibItemNames.FLOWER_BAG;
}
}
@@ -0,0 +1,18 @@
package vazkii.botania.client.gui.bags.flowerBag;
import net.minecraft.block.Block;
import vazkii.botania.client.gui.bags.InventoryMagicPlantBag;
import vazkii.botania.client.gui.bags.SlotMagicPlant;
import vazkii.botania.common.block.ModBlocks;
public class SlotFlower extends SlotMagicPlant {
public SlotFlower(InventoryMagicPlantBag p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_, int color) {
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_, color);
}
@Override
protected Block getValidBlock() {
return ModBlocks.flower;
}
}
@@ -0,0 +1,23 @@
package vazkii.botania.client.gui.bags.shroomBag;
import net.minecraft.entity.player.EntityPlayer;
import vazkii.botania.client.gui.bags.ContainerMagicPlantBag;
public class ContainerShroomBag extends ContainerMagicPlantBag {
public ContainerShroomBag(EntityPlayer player) {
super(player);
}
@Override
public void addMagicPlantSlots(EntityPlayer player) {
int slot = player.inventory.currentItem;
magicPlantInv = new InventoryShroomBag(player, slot);
for(int i = 0; i < 2; ++i) {
for (int j = 0; j < 8; ++j) {
int k = j + i * 8;
addSlotToContainer(new SlotShroom(magicPlantInv, k, 17 + j * 18, 26 + i * 18, k));
}
}
}
}
@@ -0,0 +1,27 @@
package vazkii.botania.client.gui.bags.shroomBag;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import vazkii.botania.client.gui.bags.GuiMagicPlantBag;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.block.ModBlocks;
public class GuiShroomBag extends GuiMagicPlantBag {
private static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_SHROOM_BAG);
public GuiShroomBag(EntityPlayer player) {
super(new ContainerShroomBag(player), texture);
}
@Override
protected Block itemTypeAllowed() {
return ModBlocks.mushroom;
}
@Override
protected String getLocalizedNameKey() {
return "item.botania:shroomBag.name";
}
}
@@ -0,0 +1,23 @@
package vazkii.botania.client.gui.bags.shroomBag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import vazkii.botania.client.gui.bags.InventoryMagicPlantBag;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibItemNames;
public class InventoryShroomBag extends InventoryMagicPlantBag {
public InventoryShroomBag(EntityPlayer player, int slot) {
super(player, slot);
}
@Override
public boolean isMagicPlantBag(ItemStack stack) {
return stack != null && stack.getItem() == ModItems.shroomBag;
}
@Override
protected String getBagName() {
return LibItemNames.SHROOM_BAG;
}
}
@@ -0,0 +1,18 @@
package vazkii.botania.client.gui.bags.shroomBag;
import net.minecraft.block.Block;
import vazkii.botania.client.gui.bags.InventoryMagicPlantBag;
import vazkii.botania.client.gui.bags.SlotMagicPlant;
import vazkii.botania.common.block.ModBlocks;
public class SlotShroom extends SlotMagicPlant {
public SlotShroom(InventoryMagicPlantBag p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_, int color) {
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_, color);
}
@Override
protected Block getValidBlock() {
return ModBlocks.mushroom;
}
}
@@ -15,6 +15,7 @@ import vazkii.botania.api.brew.IBrewContainer;
import vazkii.botania.api.brew.IBrewItem;
import vazkii.botania.api.recipe.RecipeBrew;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.item.ModItems;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.PositionedStack;
@@ -131,7 +132,7 @@ public class RecipeHandlerBrewery extends TemplateRecipeHandler {
continue;
CachedBreweryRecipe crecipe = new CachedBreweryRecipe(recipe);
if(crecipe.contains(crecipe.inputs, ingredient))
if(ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.inputs, ingredient))
arecipes.add(crecipe);
}
}
@@ -2,12 +2,12 @@ package vazkii.botania.client.integration.nei.recipe;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraftforge.oredict.OreDictionary;
@@ -15,7 +15,6 @@ import net.minecraftforge.oredict.OreDictionary;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.ILexicon;
import vazkii.botania.api.recipe.RecipeElvenTrade;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.block.BlockAlfPortal;
@@ -23,6 +22,7 @@ import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
import vazkii.botania.common.core.helper.ItemNBTHelper;
public class RecipeHandlerElvenTrade extends TemplateRecipeHandler {
@@ -114,10 +114,7 @@ public class RecipeHandlerElvenTrade extends TemplateRecipeHandler {
public void loadCraftingRecipes(String outputId, Object... results) {
if(outputId.equals("botania.elvenTrade") && hasElvenKnowledge()) {
if(hasElvenKnowledge()) {
for(RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
if(recipe == null)
continue;
for(RecipeElvenTrade recipe : filteredElvenTradeRecipes()) {
arecipes.add(new CachedElvenTradeRecipe(recipe));
}
}
@@ -127,10 +124,7 @@ public class RecipeHandlerElvenTrade extends TemplateRecipeHandler {
@Override
public void loadCraftingRecipes(ItemStack result) {
if(hasElvenKnowledge()) {
for(RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
if(recipe == null)
continue;
for(RecipeElvenTrade recipe : filteredElvenTradeRecipes()) {
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result))
arecipes.add(new CachedElvenTradeRecipe(recipe));
}
@@ -140,10 +134,7 @@ public class RecipeHandlerElvenTrade extends TemplateRecipeHandler {
@Override
public void loadUsageRecipes(ItemStack ingredient) {
if(hasElvenKnowledge()) {
for(RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
if(recipe == null)
continue;
for(RecipeElvenTrade recipe : filteredElvenTradeRecipes()) {
CachedElvenTradeRecipe crecipe = new CachedElvenTradeRecipe(recipe);
if(crecipe.contains(crecipe.inputs, ingredient))
arecipes.add(crecipe);
@@ -151,4 +142,28 @@ public class RecipeHandlerElvenTrade extends TemplateRecipeHandler {
}
}
// 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));
}
}
}
@@ -23,6 +23,7 @@ import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
import vazkii.botania.common.core.helper.ItemNBTHelper;
public class RecipeHandlerManaPool extends TemplateRecipeHandler {
@@ -66,25 +67,6 @@ public class RecipeHandlerManaPool extends TemplateRecipeHandler {
return otherStacks;
}
@Override
public boolean contains(Collection<PositionedStack> ingredients, ItemStack ingredient) {
if(ingredients == inputs) {
boolean skippedPool = false;
for(PositionedStack stack : ingredients) {
if(!skippedPool) {
skippedPool = true;
continue;
}
if(stack.contains(ingredient))
return true;
}
}
return super.contains(ingredients, ingredient);
}
}
@Override
@@ -136,7 +118,7 @@ public class RecipeHandlerManaPool extends TemplateRecipeHandler {
if(recipe == null)
continue;
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result))
if(ItemNBTHelper.areStacksSameTypeCraftingWithNBT(recipe.getOutput(), result))
arecipes.add(new CachedManaPoolRecipe(recipe));
}
}
@@ -148,7 +130,7 @@ public class RecipeHandlerManaPool extends TemplateRecipeHandler {
continue;
CachedManaPoolRecipe crecipe = new CachedManaPoolRecipe(recipe);
if(crecipe.contains(crecipe.getIngredients(), ingredient) || crecipe.contains(crecipe.getOtherStacks(), ingredient))
if(ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getIngredients(), ingredient) || ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getOtherStacks(), ingredient))
arecipes.add(crecipe);
}
}
@@ -19,6 +19,7 @@ import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
import vazkii.botania.common.core.helper.ItemNBTHelper;
public class RecipeHandlerPetalApothecary extends TemplateRecipeHandler {
@@ -121,7 +122,7 @@ public class RecipeHandlerPetalApothecary extends TemplateRecipeHandler {
if(recipe == null)
continue;
if(recipe.getOutput().stackTagCompound != null && NEIServerUtils.areStacksSameType(recipe.getOutput(), result) || recipe.getOutput().stackTagCompound == null && NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result) && recipe.getOutput().getItem() != Items.skull)
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));
}
}
@@ -133,7 +134,7 @@ public class RecipeHandlerPetalApothecary extends TemplateRecipeHandler {
continue;
CachedPetalApothecaryRecipe crecipe = getCachedRecipe(recipe);
if(crecipe.contains(crecipe.inputs, ingredient) && recipe.getOutput().getItem() != Items.skull)
if(ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.inputs, ingredient) && recipe.getOutput().getItem() != Items.skull)
arecipes.add(crecipe);
}
}
@@ -15,6 +15,7 @@ import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipePureDaisy;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import vazkii.botania.common.lib.LibBlockNames;
import codechicken.lib.gui.GuiDraw;
@@ -57,17 +58,6 @@ public class RecipeHandlerPureDaisy extends TemplateRecipeHandler {
return otherStacks;
}
@Override
public boolean contains(Collection<PositionedStack> ingredients, ItemStack ingredient) {
if(ingredients == inputs) {
for(PositionedStack stack : ingredients)
if(stack.contains(ingredient))
return true;
}
return super.contains(ingredients, ingredient);
}
}
@Override
@@ -117,7 +107,7 @@ public class RecipeHandlerPureDaisy extends TemplateRecipeHandler {
if(recipe == null)
continue;
if(NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(recipe.getOutput()), result))
if(ItemNBTHelper.areStacksSameTypeCraftingWithNBT(new ItemStack(recipe.getOutput()), result))
arecipes.add(new CachedPureDaisyRecipe(recipe));
}
}
@@ -129,7 +119,7 @@ public class RecipeHandlerPureDaisy extends TemplateRecipeHandler {
continue;
CachedPureDaisyRecipe crecipe = new CachedPureDaisyRecipe(recipe);
if(crecipe.contains(crecipe.getIngredients(), ingredient) || crecipe.contains(crecipe.getOtherStacks(), ingredient))
if(ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getIngredients(), ingredient) || ItemNBTHelper.cachedRecipeContainsWithNBT(crecipe.getOtherStacks(), ingredient))
arecipes.add(crecipe);
}
}
@@ -44,6 +44,7 @@ public final class LibResources {
public static final String GUI_NEI_BLANK = PREFIX_GUI + "neiBlank.png";
public static final String GUI_NEI_BREWERY = PREFIX_GUI + "neiBrewery.png";
public static final String GUI_FLOWER_BAG = PREFIX_GUI + "flowerBag.png";
public static final String GUI_SHROOM_BAG = PREFIX_GUI + "shroomBag.png";
public static final String GUI_BAUBLE_BOX = PREFIX_GUI + "baubleBox.png";
public static final String GUI_HUD_ICONS = PREFIX_GUI + "hudIcons.png";
public static final String GUI_STENCIL = PREFIX_GUI + "stencil.png";
@@ -10,7 +10,8 @@
*/
package vazkii.botania.client.render.tile;
import java.awt.*;
import java.awt.Color;
import java.util.Random;
import net.minecraft.client.Minecraft;
@@ -16,13 +16,21 @@ import net.minecraftforge.client.event.RenderWorldLastEvent;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.world.WorldTypeSkyblock;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import java.util.stream.IntStream;
public final class SkyblockRenderEvents {
@SubscribeEvent
public void onRender(RenderWorldLastEvent event) {
World world = Minecraft.getMinecraft().theWorld;
if(ConfigHandler.enableFancySkybox && world.provider.dimensionId == 0 && (ConfigHandler.enableFancySkyboxInNormalWorlds || WorldTypeSkyblock.isWorldSkyblock(Minecraft.getMinecraft().theWorld))) {
boolean renderFancySkybox = ConfigHandler.enableFancySkybox && (
(ConfigHandler.enableFancySkyboxInNormalWorlds && (world.provider.dimensionId == 0) ) ||
(ConfigHandler.enableFancySkyboxInDimension && ConfigHandler.fancySkyboxDimensions.contains(world.provider.dimensionId)) ||
(WorldTypeSkyblock.isWorldSkyblock(Minecraft.getMinecraft().theWorld))
);
if(renderFancySkybox) {
if(!(world.provider.getSkyRenderer() instanceof SkyblockSkyRenderer))
world.provider.setSkyRenderer(new SkyblockSkyRenderer());
}
@@ -63,7 +63,6 @@ public class Botania {
storageDrawersLoaded = Loader.isModLoaded("StorageDrawers");
lightHelper = coloredLightsLoaded ? new LightHelperColored() : new LightHelperVanilla();
proxy.preInit(event);
}
@EventHandler
@@ -32,7 +32,7 @@ import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.Botania;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.item.block.ItemCubeWithMetadataAndName;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -57,7 +57,7 @@ public class BlockAltGrass extends BlockMod implements ILexiconable {
@Override
public Block setBlockName(String par1Str) {
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
GameRegistry.registerBlock(this, ItemCubeWithMetadataAndName.class, par1Str);
return super.setBlockName(par1Str);
}
@@ -25,7 +25,7 @@ import net.minecraft.world.World;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.item.block.ItemCubeWithMetadataAndName;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -55,7 +55,7 @@ public class BlockLivingrock extends BlockMod implements ILexiconable {
@Override
public Block setBlockName(String par1Str) {
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
GameRegistry.registerBlock(this, ItemCubeWithMetadataAndName.class, par1Str);
return super.setBlockName(par1Str);
}
@@ -26,7 +26,7 @@ import net.minecraft.world.World;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.item.block.ItemCubeWithMetadataAndName;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -64,7 +64,7 @@ public class BlockLivingwood extends BlockMod implements ILexiconable {
}
void register(String name) {
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, name);
GameRegistry.registerBlock(this, ItemCubeWithMetadataAndName.class, name);
}
@Override
@@ -13,11 +13,14 @@ package vazkii.botania.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.world.IBlockAccess;
import vazkii.botania.api.recipe.IElvenItem;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.core.BotaniaCreativeTab;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.item.block.ItemBlockElven;
import vazkii.botania.common.item.block.ItemBlockMod;
import vazkii.botania.common.item.block.ItemCubeMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -35,7 +38,7 @@ public class BlockMod extends Block {
@Override
public Block setBlockName(String par1Str) {
if(shouldRegisterInNameSet())
GameRegistry.registerBlock(this, this instanceof IElvenItem ? ItemBlockElven.class : ItemBlockMod.class, par1Str);
GameRegistry.registerBlock(this, this instanceof IElvenItem ? ItemBlockElven.class : ItemCubeMod.class, par1Str);
return super.setBlockName(par1Str);
}
@@ -59,5 +62,9 @@ public class BlockMod extends Block {
return true;
}
@Override
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
return !ConfigHandler.noMobSpawnOnBlocks;
}
}
@@ -14,10 +14,13 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.core.BotaniaCreativeTab;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.item.block.ItemBlockMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
@@ -63,4 +66,8 @@ public abstract class BlockModContainer<T extends TileEntity> extends BlockConta
@Override
public abstract T createNewTileEntity(World world, int meta);
@Override
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
return !ConfigHandler.noMobSpawnOnBlocks;
}
}
@@ -42,7 +42,7 @@ import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.block.tile.TileCraftCrate;
import vazkii.botania.common.block.tile.TileOpenCrate;
import vazkii.botania.common.block.tile.TileSimpleInventory;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.item.block.ItemCubeWithMetadataAndName;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -76,7 +76,7 @@ public class BlockOpenCrate extends BlockModContainer implements ILexiconable, I
@Override
public Block setBlockName(String par1Str) {
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
GameRegistry.registerBlock(this, ItemCubeWithMetadataAndName.class, par1Str);
return super.setBlockName(par1Str);
}
@@ -29,7 +29,7 @@ import vazkii.botania.api.wand.IWandable;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.block.tile.TileCamo;
import vazkii.botania.common.block.tile.TilePlatform;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.item.block.ItemCubeWithMetadataAndName;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -59,7 +59,7 @@ public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable
@Override
public Block setBlockName(String par1Str) {
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
GameRegistry.registerBlock(this, ItemCubeWithMetadataAndName.class, par1Str);
return super.setBlockName(par1Str);
}
@@ -26,7 +26,7 @@ import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.block.BlockMod;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.item.block.ItemCubeWithMetadataAndName;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -72,7 +72,7 @@ public class Block18Stone extends BlockMod implements ILexiconable {
@Override
public Block setBlockName(String par1Str) {
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
GameRegistry.registerBlock(this, ItemCubeWithMetadataAndName.class, par1Str);
return super.setBlockName(par1Str);
}
@@ -26,7 +26,7 @@ import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.block.BlockMod;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.item.block.ItemCubeWithMetadataAndName;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -56,7 +56,7 @@ public class BlockCustomBrick extends BlockMod implements ILexiconable {
@Override
public Block setBlockName(String par1Str) {
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
GameRegistry.registerBlock(this, ItemCubeWithMetadataAndName.class, par1Str);
return super.setBlockName(par1Str);
}
@@ -26,7 +26,7 @@ import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.block.BlockMod;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.item.block.ItemCubeWithMetadataAndName;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -73,7 +73,7 @@ public class BlockEndStoneBrick extends BlockMod implements ILexiconable {
@Override
public Block setBlockName(String par1Str) {
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
GameRegistry.registerBlock(this, ItemCubeWithMetadataAndName.class, par1Str);
return super.setBlockName(par1Str);
}
@@ -23,7 +23,7 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.block.BlockMod;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.item.block.ItemCubeWithMetadataAndName;
import vazkii.botania.common.lib.LibBlockNames;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
@@ -54,7 +54,7 @@ public class BlockPavement extends BlockMod {
@Override
public Block setBlockName(String par1Str) {
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
GameRegistry.registerBlock(this, ItemCubeWithMetadataAndName.class, par1Str);
return super.setBlockName(par1Str);
}
@@ -25,7 +25,7 @@ import net.minecraft.world.World;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.block.BlockMod;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.item.block.ItemCubeWithMetadataAndName;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -52,7 +52,7 @@ public class BlockPetalBlock extends BlockMod implements ILexiconable {
@Override
public Block setBlockName(String par1Str) {
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
GameRegistry.registerBlock(this, ItemCubeWithMetadataAndName.class, par1Str);
return super.setBlockName(par1Str);
}
@@ -30,7 +30,7 @@ import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.client.render.block.InterpolatedIcon;
import vazkii.botania.common.block.BlockMod;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.item.block.ItemCubeWithMetadataAndName;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@@ -64,7 +64,7 @@ public class BlockPrismarine extends BlockMod implements ILexiconable {
@Override
public Block setBlockName(String par1Str) {
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
GameRegistry.registerBlock(this, ItemCubeWithMetadataAndName.class, par1Str);
return super.setBlockName(par1Str);
}
@@ -22,7 +22,7 @@ import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.core.BotaniaCreativeTab;
import vazkii.botania.common.item.block.ItemBlockMod;
import vazkii.botania.common.item.block.ItemCubeMod;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -44,7 +44,7 @@ public class BlockReeds extends BlockRotatedPillar implements ILexiconable {
@Override
public Block setBlockName(String par1Str) {
GameRegistry.registerBlock(this, ItemBlockMod.class, par1Str);
GameRegistry.registerBlock(this, ItemCubeMod.class, par1Str);
return super.setBlockName(par1Str);
}
@@ -26,7 +26,7 @@ import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.block.BlockMod;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.item.block.ItemCubeWithMetadataAndName;
import vazkii.botania.common.lexicon.LexiconData;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -75,7 +75,7 @@ public class BlockBiomeStone extends BlockMod implements ILexiconable {
@Override
public Block setBlockName(String par1Str) {
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
GameRegistry.registerBlock(this, ItemCubeWithMetadataAndName.class, par1Str);
return super.setBlockName(par1Str);
}
@@ -5,14 +5,17 @@ import java.util.Random;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.core.BotaniaCreativeTab;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.item.block.ItemBlockModSlab;
import vazkii.botania.common.lexicon.LexiconData;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -76,5 +79,8 @@ public abstract class BlockModSlab extends BlockSlab implements ILexiconable {
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
return LexiconData.decorativeBlocks;
}
@Override
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
return !ConfigHandler.noMobSpawnOnBlocks;
}
}
@@ -8,7 +8,7 @@ import net.minecraft.world.World;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.core.BotaniaCreativeTab;
import vazkii.botania.common.item.block.ItemBlockMod;
import vazkii.botania.common.item.block.ItemCubeMod;
import vazkii.botania.common.lexicon.LexiconData;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -23,7 +23,7 @@ public class BlockModStairs extends BlockStairs implements ILexiconable {
@Override
public Block setBlockName(String par1Str) {
GameRegistry.registerBlock(this, ItemBlockMod.class, par1Str);
GameRegistry.registerBlock(this, ItemCubeMod.class, par1Str);
return super.setBlockName(par1Str);
}
@@ -23,7 +23,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.item.block.ItemBlockMod;
import vazkii.botania.common.item.block.ItemCubeMod;
import vazkii.botania.common.lexicon.LexiconData;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -51,7 +51,7 @@ public class BlockModWall extends BlockWall implements ILexiconable {
}
public void register(String name) {
GameRegistry.registerBlock(this, ItemBlockMod.class, name);
GameRegistry.registerBlock(this, ItemCubeMod.class, name);
}
@Override
@@ -17,7 +17,7 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.item.block.ItemCubeWithMetadataAndName;
import cpw.mods.fml.common.registry.GameRegistry;
public class BlockVariantWall extends BlockModWall {
@@ -37,7 +37,7 @@ public class BlockVariantWall extends BlockModWall {
@Override
public void register(String name) {
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, name);
GameRegistry.registerBlock(this, ItemCubeWithMetadataAndName.class, name);
}
@Override
@@ -10,17 +10,21 @@
*/
package vazkii.botania.common.block.tile;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.ILexicon;
import vazkii.botania.api.lexicon.multiblock.Multiblock;
@@ -61,16 +65,20 @@ public class TileAlfPortal extends TileMod {
private static final String TAG_TICKS_OPEN = "ticksOpen";
private static final String TAG_TICKS_SINCE_LAST_ITEM = "ticksSinceLastItem";
private static final String TAG_STACK_COUNT = "stackCount";
private static final String TAG_STACK_COUNT = "stackCount"; // Input stacks
private static final String TAG_OUTPUT_COUNT = "outputStackCount";
private static final String TAG_STACK = "portalStack";
private static final String TAG_OUTPUT_STACK = "outputStack";
private static final String TAG_PORTAL_FLAG = "_elvenPortal";
List<ItemStack> stacksIn = new ArrayList();
List<ItemStack> stacksIn = new ArrayList<>();
Deque<ItemStack> stacksOut = new ArrayDeque<>();
public int ticksOpen = 0;
int ticksSinceLastItem = 0;
private boolean closeNow = false;
private boolean hasUnloadedParts = false;
private boolean explode = false;
private static final Function<int[], int[]> CONVERTER_X_Z = new Function<int[], int[]>() {
@Override
@@ -142,14 +150,18 @@ public class TileAlfPortal extends TileMod {
ItemStack stack = item.getEntityItem();
if(stack != null && (!(stack.getItem() instanceof IElvenItem) || !((IElvenItem) stack.getItem()).isElvenItem(stack)) && !item.getEntityData().hasKey(TAG_PORTAL_FLAG)) {
item.setDead();
addItem(stack);
if (validateItemUsage(stack)) {
addItem(stack);
}
ticksSinceLastItem = 0;
}
}
if(ticksSinceLastItem >= 4) {
if(!worldObj.isRemote)
if(!worldObj.isRemote) {
resolveRecipes();
spawnOutput();
}
}
}
} else closeNow = false;
@@ -164,11 +176,40 @@ public class TileAlfPortal extends TileMod {
for(int i = 0; i < 36; i++)
blockParticle(meta);
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, newMeta, 1 | 2);
} else if(explode) {
worldObj.createExplosion(null, xCoord + .5, yCoord + 2.0, zCoord + .5, 3f, true);
explode = false;
}
hasUnloadedParts = false;
}
private boolean validateItemUsage(ItemStack inputStack) {
if (inputStack.getItem() instanceof ILexicon) {
// lexicon does not formally have a recipe and is handled in a special branch
// in resolveRecipe(), therefore it needs a special branch here as well
return true;
}
for(RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
for(Object o : recipe.getInputs()) {
if(o instanceof String) {
for(ItemStack target : OreDictionary.getOres((String) o)) {
if(OreDictionary.itemMatches(target, inputStack, false))
return true;
}
} else if(o instanceof ItemStack) {
ItemStack target = (ItemStack) o;
if(inputStack.getItem() == target.getItem() && inputStack.getItemDamage() == target.getItemDamage())
return true;
}
}
}
if(inputStack.getItem() == Items.bread) //Don't teleport bread. (See also: #2403)
explode = true;
return false;
}
private void blockParticle(int meta) {
int i = worldObj.rand.nextInt(AIR_POSITIONS.length);
double[] pos = new double[] {
@@ -210,12 +251,16 @@ public class TileAlfPortal extends TileMod {
}
void resolveRecipes() {
if (stacksIn.isEmpty()) {
return;
}
int i = 0;
for(ItemStack stack : stacksIn) {
if(stack != null && stack.getItem() instanceof ILexicon) {
((ILexicon) stack.getItem()).unlockKnowledge(stack, BotaniaAPI.elvenKnowledge);
ItemLexicon.setForcedPage(stack, LexiconData.elvenMessage.getUnlocalizedName());
spawnItem(stack);
addOutput(stack);
stacksIn.remove(i);
return;
}
@@ -224,9 +269,48 @@ public class TileAlfPortal extends TileMod {
for(RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
if(recipe.matches(stacksIn, false)) {
recipe.matches(stacksIn, true);
spawnItem(recipe.getOutput().copy());
break;
ItemStack output = recipe.getOutput().copy();
int stackSize = output.stackSize;
output.stackSize = 0;
while (recipe.matches(stacksIn, true)) {
output.stackSize += stackSize;
}
addOutput(output);
if (stacksIn.isEmpty()) break;
}
}
}
void addOutput(ItemStack stack) {
if (stack == null) {
return;
}
if (stacksOut.isEmpty()) {
stacksOut.addLast(stack);
return;
}
ItemStack lastStack = stacksOut.getLast();
if (stack.isItemEqual(lastStack)) {
lastStack.stackSize += stack.stackSize;
} else {
stacksOut.addLast(stack);
}
}
void spawnOutput() {
if (!stacksOut.isEmpty()) {
ItemStack stack = stacksOut.getFirst();
if (stack.stackSize > 1) {
--stack.stackSize;
stack = stack.copy();
stack.stackSize = 1;
spawnItem(stack);
} else if (stack.stackSize == 1) {
stacksOut.removeFirst();
spawnItem(stack);
} else {
stacksOut.removeFirst();
}
}
}
@@ -250,6 +334,15 @@ public class TileAlfPortal extends TileMod {
cmp.setTag(TAG_STACK + i, stackcmp);
i++;
}
cmp.setInteger(TAG_OUTPUT_COUNT, stacksOut.size());
i = 0;
for(ItemStack stack : stacksOut) {
NBTTagCompound stackcmp = new NBTTagCompound();
stack.writeToNBT(stackcmp);
cmp.setTag(TAG_OUTPUT_STACK + i, stackcmp);
i++;
}
}
@Override
@@ -263,6 +356,14 @@ public class TileAlfPortal extends TileMod {
ItemStack stack = ItemStack.loadItemStackFromNBT(stackcmp);
stacksIn.add(stack);
}
count = cmp.getInteger(TAG_OUTPUT_COUNT);
stacksOut.clear();
for(int i = 0; i < count; i++) {
NBTTagCompound stackcmp = cmp.getCompoundTag(TAG_OUTPUT_STACK + i);
ItemStack stack = ItemStack.loadItemStackFromNBT(stackcmp);
stacksOut.addLast(stack);
}
}
@Override
@@ -11,6 +11,7 @@
package vazkii.botania.common.brew.potion;
import java.util.List;
import java.util.stream.Collectors;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
@@ -31,17 +32,20 @@ public class PotionBloodthirst extends PotionMod {
super(ConfigHandler.potionIDBloodthirst, LibPotionNames.BLOODTHIRST, false, 0xC30000, 3);
MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent
public void onSpawn(LivingSpawnEvent.CheckSpawn event) {
if(event.getResult() != Result.ALLOW && event.entityLiving instanceof IMob) {
List<EntityPlayer> players = event.world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(event.x - RANGE, event.y - RANGE, event.z - RANGE, event.x + RANGE, event.y + RANGE, event.z + RANGE));
for(EntityPlayer player : players)
if (event.getResult() != Result.ALLOW && event.entityLiving instanceof IMob) {
double rangeSq = RANGE * RANGE;
List<EntityPlayer> players = (List<EntityPlayer>) event.world.playerEntities.stream()
.filter(player -> ((EntityPlayer) player).getDistanceSq(event.x, event.y, event.z) <= rangeSq)
.map(player -> (EntityPlayer) player)
.collect(Collectors.toList());
for (EntityPlayer player : players) {
if(hasEffect(player) && !hasEffect(player, ModPotions.emptiness)) {
event.setResult(Result.ALLOW);
return;
}
}
}
}
}
@@ -11,6 +11,7 @@
package vazkii.botania.common.brew.potion;
import java.util.List;
import java.util.stream.Collectors;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
@@ -33,14 +34,18 @@ public class PotionEmptiness extends PotionMod {
@SubscribeEvent
public void onSpawn(LivingSpawnEvent.CheckSpawn event) {
if(event.getResult() != Result.ALLOW && event.entityLiving instanceof IMob) {
List<EntityPlayer> players = event.world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(event.x - RANGE, event.y - RANGE, event.z - RANGE, event.x + RANGE, event.y + RANGE, event.z + RANGE));
for(EntityPlayer player : players)
if(hasEffect(player)) {
if (event.getResult() != Result.ALLOW && event.entityLiving instanceof IMob) {
double rangeSq = RANGE * RANGE;
List<EntityPlayer> players = (List<EntityPlayer>) event.world.playerEntities.stream()
.filter(player -> ((EntityPlayer) player).getDistanceSq(event.x, event.y, event.z) <= rangeSq)
.map(player -> (EntityPlayer) player)
.collect(Collectors.toList());
for (EntityPlayer player : players) {
if (hasEffect(player)) {
event.setResult(Result.DENY);
return;
}
}
}
}
}
@@ -23,6 +23,8 @@ import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import java.util.Arrays;
public class BiomeDecorationHandler {
@SubscribeEvent(priority = EventPriority.LOWEST)
@@ -37,47 +39,73 @@ public class BiomeDecorationHandler {
if(!flowers)
return;
int dist = Math.min(8, Math.max(1, ConfigHandler.flowerPatchSize));
for(int i = 0; i < ConfigHandler.flowerQuantity; i++) {
if(event.rand.nextInt(ConfigHandler.flowerPatchChance) == 0) {
int x = event.chunkX + event.rand.nextInt(16) + 8;
int z = event.chunkZ + event.rand.nextInt(16) + 8;
int y = event.world.getTopSolidOrLiquidBlock(x, z);
if (ConfigHandler.flowerDimensionWhitelist.length == 0
|| Arrays.stream(ConfigHandler.flowerDimensionWhitelist).anyMatch(
d -> d == event.world.provider.dimensionId
)) {
if (Arrays.stream(ConfigHandler.flowerDimensionBlacklist).noneMatch(
d -> d == event.world.provider.dimensionId
)) {
generateFlowers(event);
}
}
int color = event.rand.nextInt(16);
boolean primus = event.rand.nextInt(380) == 0;
if (ConfigHandler.mushroomDimensionWhitelist.length == 0
|| Arrays.stream(ConfigHandler.mushroomDimensionWhitelist).anyMatch(
d -> d == event.world.provider.dimensionId
)) {
if (Arrays.stream(ConfigHandler.mushroomDimensionBlacklist).noneMatch(
d -> d == event.world.provider.dimensionId
)) {
generateMushrooms(event);
}
}
}
}
for(int j = 0; j < ConfigHandler.flowerDensity * ConfigHandler.flowerPatchChance; j++) {
int x1 = x + event.rand.nextInt(dist * 2) - dist;
int y1 = y + event.rand.nextInt(4) - event.rand.nextInt(4);
int z1 = z + event.rand.nextInt(dist * 2) - dist;
private void generateFlowers(DecorateBiomeEvent.Decorate event) {
int dist = Math.min(8, Math.max(1, ConfigHandler.flowerPatchSize));
for(int i = 0; i < ConfigHandler.flowerQuantity; i++) {
if(event.rand.nextInt(ConfigHandler.flowerPatchChance) == 0) {
int x = event.chunkX + event.rand.nextInt(16) + 8;
int z = event.chunkZ + event.rand.nextInt(16) + 8;
int y = event.world.getTopSolidOrLiquidBlock(x, z);
if(event.world.isAirBlock(x1, y1, z1) && (!event.world.provider.hasNoSky || y1 < 127) && ModBlocks.flower.canBlockStay(event.world, x1, y1, z1)) {
if(primus) {
event.world.setBlock(x1, y1, z1, ModBlocks.specialFlower, 0, 2);
TileSpecialFlower flower = (TileSpecialFlower) event.world.getTileEntity(x1, y1, z1);
flower.setSubTile(event.rand.nextBoolean() ? LibBlockNames.SUBTILE_NIGHTSHADE_PRIME : LibBlockNames.SUBTILE_DAYBLOOM_PRIME);
SubTileDaybloom subtile = (SubTileDaybloom) flower.getSubTile();
subtile.setPrimusPosition();
} else {
event.world.setBlock(x1, y1, z1, ModBlocks.flower, color, 2);
if(event.rand.nextDouble() < ConfigHandler.flowerTallChance && ((BlockModFlower) ModBlocks.flower).func_149851_a(event.world, x1, y1, z1, false))
BlockModFlower.placeDoubleFlower(event.world, x1, y1, z1, color, 0);
}
int color = event.rand.nextInt(16);
boolean primus = event.rand.nextInt(380) == 0;
for(int j = 0; j < ConfigHandler.flowerDensity * ConfigHandler.flowerPatchChance; j++) {
int x1 = x + event.rand.nextInt(dist * 2) - dist;
int y1 = y + event.rand.nextInt(4) - event.rand.nextInt(4);
int z1 = z + event.rand.nextInt(dist * 2) - dist;
if(event.world.isAirBlock(x1, y1, z1) && (!event.world.provider.hasNoSky || y1 < 127) && ModBlocks.flower.canBlockStay(event.world, x1, y1, z1)) {
if(primus) {
event.world.setBlock(x1, y1, z1, ModBlocks.specialFlower, 0, 2);
TileSpecialFlower flower = (TileSpecialFlower) event.world.getTileEntity(x1, y1, z1);
flower.setSubTile(event.rand.nextBoolean() ? LibBlockNames.SUBTILE_NIGHTSHADE_PRIME : LibBlockNames.SUBTILE_DAYBLOOM_PRIME);
SubTileDaybloom subtile = (SubTileDaybloom) flower.getSubTile();
subtile.setPrimusPosition();
} else {
event.world.setBlock(x1, y1, z1, ModBlocks.flower, color, 2);
if(event.rand.nextDouble() < ConfigHandler.flowerTallChance && ((BlockModFlower) ModBlocks.flower).func_149851_a(event.world, x1, y1, z1, false))
BlockModFlower.placeDoubleFlower(event.world, x1, y1, z1, color, 0);
}
}
}
}
}
}
for(int i = 0; i < ConfigHandler.mushroomQuantity; i++) {
int x = event.chunkX + event.rand.nextInt(16) + 8;
int z = event.chunkZ + event.rand.nextInt(16) + 8;
int y = event.rand.nextInt(26) + 4;
private void generateMushrooms(DecorateBiomeEvent.Decorate event) {
for(int i = 0; i < ConfigHandler.mushroomQuantity; i++) {
int x = event.chunkX + event.rand.nextInt(16) + 8;
int z = event.chunkZ + event.rand.nextInt(16) + 8;
int y = event.rand.nextInt(26) + 4;
int color = event.rand.nextInt(16);
if(event.world.isAirBlock(x, y, z) && ModBlocks.mushroom.canBlockStay(event.world, x, y, z))
event.world.setBlock(x, y, z, ModBlocks.mushroom, color, 2);
}
int color = event.rand.nextInt(16);
if(event.world.isAirBlock(x, y, z) && ModBlocks.mushroom.canBlockStay(event.world, x, y, z))
event.world.setBlock(x, y, z, ModBlocks.mushroom, color, 2);
}
}
}
@@ -11,10 +11,13 @@
package vazkii.botania.common.core.handler;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.HashMap;
import java.util.Map;
import java.util.ArrayList;
import java.util.stream.Collectors;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
@@ -24,7 +27,6 @@ import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import vazkii.botania.common.Botania;
import vazkii.botania.common.lib.LibMisc;
import vazkii.botania.common.lib.LibPotionNames;
import cpw.mods.fml.client.event.ConfigChangedEvent;
@@ -41,9 +43,10 @@ public final class ConfigHandler {
public static int hardcorePassiveGeneration = 72000;
public static boolean noMobSpawnOnBlocks = true;
public static boolean useAdaptativeConfig = true;
public static boolean enableDefaultRecipes = false;
public static boolean enableDefaultRecipes = true;
public static boolean useShaders = true;
public static boolean lexiconRotatingItems = true;
@@ -66,6 +69,8 @@ public final class ConfigHandler {
public static boolean enableArmorModels = true;
public static boolean enableFancySkybox = true;
public static boolean enableFancySkyboxInNormalWorlds = false;
public static boolean enableFancySkyboxInDimension = false;
public static HashSet<Integer> fancySkyboxDimensions = new HashSet<Integer>() {};
public static int manaBarHeight = 29;
public static int flightBarHeight = 49;
@@ -94,13 +99,18 @@ public final class ConfigHandler {
public static int harvestLevelWeight = 2;
public static int harvestLevelBore = 3;
public static int flowerQuantity = 0;
public static int flowerQuantity = 2;
public static int flowerDensity = 2;
public static int flowerPatchSize = 6;
public static int flowerPatchChance = 16;
public static double flowerTallChance = 0.05;
public static int mushroomQuantity = 40;
public static int[] flowerDimensionWhitelist = new int[]{};
public static int[] flowerDimensionBlacklist = new int[]{};
public static int[] mushroomDimensionWhitelist = new int[]{};
public static int[] mushroomDimensionBlacklist = new int[]{};
private static boolean verifiedPotionArray = false;
private static int potionArrayLimit = 0;
@@ -127,6 +137,9 @@ public final class ConfigHandler {
useAdaptativeConfig = loadPropBool("adaptativeConfig.enabled", desc, useAdaptativeConfig);
adaptor = new ConfigAdaptor(useAdaptativeConfig);
desc = "Mobs cannot Spawn on Blocks";
noMobSpawnOnBlocks = loadPropBool("noMobSpawnOnBlocks", desc, noMobSpawnOnBlocks);
desc = "Set this to false to disable the use of shaders for some of the mod's renders.";
useShaders = loadPropBool("shaders.enabled", desc, useShaders);
@@ -189,7 +202,13 @@ public final class ConfigHandler {
desc = "Set this to true to enable the fancy skybox in non Garden of Glass worlds. (Does not require Garden of Glass loaded to use, needs 'fancySkybox.enable' to be true as well)";
enableFancySkyboxInNormalWorlds = loadPropBool("fancySkybox.normalWorlds", desc, enableFancySkyboxInNormalWorlds);
desc = "Set this to true to enable the fancy skybox in custom dimension. (Does not require Garden of Glass loaded to use, needs 'fancySkybox.enable' to be true as well)";
enableFancySkyboxInDimension = loadPropBool("fancySkybox.customDim", desc, enableFancySkyboxInDimension);
desc = "The ID of the dimension to use";
fancySkyboxDimensions = loadPropIntSet("fancySkybox.customDimID", desc, fancySkyboxDimensions);
desc = "The height of the mana display bar in above the XP bar. You can change this if you have a mod that changes where the XP bar is.";
manaBarHeight = loadPropInt("manaBar.height", desc, manaBarHeight);
@@ -286,6 +305,18 @@ public final class ConfigHandler {
desc = "Enables all built-in recipes. This can be false for expert modpacks that wish to supply their own.";
enableDefaultRecipes = loadPropBool("recipes.enabled", desc, enableDefaultRecipes);
desc = "Whitelist of which dimension generates Botania flowers. Empty means any dimension can.";
flowerDimensionWhitelist = loadPropIntArray("worldgen.flower.dimensionWhitelist", desc, flowerDimensionWhitelist);
desc = "Blacklist of which dimension generates Botania flowers.";
flowerDimensionBlacklist = loadPropIntArray("worldgen.flower.dimensionBlacklist", desc, flowerDimensionBlacklist);
desc = "Whitelist of which dimension generates Botania mushrooms. Empty means any dimension can.";
mushroomDimensionWhitelist = loadPropIntArray("worldgen.mushroom.dimensionWhitelist", desc, mushroomDimensionWhitelist);
desc = "Blacklist of which dimension generates Botania mushrooms.";
mushroomDimensionBlacklist = loadPropIntArray("worldgen.mushroom.dimensionBlacklist", desc, mushroomDimensionBlacklist);
potionIDSoulCross = loadPropPotionId(LibPotionNames.SOUL_CROSS, potionIDSoulCross);
potionIDFeatherfeet = loadPropPotionId(LibPotionNames.FEATHER_FEET, potionIDFeatherfeet);
potionIDEmptiness = loadPropPotionId(LibPotionNames.EMPTINESS, potionIDEmptiness);
@@ -334,6 +365,29 @@ public final class ConfigHandler {
return prop.getBoolean(default_);
}
public static int[] loadPropIntArray(String propName, String desc, int[] intArray) {
Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, intArray);
prop.comment = desc;
if(adaptor != null)
adaptor.adaptPropertyIntArray(prop, prop.getIntList());
return prop.getIntList();
}
public static HashSet<Integer> loadPropIntSet(String propName, String desc, HashSet<Integer> intSet) {
int[] defaultValues = intSet.stream().mapToInt(Number::intValue).toArray();
Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, defaultValues);
prop.comment = desc;
if(adaptor != null)
adaptor.adaptPropertyIntArray(prop, prop.getIntList());
return Arrays.stream(prop.getIntList())
.boxed()
.collect(Collectors.toCollection(HashSet::new));
}
public static int loadPropPotionId(String propName, int default_) {
if(!verifiedPotionArray)
verifyPotionArray();
@@ -351,7 +405,10 @@ public final class ConfigHandler {
private static void verifyPotionArray() {
if(Loader.isModLoaded("DragonAPI"))
potionArrayLimit = Potion.potionTypes.length;
else potionArrayLimit = 127;
else if(Loader.isModLoaded("hodgepodge"))
potionArrayLimit = 255;
else
potionArrayLimit = 127;
verifiedPotionArray = true;
}
@@ -452,6 +509,10 @@ public final class ConfigHandler {
this.<Boolean>adaptProperty(prop, val);
}
public void adaptPropertyIntArray(Property prop, int[] val) {
this.<int[]>adaptProperty(prop, val);
}
public static class AdaptableValue<T> {
public final int version;
@@ -18,6 +18,7 @@ import java.util.WeakHashMap;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraftforge.event.world.WorldEvent;
import vazkii.botania.api.internal.IManaNetwork;
import vazkii.botania.api.mana.ManaNetworkEvent;
import vazkii.botania.api.mana.ManaNetworkEvent.Action;
@@ -30,8 +31,8 @@ public final class ManaNetworkHandler implements IManaNetwork {
public static final ManaNetworkHandler instance = new ManaNetworkHandler();
public WeakHashMap<World, List<TileSignature>> manaPools = new WeakHashMap();
public WeakHashMap<World, List<TileSignature>> manaCollectors = new WeakHashMap();
public WeakHashMap<World, List<TileSignature>> manaPools = new WeakHashMap<>();
public WeakHashMap<World, List<TileSignature>> manaCollectors = new WeakHashMap<>();
@SubscribeEvent
public void onNetworkEvent(ManaNetworkEvent event) {
@@ -124,11 +125,11 @@ public final class ManaNetworkHandler implements IManaNetwork {
List<TileSignature> tiles;
if(!map.containsKey(world))
map.put(world, new ArrayList());
map.put(world, new ArrayList<>());
tiles = map.get(world);
if(!tiles.contains(tile))
if(tiles.stream().noneMatch(s -> s.tile == tile))
tiles.add(new TileSignature(tile, tile.getWorldObj().isRemote));
}
@@ -144,10 +145,15 @@ public final class ManaNetworkHandler implements IManaNetwork {
private List<TileSignature> getAllInWorld(Map<World, List<TileSignature>> map, World world) {
if(!map.containsKey(world))
return new ArrayList();
return new ArrayList<>();
return map.get(world);
}
@SubscribeEvent
public void onWorldRemoved(WorldEvent.Unload e) {
World world = e.world;
manaPools.remove(world);
manaCollectors.remove(world);
}
}
@@ -28,6 +28,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
//From OpenBlocksLib: https://github.com/OpenMods/OpenModsLib
public class InventoryHelper {
@@ -205,6 +206,21 @@ public class InventoryHelper {
return slots;
}
public static ItemStack cycleItemStackForDisplay(Object input) {
if (input instanceof ItemStack) return (ItemStack) input;
List<ItemStack> items = null;
if (input instanceof List) {
items = (List<ItemStack>) input;
} else if (input instanceof String) {
items = OreDictionary.getOres((String) input);
}
if (items != null && items.size() > 0) {
int index = (int) (System.currentTimeMillis() / 1000L % items.size());
return items.get(index);
}
return null;
}
public static class GenericInventory implements IInventory {
protected String inventoryTitle;
@@ -13,9 +13,16 @@
*/
package vazkii.botania.common.core.helper;
import codechicken.nei.PositionedStack;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.oredict.OreDictionary;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Set;
public final class ItemNBTHelper {
@@ -136,4 +143,100 @@ public final class ItemNBTHelper {
return verifyExistance(stack, tag) ? getNBT(stack).getTagList(tag, objtype) : nullifyOnFail ? null : new NBTTagList();
}
// Utils ///////////////////////////////////////////////////////////////////
/**
* NBT-friendly version of {@link codechicken.nei.NEIServerUtils#areStacksSameType(ItemStack, ItemStack)}
* @param stack1 The {@link ItemStack} being compared.
* @param stack2 The {@link ItemStack} to compare to.
* @return whether the two items are the same in terms of itemID, damage and NBT.
*/
public static boolean areStacksSameTypeWithNBT(ItemStack stack1, ItemStack stack2) {
return stack1 != null && stack2 != null &&
stack1.getItem() == stack2.getItem() &&
(!stack2.getHasSubtypes() || stack2.getItemDamage() == stack1.getItemDamage()) &&
matchTag(stack1.getTagCompound(), stack2.getTagCompound());
}
/**
* NBT-friendly version of {@link codechicken.nei.NEIServerUtils#areStacksSameTypeCrafting(ItemStack, ItemStack)}
* @param stack1 The {@link ItemStack} being compared.
* @param stack2 The {@link ItemStack} to compare to.
* @return whether the two items are the same from the perspective of a crafting inventory.
*/
public static boolean areStacksSameTypeCraftingWithNBT(ItemStack stack1, ItemStack stack2) {
return stack1 != null && stack2 != null &&
stack1.getItem() == stack2.getItem() &&
(
stack1.getItemDamage() == stack2.getItemDamage() ||
stack1.getItemDamage() == OreDictionary.WILDCARD_VALUE ||
stack2.getItemDamage() == OreDictionary.WILDCARD_VALUE ||
stack1.getItem().isDamageable()
) &&
matchTag(stack1.getTagCompound(), stack2.getTagCompound());
}
/**
* Returns true if the `target` tag contains all of the tags and values present in the `template` tag. Recurses into
* compound tags and matches all template keys and values; recurses into list tags and matches the template against
* the first elements of target. Empty lists and compounds in the template will match target lists and compounds of
* any size.
*/
public static boolean matchTag(@Nullable NBTBase template, @Nullable NBTBase target) {
if (template instanceof NBTTagCompound && target instanceof NBTTagCompound) {
return matchTagCompound((NBTTagCompound) template, (NBTTagCompound) target);
} else if (template instanceof NBTTagList && target instanceof NBTTagList) {
return matchTagList((NBTTagList) template, (NBTTagList) target);
} else {
return template == null || (target != null && target.equals(template));
}
}
private static boolean matchTagCompound(NBTTagCompound template, NBTTagCompound target) {
if (template.tagMap.size() > target.tagMap.size()) return false;
//noinspection unchecked
for (String key : (Set<String>) template.func_150296_c()) {
if (!matchTag(template.getTag(key), target.getTag(key))) return false;
}
return true;
}
private static boolean matchTagList(NBTTagList template, NBTTagList target) {
if (template.tagCount() > target.tagCount()) return false;
for (int i = 0; i < template.tagCount(); i++) {
if (!matchTag(get(template, i), get(target, i))) return false;
}
return true;
}
private static NBTBase get(NBTTagList tag, int idx)
{
return idx >= 0 && idx < tag.tagList.size() ? (NBTBase)tag.tagList.get(idx) : null;
}
/**
* NBT-friendly version of {@link codechicken.nei.recipe.TemplateRecipeHandler.CachedRecipe#contains(Collection, ItemStack)}
*/
public static boolean cachedRecipeContainsWithNBT(Collection<PositionedStack> ingredients, ItemStack ingredient) {
for (PositionedStack stack : ingredients)
if (positionedStackContainsWithNBT(stack, ingredient))
return true;
return false;
}
/**
* NBT-friendly version of {@link codechicken.nei.PositionedStack#contains(ItemStack)}
*/
public static boolean positionedStackContainsWithNBT(PositionedStack stack, ItemStack ingredient) {
for(ItemStack item : stack.items)
if(areStacksSameTypeCraftingWithNBT(item, ingredient))
return true;
return false;
}
}
@@ -0,0 +1,80 @@
package vazkii.botania.common.core.helper;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChunkCoordinates;
public class LokiCursor {
private static final String TAG_X_OFFSET = "xOffset";
private static final String TAG_Y_OFFSET = "yOffset";
private static final String TAG_Z_OFFSET = "zOffset";
private static final String TAG_MIRROR_MODE = "mirror";
private static final byte xAxisBitmask = 4; //100
private static final byte yAxisBitmask = 2; //010
private static final byte zAxisBitmask = 1; //001
private byte mirrorMode;
private ChunkCoordinates coordinates;
public LokiCursor(int x, int y, int z, byte mode){
coordinates = new ChunkCoordinates(x,y,z);
mirrorMode = mode;
}
public static LokiCursor fromNBT(NBTTagCompound cmp){
int x = cmp.getInteger(TAG_X_OFFSET);
int y = cmp.getInteger(TAG_Y_OFFSET);
int z = cmp.getInteger(TAG_Z_OFFSET);
byte mirror = cmp.getByte(TAG_MIRROR_MODE);
return new LokiCursor(x,y,z,mirror);
}
public static boolean isMirrorX(byte mirrorMode){
return (mirrorMode & xAxisBitmask) > 0;
}
public static boolean isMirrorY(byte mirrorMode){
return (mirrorMode & yAxisBitmask) > 0;
}
public static boolean isMirrorZ(byte mirrorMode){
return (mirrorMode & zAxisBitmask) > 0;
}
public NBTTagCompound toNBT() {
NBTTagCompound cmp = new NBTTagCompound();
cmp.setInteger(TAG_X_OFFSET, coordinates.posX);
cmp.setInteger(TAG_Y_OFFSET, coordinates.posY);
cmp.setInteger(TAG_Z_OFFSET, coordinates.posZ);
cmp.setInteger(TAG_MIRROR_MODE, mirrorMode);
return cmp;
}
public int getX(){
return coordinates.posX;
}
public int getY(){
return coordinates.posY;
}
public int getZ(){
return coordinates.posZ;
}
public ChunkCoordinates getCoordinates(){
return coordinates;
}
public boolean isMirrorX(){
return isMirrorX(mirrorMode);
}
public boolean isMirrorY(){
return isMirrorY(mirrorMode);
}
public boolean isMirrorZ(){
return isMirrorZ(mirrorMode);
}
public boolean isMirror(){
return mirrorMode!=0;
}
}
@@ -79,6 +79,7 @@ import vazkii.botania.common.integration.etfuturum.ModBanners;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.network.GuiHandler;
import vazkii.botania.common.network.PacketHandler;
import vazkii.botania.common.world.SkyblockWorldEvents;
import vazkii.botania.common.world.WorldTypeSkyblock;
import cpw.mods.fml.common.FMLCommonHandler;
@@ -116,6 +117,8 @@ public class CommonProxy {
ModAchievements.init();
ModMultiblocks.init();
PacketHandler.initPackets();
if(Botania.etFuturumLoaded)
ModBanners.init();
@@ -257,6 +257,7 @@ public final class ModCraftingRecipes {
public static IRecipe recipeSwapRing;
public static IRecipe recipeSnowHorn;
public static IRecipe recipeFlowerBag;
public static IRecipe recipeShroomBag;
public static IRecipe recipePhantomInk;
public static IRecipe recipePoolCart;
public static IRecipe recipePump;
@@ -1768,6 +1769,13 @@ public final class ModCraftingRecipes {
'W', new ItemStack(Blocks.wool, 1, Short.MAX_VALUE));
recipeFlowerBag = BotaniaAPI.getLatestAddedRecipe();
// Mushroom Pouch Recipe
GameRegistry.addShapedRecipe(new ItemStack(ModItems.shroomBag),
"WPW", "W W", " W ",
'P', new ItemStack(ModBlocks.mushroom, 1, Short.MAX_VALUE),
'W', new ItemStack(Blocks.wool, 1, Short.MAX_VALUE));
recipeShroomBag = BotaniaAPI.getLatestAddedRecipe();
// Phantom Ink Recipe
addShapelessOreDictRecipe(new ItemStack(ModItems.phantomInk, 4), LibOreDict.MANA_PEARL, "dye", "blockGlass", new ItemStack(Items.glass_bottle), new ItemStack(Items.glass_bottle), new ItemStack(Items.glass_bottle), new ItemStack(Items.glass_bottle));
recipePhantomInk = BotaniaAPI.getLatestAddedRecipe();
@@ -1,136 +1,136 @@
/**
* This class was created by <Vindex>. 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
*
*/
package vazkii.botania.common.integration.corporea;
import java.util.ArrayList;
import java.util.List;
import org.apache.logging.log4j.Level;
import cpw.mods.fml.common.FMLLog;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import powercrystals.minefactoryreloaded.api.IDeepStorageUnit;
import vazkii.botania.api.corporea.CorporeaRequest;
import vazkii.botania.api.corporea.ICorporeaSpark;
import vazkii.botania.api.corporea.IWrappedInventory;
/**
* Wrapper for StorageDrawers compatibility.
*
*/
public class WrappedDeepStorage extends WrappedInventoryBase {
private static boolean checkedInterface = false;
private static boolean deepStoragePresent = false;
private IDeepStorageUnit inv;
private WrappedDeepStorage(IDeepStorageUnit inv, ICorporeaSpark spark) {
this.inv = inv;
this.spark = spark;
}
@Override
public IInventory getWrappedObject() {
return (IInventory) inv;
}
@Override
public List<ItemStack> countItems(CorporeaRequest request) {
return iterateOverStacks(request, false);
}
@Override
public List<ItemStack> extractItems(CorporeaRequest request) {
return iterateOverStacks(request, true);
}
private List<ItemStack> iterateOverStacks(CorporeaRequest request, boolean doit) {
List<ItemStack> stacks = new ArrayList<ItemStack>();
boolean removedAny = false;
ItemStack prototype = inv.getStoredItemType();
if(prototype == null) {
// for the case of barrel without contents set
return stacks;
}
int storedCount = prototype.stackSize;
// WARNING: this code is very similar in all implementations of
// IWrappedInventory - keep it synch
// this code is also near duplicate to WrappedStorageDrawers - keep it
// synchronized
if(isMatchingItemStack(request.matcher, request.checkNBT, prototype)) {
int rem = Math.min(storedCount, request.count == -1 ? storedCount : request.count);
if(rem > 0) {
ItemStack copy = prototype.copy();
copy.stackSize = rem;
if(doit) {
stacks.addAll(breakDownBigStack(copy));
} else {
stacks.add(copy);
}
}
request.foundItems += storedCount;
request.extractedItems += rem;
if(doit && rem > 0) {
decreaseStoredCount(inv, rem);
removedAny = true;
if(spark != null)
spark.onItemExtracted(prototype);
}
if(request.count != -1)
request.count -= rem;
}
if(removedAny) {
// inv.markDirtyIfNeeded();
}
return stacks;
}
private void decreaseStoredCount(IDeepStorageUnit inventory, int rem) {
inventory.setStoredItemCount(inventory.getStoredItemType().stackSize - rem);
}
/**
* Creates {@link WrappedDeepStorage} if specified inv can be wrapped.
*
* @return wrapped inventory or null if it has incompatible type.
*/
public static IWrappedInventory wrap(IInventory inv, ICorporeaSpark spark) {
if(!isDeepStorageNeeded()) {
return null;
}
return inv instanceof IDeepStorageUnit ? new WrappedDeepStorage((IDeepStorageUnit) inv, spark) : null;
}
/**
* This method checks for presence of Deep Storage API in the pack - if some
* other mod provides IDeepStorageUnit, support for Deep Storage will be
* used. This way we don't have to ship IDeepStorageUnit in Botania jar.
*/
private static boolean isDeepStorageNeeded() {
if(!checkedInterface) {
try {
deepStoragePresent = (Class.forName("powercrystals.minefactoryreloaded.api.IDeepStorageUnit") != null);
} catch (ClassNotFoundException e) {
deepStoragePresent = false;
}
checkedInterface = true;
FMLLog.log(Level.INFO, "[Botania] Corporea support for Deep Storage: %b", deepStoragePresent);
}
return deepStoragePresent;
}
}
/**
* This class was created by <Vindex>. 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
*
*/
package vazkii.botania.common.integration.corporea;
import java.util.ArrayList;
import java.util.List;
import org.apache.logging.log4j.Level;
import cpw.mods.fml.common.FMLLog;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import powercrystals.minefactoryreloaded.api.IDeepStorageUnit;
import vazkii.botania.api.corporea.CorporeaRequest;
import vazkii.botania.api.corporea.ICorporeaSpark;
import vazkii.botania.api.corporea.IWrappedInventory;
/**
* Wrapper for StorageDrawers compatibility.
*
*/
public class WrappedDeepStorage extends WrappedInventoryBase {
private static boolean checkedInterface = false;
private static boolean deepStoragePresent = false;
private IDeepStorageUnit inv;
private WrappedDeepStorage(IDeepStorageUnit inv, ICorporeaSpark spark) {
this.inv = inv;
this.spark = spark;
}
@Override
public IInventory getWrappedObject() {
return (IInventory) inv;
}
@Override
public List<ItemStack> countItems(CorporeaRequest request) {
return iterateOverStacks(request, false);
}
@Override
public List<ItemStack> extractItems(CorporeaRequest request) {
return iterateOverStacks(request, true);
}
private List<ItemStack> iterateOverStacks(CorporeaRequest request, boolean doit) {
List<ItemStack> stacks = new ArrayList<ItemStack>();
boolean removedAny = false;
ItemStack prototype = inv.getStoredItemType();
if(prototype == null) {
// for the case of barrel without contents set
return stacks;
}
int storedCount = prototype.stackSize;
// WARNING: this code is very similar in all implementations of
// IWrappedInventory - keep it synch
// this code is also near duplicate to WrappedStorageDrawers - keep it
// synchronized
if(isMatchingItemStack(request.matcher, request.checkNBT, prototype)) {
int rem = Math.min(storedCount, request.count == -1 ? storedCount : request.count);
if(rem > 0) {
ItemStack copy = prototype.copy();
copy.stackSize = rem;
if(doit) {
stacks.addAll(breakDownBigStack(copy));
} else {
stacks.add(copy);
}
}
request.foundItems += storedCount;
request.extractedItems += rem;
if(doit && rem > 0) {
decreaseStoredCount(inv, rem);
removedAny = true;
if(spark != null)
spark.onItemExtracted(prototype);
}
if(request.count != -1)
request.count -= rem;
}
if(removedAny) {
// inv.markDirtyIfNeeded();
}
return stacks;
}
private void decreaseStoredCount(IDeepStorageUnit inventory, int rem) {
inventory.setStoredItemCount(inventory.getStoredItemType().stackSize - rem);
}
/**
* Creates {@link WrappedDeepStorage} if specified inv can be wrapped.
*
* @return wrapped inventory or null if it has incompatible type.
*/
public static IWrappedInventory wrap(IInventory inv, ICorporeaSpark spark) {
if(!isDeepStorageNeeded()) {
return null;
}
return inv instanceof IDeepStorageUnit ? new WrappedDeepStorage((IDeepStorageUnit) inv, spark) : null;
}
/**
* This method checks for presence of Deep Storage API in the pack - if some
* other mod provides IDeepStorageUnit, support for Deep Storage will be
* used. This way we don't have to ship IDeepStorageUnit in Botania jar.
*/
private static boolean isDeepStorageNeeded() {
if(!checkedInterface) {
try {
deepStoragePresent = (Class.forName("powercrystals.minefactoryreloaded.api.IDeepStorageUnit") != null);
} catch (ClassNotFoundException e) {
deepStoragePresent = false;
}
checkedInterface = true;
FMLLog.log(Level.INFO, "[Botania] Corporea support for Deep Storage: %b", deepStoragePresent);
}
return deepStoragePresent;
}
}
@@ -1,92 +1,92 @@
/**
* This class was created by <Vindex>. 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
*
*/
package vazkii.botania.common.integration.corporea;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.corporea.CorporeaHelper;
import vazkii.botania.api.corporea.CorporeaRequest;
import vazkii.botania.api.corporea.ICorporeaSpark;
import vazkii.botania.api.corporea.IWrappedInventory;
public class WrappedIInventory extends WrappedInventoryBase{
private IInventory inv;
private WrappedIInventory(IInventory inv, ICorporeaSpark spark) {
this.inv = inv;
this.spark = spark;
}
@Override
public IInventory getWrappedObject() {
return inv;
}
@Override
public List<ItemStack> countItems(CorporeaRequest request) {
return iterateOverSlots(request, false);
}
@Override
public List<ItemStack> extractItems(CorporeaRequest request) {
return iterateOverSlots(request, true);
}
private List<ItemStack> iterateOverSlots(CorporeaRequest request, boolean doit) {
List<ItemStack> stacks = new ArrayList<ItemStack>();
boolean removedAny = false;
for (int i = inv.getSizeInventory() - 1; i >= 0; i--) {
if(!CorporeaHelper.isValidSlot(inv, i))
continue;
ItemStack stackAt = inv.getStackInSlot(i);
// WARNING: this code is very similar in all implementations of
// IWrappedInventory - keep it synch
if(isMatchingItemStack(request.matcher, request.checkNBT, stackAt)) {
int rem = Math.min(stackAt.stackSize, request.count == -1 ? stackAt.stackSize : request.count);
if(rem > 0) {
ItemStack copy = stackAt.copy();
if(rem < copy.stackSize)
copy.stackSize = rem;
stacks.add(copy);
}
request.foundItems += stackAt.stackSize;
request.extractedItems += rem;
if(doit && rem > 0) {
inv.decrStackSize(i, rem);
removedAny = true;
if(spark != null)
spark.onItemExtracted(stackAt);
}
if(request.count != -1)
request.count -= rem;
}
}
if(removedAny) {
inv.markDirty();
}
return stacks;
}
public static IWrappedInventory wrap(IInventory inv, ICorporeaSpark spark) {
return new WrappedIInventory(inv, spark);
}
}
/**
* This class was created by <Vindex>. 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
*
*/
package vazkii.botania.common.integration.corporea;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.corporea.CorporeaHelper;
import vazkii.botania.api.corporea.CorporeaRequest;
import vazkii.botania.api.corporea.ICorporeaSpark;
import vazkii.botania.api.corporea.IWrappedInventory;
public class WrappedIInventory extends WrappedInventoryBase{
private IInventory inv;
private WrappedIInventory(IInventory inv, ICorporeaSpark spark) {
this.inv = inv;
this.spark = spark;
}
@Override
public IInventory getWrappedObject() {
return inv;
}
@Override
public List<ItemStack> countItems(CorporeaRequest request) {
return iterateOverSlots(request, false);
}
@Override
public List<ItemStack> extractItems(CorporeaRequest request) {
return iterateOverSlots(request, true);
}
private List<ItemStack> iterateOverSlots(CorporeaRequest request, boolean doit) {
List<ItemStack> stacks = new ArrayList<ItemStack>();
boolean removedAny = false;
for (int i = inv.getSizeInventory() - 1; i >= 0; i--) {
if(!CorporeaHelper.isValidSlot(inv, i))
continue;
ItemStack stackAt = inv.getStackInSlot(i);
// WARNING: this code is very similar in all implementations of
// IWrappedInventory - keep it synch
if(isMatchingItemStack(request.matcher, request.checkNBT, stackAt)) {
int rem = Math.min(stackAt.stackSize, request.count == -1 ? stackAt.stackSize : request.count);
if(rem > 0) {
ItemStack copy = stackAt.copy();
if(rem < copy.stackSize)
copy.stackSize = rem;
stacks.add(copy);
}
request.foundItems += stackAt.stackSize;
request.extractedItems += rem;
if(doit && rem > 0) {
inv.decrStackSize(i, rem);
removedAny = true;
if(spark != null)
spark.onItemExtracted(stackAt);
}
if(request.count != -1)
request.count -= rem;
}
}
if(removedAny) {
inv.markDirty();
}
return stacks;
}
public static IWrappedInventory wrap(IInventory inv, ICorporeaSpark spark) {
return new WrappedIInventory(inv, spark);
}
}
@@ -1,52 +1,52 @@
/**
* This class was created by <Vindex>. 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
*
*/
package vazkii.botania.common.integration.corporea;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.corporea.CorporeaHelper;
import vazkii.botania.api.corporea.ICorporeaSpark;
import vazkii.botania.api.corporea.IWrappedInventory;
public abstract class WrappedInventoryBase implements IWrappedInventory {
protected ICorporeaSpark spark;
@Override
public ICorporeaSpark getSpark() {
return spark;
}
protected boolean isMatchingItemStack(Object matcher, boolean checkNBT, ItemStack stackAt) {
return matcher instanceof ItemStack ? CorporeaHelper.stacksMatch((ItemStack) matcher, stackAt, checkNBT)
: matcher instanceof String ? CorporeaHelper.stacksMatch(stackAt, (String) matcher) : false;
}
protected Collection<? extends ItemStack> breakDownBigStack(ItemStack stack) {
List<ItemStack> stacks = new ArrayList<ItemStack>();
int additionalStacks = stack.stackSize / stack.getMaxStackSize();
int lastStackSize = stack.stackSize % stack.getMaxStackSize();
if(additionalStacks > 0) {
ItemStack fullStack = stack.copy();
fullStack.stackSize = stack.getMaxStackSize();
for (int i = 0; i < additionalStacks; i++) {
stacks.add(fullStack.copy());
}
}
ItemStack lastStack = stack.copy();
lastStack.stackSize = lastStackSize;
stacks.add(lastStack);
return stacks;
}
}
/**
* This class was created by <Vindex>. 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
*
*/
package vazkii.botania.common.integration.corporea;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.corporea.CorporeaHelper;
import vazkii.botania.api.corporea.ICorporeaSpark;
import vazkii.botania.api.corporea.IWrappedInventory;
public abstract class WrappedInventoryBase implements IWrappedInventory {
protected ICorporeaSpark spark;
@Override
public ICorporeaSpark getSpark() {
return spark;
}
protected boolean isMatchingItemStack(Object matcher, boolean checkNBT, ItemStack stackAt) {
return matcher instanceof ItemStack ? CorporeaHelper.stacksMatch((ItemStack) matcher, stackAt, checkNBT)
: matcher instanceof String ? CorporeaHelper.stacksMatch(stackAt, (String) matcher) : false;
}
protected Collection<? extends ItemStack> breakDownBigStack(ItemStack stack) {
List<ItemStack> stacks = new ArrayList<ItemStack>();
int additionalStacks = stack.stackSize / stack.getMaxStackSize();
int lastStackSize = stack.stackSize % stack.getMaxStackSize();
if(additionalStacks > 0) {
ItemStack fullStack = stack.copy();
fullStack.stackSize = stack.getMaxStackSize();
for (int i = 0; i < additionalStacks; i++) {
stacks.add(fullStack.copy());
}
}
ItemStack lastStack = stack.copy();
lastStack.stackSize = lastStackSize;
stacks.add(lastStack);
return stacks;
}
}
@@ -1,113 +1,113 @@
/**
* This class was created by <Vindex>. 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
*
*/
package vazkii.botania.common.integration.corporea;
import java.util.ArrayList;
import java.util.List;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.corporea.CorporeaRequest;
import vazkii.botania.api.corporea.ICorporeaSpark;
import vazkii.botania.api.corporea.IWrappedInventory;
/**
* Wrapper for StorageDrawers compatibility.
*
*/
public class WrappedStorageDrawers extends WrappedInventoryBase {
private IDrawerGroup inv;
private WrappedStorageDrawers(IDrawerGroup inv, ICorporeaSpark spark) {
this.inv = inv;
this.spark = spark;
}
@Override
public IInventory getWrappedObject() {
return (IInventory) inv;
}
@Override
public List<ItemStack> countItems(CorporeaRequest request) {
return iterateOverStacks(request, false);
}
@Override
public List<ItemStack> extractItems(CorporeaRequest request) {
return iterateOverStacks(request, true);
}
private List<ItemStack> iterateOverStacks(CorporeaRequest request, boolean doit) {
List<ItemStack> stacks = new ArrayList<ItemStack>();
boolean removedAny = false;
for(int i = 0; i < inv.getDrawerCount(); i++) {
IDrawer drawer = inv.getDrawer(i);
if(drawer == null) {
continue;
}
ItemStack prototype = drawer.getStoredItemPrototype();
int storedCount = drawer.getStoredItemCount();
// WARNING: this code is very similar in all implementations of
// IWrappedInventory - keep it synch
// also this code is near duplicate to WrappedDeepStorage - keep it
// synchronized
if(isMatchingItemStack(request.matcher, request.checkNBT, prototype)) {
int rem = Math.min(storedCount, request.count == -1 ? storedCount : request.count);
if(rem > 0) {
ItemStack copy = prototype.copy();
copy.stackSize = rem;
if(doit) {
stacks.addAll(breakDownBigStack(copy));
} else {
stacks.add(copy);
}
}
request.foundItems += storedCount;
request.extractedItems += rem;
if(doit && rem > 0) {
decreaseStoredCount(drawer, rem);
removedAny = true;
if(spark != null)
spark.onItemExtracted(prototype);
}
if(request.count != -1)
request.count -= rem;
}
}
if(removedAny) {
inv.markDirtyIfNeeded();
}
return stacks;
}
private void decreaseStoredCount(IDrawer drawer, int rem) {
drawer.setStoredItemCount(drawer.getStoredItemCount() - rem);
}
/**
* Creates {@link WrappedStorageDrawers} if specified inv can be wrapped.
*
* @return wrapped inventory or null if it has incompatible type.
*/
public static IWrappedInventory wrap(IInventory inv, ICorporeaSpark spark) {
return inv instanceof IDrawerGroup ? new WrappedStorageDrawers((IDrawerGroup) inv, spark) : null;
}
}
/**
* This class was created by <Vindex>. 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
*
*/
package vazkii.botania.common.integration.corporea;
import java.util.ArrayList;
import java.util.List;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.corporea.CorporeaRequest;
import vazkii.botania.api.corporea.ICorporeaSpark;
import vazkii.botania.api.corporea.IWrappedInventory;
/**
* Wrapper for StorageDrawers compatibility.
*
*/
public class WrappedStorageDrawers extends WrappedInventoryBase {
private IDrawerGroup inv;
private WrappedStorageDrawers(IDrawerGroup inv, ICorporeaSpark spark) {
this.inv = inv;
this.spark = spark;
}
@Override
public IInventory getWrappedObject() {
return (IInventory) inv;
}
@Override
public List<ItemStack> countItems(CorporeaRequest request) {
return iterateOverStacks(request, false);
}
@Override
public List<ItemStack> extractItems(CorporeaRequest request) {
return iterateOverStacks(request, true);
}
private List<ItemStack> iterateOverStacks(CorporeaRequest request, boolean doit) {
List<ItemStack> stacks = new ArrayList<ItemStack>();
boolean removedAny = false;
for(int i = 0; i < inv.getDrawerCount(); i++) {
IDrawer drawer = inv.getDrawer(i);
if(drawer == null) {
continue;
}
ItemStack prototype = drawer.getStoredItemPrototype();
int storedCount = drawer.getStoredItemCount();
// WARNING: this code is very similar in all implementations of
// IWrappedInventory - keep it synch
// also this code is near duplicate to WrappedDeepStorage - keep it
// synchronized
if(isMatchingItemStack(request.matcher, request.checkNBT, prototype)) {
int rem = Math.min(storedCount, request.count == -1 ? storedCount : request.count);
if(rem > 0) {
ItemStack copy = prototype.copy();
copy.stackSize = rem;
if(doit) {
stacks.addAll(breakDownBigStack(copy));
} else {
stacks.add(copy);
}
}
request.foundItems += storedCount;
request.extractedItems += rem;
if(doit && rem > 0) {
decreaseStoredCount(drawer, rem);
removedAny = true;
if(spark != null)
spark.onItemExtracted(prototype);
}
if(request.count != -1)
request.count -= rem;
}
}
if(removedAny) {
inv.markDirtyIfNeeded();
}
return stacks;
}
private void decreaseStoredCount(IDrawer drawer, int rem) {
drawer.setStoredItemCount(drawer.getStoredItemCount() - rem);
}
/**
* Creates {@link WrappedStorageDrawers} if specified inv can be wrapped.
*
* @return wrapped inventory or null if it has incompatible type.
*/
public static IWrappedInventory wrap(IInventory inv, ICorporeaSpark spark) {
return inv instanceof IDrawerGroup ? new WrappedStorageDrawers((IDrawerGroup) inv, spark) : null;
}
}
@@ -198,15 +198,17 @@ public class ItemCraftingHalo extends ItemMod implements ICraftAchievement {
ItemStack stackAt = inv.getStackInSlot(i);
if(stackAt != null && stack.isItemEqual(stackAt) && ItemStack.areItemStackTagsEqual(stack, stackAt)) {
boolean consume = true;
ItemStack container = stackAt.getItem().getContainerItem(stackAt);
if(container != null) {
if(container == stackAt)
consume = false;
else {
InventoryHelper.insertItemIntoInventory(inv, container);
if(container.stackSize != 0 && player != null)
player.dropPlayerItemWithRandomChoice(container, false);
if(stackAt.getItem().hasContainerItem()) {
//there are monsters in this world that will return false above but not null below
ItemStack container = stackAt.getItem().getContainerItem(stackAt);
if (container != null) {
if (container == stackAt)
consume = false;
else {
InventoryHelper.insertItemIntoInventory(inv, container);
if (container.stackSize != 0 && player != null)
player.dropPlayerItemWithRandomChoice(container, false);
}
}
}
@@ -1,159 +0,0 @@
/**
* 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
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Mar 16, 2015, 6:43:33 PM (GMT)]
*/
package vazkii.botania.common.item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.core.helper.InventoryHelper;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.lib.LibGuiIDs;
import vazkii.botania.common.lib.LibItemNames;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class ItemFlowerBag extends ItemMod {
private static final String TAG_ITEMS = "InvItems";
private static final String TAG_SLOT = "Slot";
public ItemFlowerBag() {
setUnlocalizedName(LibItemNames.FLOWER_BAG);
setMaxStackSize(1);
MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent
public void onPickupItem(EntityItemPickupEvent event) {
ItemStack stack = event.item.getEntityItem();
if(stack.getItem() == Item.getItemFromBlock(ModBlocks.flower) && stack.stackSize > 0) {
int color = stack.getItemDamage();
if(color > 15)
return;
for(int i = 0; i < event.entityPlayer.inventory.getSizeInventory(); i++) {
if(i == event.entityPlayer.inventory.currentItem)
continue; // prevent item deletion
ItemStack invStack = event.entityPlayer.inventory.getStackInSlot(i);
if(invStack != null && invStack.getItem() == this) {
ItemStack[] bagInv = loadStacks(invStack);
ItemStack stackAt = bagInv[color];
boolean didChange = false;
if(stackAt == null) {
bagInv[color] = stack.copy();
stack.stackSize = 0;
didChange = true;
} else {
int stackAtSize = stackAt.stackSize;
int stackSize = stack.stackSize;
int spare = 64 - stackAtSize;
int pass = Math.min(spare, stackSize);
if(pass > 0) {
stackAt.stackSize += pass;
stack.stackSize -= pass;
didChange = true;
}
}
if(didChange)
setStacks(invStack, bagInv);
}
if(stack.stackSize == 0)
return;
}
}
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
player.openGui(Botania.instance, LibGuiIDs.FLOWER_BAG, world, 0, 0, 0);
return stack;
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int s, float xs, float ys, float zs) {
TileEntity tile = world.getTileEntity(x, y, z);
if(tile != null && tile instanceof IInventory) {
if(!world.isRemote) {
ForgeDirection side = ForgeDirection.getOrientation(s);
IInventory inv = (IInventory) tile;
ItemStack[] stacks = loadStacks(stack);
ItemStack[] newStacks = new ItemStack[stacks.length];
boolean putAny = false;
int i = 0;
for(ItemStack petal : stacks) {
if(petal != null) {
int count = InventoryHelper.testInventoryInsertion(inv, petal, side);
InventoryHelper.insertItemIntoInventory(inv, petal, side, -1);
ItemStack newPetal = petal.copy();
if(newPetal.stackSize == 0)
newPetal = null;
newStacks[i] = newPetal;
putAny |= count > 0;
}
i++;
}
setStacks(stack, newStacks);
if(putAny && inv instanceof TileEntityChest) {
inv = InventoryHelper.getInventory(inv);
player.displayGUIChest(inv);
}
}
return true;
}
return false;
}
public static ItemStack[] loadStacks(ItemStack stack) {
NBTTagList var2 = ItemNBTHelper.getList(stack, TAG_ITEMS, 10, false);
ItemStack[] inventorySlots = new ItemStack[16];
for(int var3 = 0; var3 < var2.tagCount(); ++var3) {
NBTTagCompound var4 = var2.getCompoundTagAt(var3);
byte var5 = var4.getByte(TAG_SLOT);
if(var5 >= 0 && var5 < inventorySlots.length)
inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
}
return inventorySlots;
}
public static void setStacks(ItemStack stack, ItemStack[] inventorySlots) {
NBTTagList var2 = new NBTTagList();
for(int var3 = 0; var3 < inventorySlots.length; ++var3)
if(inventorySlots[var3] != null) {
NBTTagCompound var4 = new NBTTagCompound();
var4.setByte(TAG_SLOT, (byte)var3);
inventorySlots[var3].writeToNBT(var4);
var2.appendTag(var4);
}
ItemNBTHelper.setList(stack, TAG_ITEMS, var2);
}
}
@@ -15,6 +15,8 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.common.item.bag.ItemFlowerBag;
import vazkii.botania.common.item.bag.ItemShroomBag;
import vazkii.botania.common.item.brew.ItemBrewFlask;
import vazkii.botania.common.item.brew.ItemBrewVial;
import vazkii.botania.common.item.brew.ItemIncenseStick;
@@ -232,6 +234,7 @@ public final class ModItems {
public static Item cosmetic;
public static Item swapRing;
public static Item flowerBag;
public static Item shroomBag;
public static Item phantomInk;
public static Item poolMinecart;
public static Item pinkinator;
@@ -381,6 +384,7 @@ public final class ModItems {
cosmetic = new ItemBaubleCosmetic();
swapRing = new ItemSwapRing();
flowerBag = new ItemFlowerBag();
shroomBag = new ItemShroomBag();
phantomInk = new ItemPhantomInk();
poolMinecart = new ItemPoolMinecart();
pinkinator = new ItemPinkinator();
@@ -0,0 +1,154 @@
package vazkii.botania.common.item.bag;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.core.helper.InventoryHelper;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.item.ItemMod;
import vazkii.botania.common.lib.LibGuiIDs;
import vazkii.botania.common.lib.LibItemNames;
public abstract class ItemBagBase extends ItemMod {
private static final String TAG_ITEMS = "InvItems";
private static final String TAG_SLOT = "Slot";
public ItemBagBase(String name) {
setUnlocalizedName(name);
setMaxStackSize(1);
MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent
public void onPickupItem(EntityItemPickupEvent event) {
ItemStack stack = event.item.getEntityItem();
if(stack.getItem() == Item.getItemFromBlock(getValidPickUp()) && stack.stackSize > 0) {
int color = stack.getItemDamage();
if(color > 15)
return;
for(int i = 0; i < event.entityPlayer.inventory.getSizeInventory(); i++) {
if(i == event.entityPlayer.inventory.currentItem)
continue; // prevent item deletion
ItemStack invStack = event.entityPlayer.inventory.getStackInSlot(i);
if(invStack != null && invStack.getItem() == this) {
ItemStack[] bagInv = loadStacks(invStack);
ItemStack stackAt = bagInv[color];
boolean didChange = false;
if(stackAt == null) {
bagInv[color] = stack.copy();
stack.stackSize = 0;
didChange = true;
} else {
int stackAtSize = stackAt.stackSize;
int stackSize = stack.stackSize;
int spare = 64 - stackAtSize;
int pass = Math.min(spare, stackSize);
if(pass > 0) {
stackAt.stackSize += pass;
stack.stackSize -= pass;
didChange = true;
}
}
if(didChange)
setStacks(invStack, bagInv);
}
if(stack.stackSize == 0)
return;
}
}
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
player.openGui(Botania.instance, getGuiID(), world, 0, 0, 0);
return stack;
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int s, float xs, float ys, float zs) {
TileEntity tile = world.getTileEntity(x, y, z);
if(tile != null && tile instanceof IInventory) {
if(!world.isRemote) {
ForgeDirection side = ForgeDirection.getOrientation(s);
IInventory inv = (IInventory) tile;
ItemStack[] stacks = loadStacks(stack);
ItemStack[] newStacks = new ItemStack[stacks.length];
boolean putAny = false;
int i = 0;
for(ItemStack petal : stacks) {
if(petal != null) {
int count = InventoryHelper.testInventoryInsertion(inv, petal, side);
InventoryHelper.insertItemIntoInventory(inv, petal, side, -1);
ItemStack newPetal = petal.copy();
if(newPetal.stackSize == 0)
newPetal = null;
newStacks[i] = newPetal;
putAny |= count > 0;
}
i++;
}
setStacks(stack, newStacks);
if(putAny && inv instanceof TileEntityChest) {
inv = InventoryHelper.getInventory(inv);
player.displayGUIChest(inv);
}
}
return true;
}
return false;
}
public static ItemStack[] loadStacks(ItemStack stack) {
NBTTagList var2 = ItemNBTHelper.getList(stack, TAG_ITEMS, 10, false);
ItemStack[] inventorySlots = new ItemStack[16];
for(int var3 = 0; var3 < var2.tagCount(); ++var3) {
NBTTagCompound var4 = var2.getCompoundTagAt(var3);
byte var5 = var4.getByte(TAG_SLOT);
if(var5 >= 0 && var5 < inventorySlots.length)
inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
}
return inventorySlots;
}
public static void setStacks(ItemStack stack, ItemStack[] inventorySlots) {
NBTTagList var2 = new NBTTagList();
for(int var3 = 0; var3 < inventorySlots.length; ++var3)
if(inventorySlots[var3] != null) {
NBTTagCompound var4 = new NBTTagCompound();
var4.setByte(TAG_SLOT, (byte)var3);
inventorySlots[var3].writeToNBT(var4);
var2.appendTag(var4);
}
ItemNBTHelper.setList(stack, TAG_ITEMS, var2);
}
protected abstract Block getValidPickUp();
protected abstract int getGuiID();
}
@@ -0,0 +1,23 @@
package vazkii.botania.common.item.bag;
import net.minecraft.block.Block;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.lib.LibGuiIDs;
import vazkii.botania.common.lib.LibItemNames;
public class ItemFlowerBag extends ItemBagBase {
public ItemFlowerBag() {
super(LibItemNames.FLOWER_BAG);
}
@Override
protected Block getValidPickUp() {
return ModBlocks.flower;
}
@Override
protected int getGuiID() {
return LibGuiIDs.FLOWER_BAG;
}
}
@@ -0,0 +1,23 @@
package vazkii.botania.common.item.bag;
import net.minecraft.block.Block;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.lib.LibGuiIDs;
import vazkii.botania.common.lib.LibItemNames;
public class ItemShroomBag extends ItemBagBase{
public ItemShroomBag() {
super(LibItemNames.SHROOM_BAG);
}
@Override
protected Block getValidPickUp() {
return ModBlocks.mushroom;
}
@Override
protected int getGuiID() {
return LibGuiIDs.SHROOM_BAG;
}
}
@@ -4,7 +4,7 @@ import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.recipe.IElvenItem;
public class ItemBlockDreamwood extends ItemBlockWithMetadataAndName implements IElvenItem {
public class ItemBlockDreamwood extends ItemCubeWithMetadataAndName implements IElvenItem {
public ItemBlockDreamwood(Block block) {
super(block);
@@ -11,8 +11,13 @@
package vazkii.botania.common.item.block;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import vazkii.botania.api.recipe.IElvenItem;
import vazkii.botania.common.core.handler.ConfigHandler;
import java.util.List;
public class ItemBlockElven extends ItemBlockMod implements IElvenItem {
@@ -25,4 +30,9 @@ public class ItemBlockElven extends ItemBlockMod implements IElvenItem {
return ((IElvenItem) field_150939_a).isElvenItem(stack);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advancedTooltips) {
if (ConfigHandler.noMobSpawnOnBlocks)
list.add(StatCollector.translateToLocal("nomobspawnsonthisblock.tip"));
}
}
@@ -11,9 +11,14 @@
package vazkii.botania.common.item.block;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemSlab;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import vazkii.botania.common.block.decor.slabs.BlockModSlab;
import vazkii.botania.common.core.handler.ConfigHandler;
import java.util.List;
public class ItemBlockModSlab extends ItemSlab {
@@ -25,5 +30,9 @@ public class ItemBlockModSlab extends ItemSlab {
public String getUnlocalizedName(ItemStack par1ItemStack) {
return field_150939_a.getUnlocalizedName().replaceAll("tile.", "tile.botania:");
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advancedTooltips) {
if (ConfigHandler.noMobSpawnOnBlocks)
list.add(StatCollector.translateToLocal("nomobspawnsonthisblock.tip"));
}
}
@@ -11,9 +11,14 @@
package vazkii.botania.common.item.block;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemMultiTexture;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import vazkii.botania.common.block.decor.quartz.BlockSpecialQuartz;
import vazkii.botania.common.core.handler.ConfigHandler;
import java.util.List;
public class ItemBlockSpecialQuartz extends ItemMultiTexture {
@@ -25,4 +30,10 @@ public class ItemBlockSpecialQuartz extends ItemMultiTexture {
public String getUnlocalizedName(ItemStack par1ItemStack) {
return par1ItemStack.getItemDamage() >= 3 ? "" : ((BlockSpecialQuartz) field_150939_a).getNames()[par1ItemStack.getItemDamage()];
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advancedTooltips) {
if (ConfigHandler.noMobSpawnOnBlocks)
list.add(StatCollector.translateToLocal("nomobspawnsonthisblock.tip"));
}
}
@@ -14,7 +14,7 @@ import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.recipe.IElvenItem;
public class ItemBlockStorage extends ItemBlockWithMetadataAndName implements IElvenItem {
public class ItemBlockStorage extends ItemCubeWithMetadataAndName implements IElvenItem {
public ItemBlockStorage(Block block) {
super(block);
@@ -0,0 +1,22 @@
package vazkii.botania.common.item.block;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import vazkii.botania.common.core.handler.ConfigHandler;
import java.util.List;
public class ItemCubeMod extends ItemBlockMod{
public ItemCubeMod(Block block) {
super(block);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advancedTooltips) {
if (ConfigHandler.noMobSpawnOnBlocks)
list.add(StatCollector.translateToLocal("nomobspawnsonthisblock.tip"));
}
}
@@ -0,0 +1,22 @@
package vazkii.botania.common.item.block;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import vazkii.botania.common.core.handler.ConfigHandler;
import java.util.List;
public class ItemCubeWithMetadataAndName extends ItemBlockWithMetadataAndName {
public ItemCubeWithMetadataAndName(Block par2Block) {
super(par2Block);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advancedTooltips) {
if (ConfigHandler.noMobSpawnOnBlocks)
list.add(StatCollector.translateToLocal("nomobspawnsonthisblock.tip"));
}
}
@@ -94,8 +94,9 @@ public abstract class ItemBauble extends ItemMod implements IBauble, ICosmeticAt
String key = vazkii.botania.client.core.helper.RenderHelper.getKeyDisplayString("Baubles Inventory");
if(key != null)
if(key != null && !key.equals("NONE")) {
addStringToTooltip(StatCollector.translateToLocal("botania.baubletooltip").replaceAll("%key%", key), par3List);
}
ItemStack cosmetic = getCosmeticItem(par1ItemStack);
if(cosmetic != null)
@@ -105,7 +106,7 @@ public abstract class ItemBauble extends ItemMod implements IBauble, ICosmeticAt
addStringToTooltip(StatCollector.translateToLocal("botaniamisc.hasPhantomInk"), par3List);
}
void addStringToTooltip(String s, List<String> tooltip) {
public void addStringToTooltip(String s, List<String> tooltip) {
tooltip.add(s.replaceAll("&", "\u00a7"));
}
@@ -205,6 +205,15 @@ public class ItemTerraPick extends ItemManasteelPick implements IManaItem, ISequ
return pass == 1 && isEnabled(stack) ? iconOverlay : isTipped(stack) ? iconTipped : iconTool;
}
@Override
public int getHarvestLevel(ItemStack stack, String toolClass) {
if (!"pickaxe".equals(toolClass)) {
return super.getHarvestLevel(stack, toolClass);
}
// Rank S -> level 8 (Manyullyn)
return getLevel(stack) + 4;
}
public static boolean isTipped(ItemStack stack) {
return ItemNBTHelper.getBoolean(stack, TAG_TIPPED, false);
}
Loaded 100 of 122 files, more files were not shown because too many files have changed in this diff. Show more