Compare commits

...
82 Commits
Author SHA1 Message Date
Martin Robertz 49ef624bd4 Merge pull request #16 from GTNewHorizons/yeet_version_checker
update buildscript and remove update checker
2023-01-18 19:47:25 +01:00
Alexdoru 189d305a31 remove version checker 2023-01-18 14:16:53 +01:00
Alexdoru 97a45e8e0a update buildscript 2023-01-18 13:59:18 +01:00
boubou19 8c72b75e0e Merge pull request #15 from GTNewHorizons/interface
Interface IAlleleBeeAcceleratableEffect moved to Forestry
2022-10-13 16:48:19 +02:00
kuba6000 2cca9de690 Interface IAlleleBeeAcceleratableEffect moved to Forestry 2022-10-13 16:14:39 +02:00
kuba6000 6523fb0a1d Remove GT dep 2022-10-13 16:13:28 +02:00
kuba6000 8833aab1f1 Bump Forestry 2022-10-13 16:13:28 +02:00
Martin Robertz 7e9a54ced2 Merge pull request #14 from GTNewHorizons/effects
Implement acceleratable empowering bee effect
2022-10-13 10:09:08 +02:00
kuba6000 14a712260b Spotless 2022-10-12 21:09:45 +02:00
kuba6000 d993c90c3e Buildscript 2022-10-12 21:09:18 +02:00
kuba6000 e73f5a841e dep 2022-10-12 21:06:52 +02:00
kuba6000 9fcf50b61a Update AlleleEffectEmpowering.java 2022-10-12 21:03:29 +02:00
kuba6000 337d8692c6 Implement acceleratable empowering effect 2022-10-12 20:51:36 +02:00
kuba6000 8cf54bb10f Add GT5 dep 2022-10-12 20:03:23 +02:00
Martin Robertz 854ae94be6 Merge pull request #13 from ChromicRedBrick/Fix-duplicate-key
Fix localization keys
2022-10-04 16:53:29 +02:00
ChromicRedBrickandKiwi aea52904d4 Fix duplicate keys
Co-Authored-By: Kiwi <[email protected]>
2022-10-04 19:39:08 +08:00
Martin Robertz 4704d4c18c Merge pull request #12 from Kiwi233/1.7.10-krypt
Update zh_CN.lang
2022-09-24 12:34:28 +02:00
[Kiwi233] 2abb28bd8e Update zh_CN.lang 2022-09-24 14:23:22 +08:00
boubou19 011a5767a7 Merge pull request #11 from GTNewHorizons/feature/checks
Some safety checks
2022-08-03 08:46:47 +02:00
repo_alt 9fa67a8426 Some safety checks 2022-08-03 10:33:33 +04:00
Jason Mitchell fb65570ce9 [ci skip] Migrate github actions to GTNH-Actions-Workflows 2022-07-16 10:49:26 -07:00
Martin Robertz 0901392f11 Merge pull request #10 from GTNewHorizons/QuickBeeDropFix
20% instead of 0.00001% (lmao)
2022-04-27 23:19:18 +02:00
ScriptedPiky 1359133050 20% instead of 0.00001% (lmao)
Why was this even a thing is beyond me
Fixes: https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/10225
2022-04-27 13:12:54 -07:00
Martin Robertz b12577b506 Merge pull request #9 from GTNewHorizons/maven
Maven
2022-03-15 20:00:17 +01:00
bombcar b787d693b9 Maven 2022-03-15 13:36:46 -05:00
Martin Robertz 1f19dc2f5e Merge pull request #8 from GTNewHorizons/fix/ultramine
help suboptimal asm code to not generate GuiContainer in frame info
2022-03-14 07:22:18 +01:00
Glease 4e638db2a7 help suboptimal asm code to not generate GuiContainer in frame info 2022-03-13 20:51:11 +08:00
Martin Robertz db7d6ab7a2 Merge pull request #7 from GTNewHorizons/fix/build
fix the build
2022-03-13 02:51:13 +01:00
Martin Robertz 1db58409ec Update dependencies.gradle 2022-03-13 02:48:54 +01:00
Martin Robertz ff9e54760a Update dependencies.gradle 2022-03-13 02:48:22 +01:00
Glease a15b899913 fix the build 2022-03-13 09:46:38 +08:00
Martin Robertz 68a2880877 Update dependencies.gradle 2022-03-13 02:45:45 +01:00
Martin Robertz 913c4e5d00 Update dependencies.gradle 2022-03-13 02:41:49 +01:00
Martin Robertz 51f161c2e8 Update dependencies.gradle 2022-03-13 02:39:53 +01:00
Martin Robertz a49128337b Update dependencies.gradle 2022-03-13 02:35:30 +01:00
Martin Robertz 4903f97de6 Update build.gradle 2022-03-13 02:31:11 +01:00
Martin Robertz f87a689045 Update dependencies.gradle 2022-03-13 02:30:48 +01:00
Johann Bernhardt 987d7c2b11 Merge pull request #6 from GTNewHorizons/unified-build-script
Migrated to unified build script
2022-01-07 23:58:10 +01:00
Johann Bernhardt 3550fe23d4 Migrated to unified build script 2022-01-07 23:14:30 +01:00
Martin Robertz 237abd6cef Merge pull request #5 from alkcorp/1.7.10-krypt
Allows Backpack to accept wildcard items.
2021-10-07 19:45:58 +02:00
Alkalus 5e86d62433 Allows Backpack to accept wildcard items. 2021-10-07 18:40:01 +01:00
DreamMasterXXL 4c71e42dd6 bump version 2021-08-17 08:57:23 +02:00
Martin Robertz de793aa5fc Update build.gradle 2021-08-14 15:47:50 +02:00
Martin Robertz 58439c0936 Update build.gradle 2021-08-14 15:47:01 +02:00
Martin Robertz ef76ab40e3 Update gradle.properties 2021-08-14 15:43:26 +02:00
Martin Robertz d2a3b91fe0 Merge pull request #4 from D-Cysteine/1.7.10-krypt
Update to latest Forestry API
2021-08-14 15:41:30 +02:00
D-Cysteine a370c61948 Update to latest Forestry API 2021-08-12 20:54:58 -06:00
DreamMasterXXL 04ea5e8862 bump version 2020-12-03 20:37:56 +01:00
Martin Robertz b411fec0c1 Merge pull request #3 from KiloJoel/magnetFix
items go lower and don't move when close
2020-11-22 21:20:48 +01:00
KiloJoel 82368a06bf items go lower and don't move when close 2020-11-22 20:08:47 +00:00
DreamMasterXXL 58a9fa9e0f update(MB)bump version 2020-09-20 22:00:47 +02:00
Martin Robertz bcb38e8718 Merge pull request #2 from TataTawa/patch-1
Update Config.java
2020-07-27 08:58:55 +02:00
TataTawa 59d2f6bdb0 Update Config.java
Aromatic Lump Swarmer now possible for the slot of Swarmer and has the swarm chance of aromaticLumpSwarmerRate , it is a bug since Magic Bees 2.0.0
2020-07-27 03:15:21 +00:00
DreamMasterXXL 989bb6f917 bump version 2020-05-31 10:39:11 +02:00
Martin Robertz 9c044ffc9a Merge pull request #1 from Kiwi233/1.7.10-krypt
Update zh_CN.lang
2020-05-30 08:29:13 +02:00
[Kiwi233] ce32e21597 Update zh_CN.lang 2020-05-30 09:19:58 +08:00
Dream-Master 2375121778 rename version id 2020-03-08 18:56:14 +01:00
Dream-Master 5e2543027d fix broken gradle properties 2020-03-08 18:13:40 +01:00
Dream-Master 74afd10913 Merge remote-tracking branch 'TataTawa/1.7.10-krypt' into 1.7.10-krypt
# Conflicts:
#	.gitignore
#	gradle.properties
2020-03-08 18:10:13 +01:00
Dream-Master 1ef16b4dba Update gradle
not working
add libs
add gitignore
2020-03-08 18:03:01 +01:00
TataTawa c1cc32b2f6 Merge pull request #1 from ForestryMC/mc-1.7.10
[1.7.10] Thaumcraft/Thermal compat updates and fixes (#68)
2019-12-30 11:02:38 +08:00
KryptonCaptain 451f183e83 Add config for node max size
Nexus bees can be limited in their influence, if you so choose
2019-08-24 11:03:36 +10:00
KryptonCaptain bff3c669bf git stuff 2018-08-08 11:31:14 +10:00
KryptonCaptain 6c28a687ab [1.7.10] Thaumcraft/Thermal compat updates and fixes (#68)
* quick fixes 1

Fix for Brainy producing a deprecated Thaumcraft item

* quick fixes 2

Added TE signalum and lumium bees
Investigating why Amped/Rocking spawn Blizz instead of respective TE mobs

* More Thaumcraft compat

Fixed only some hives having aspects assigned
Removed the [MB] tag from research. This hasn't been needed since TC3, when addons didn't have their own tabs
Added Void metal scoop and grafter for the eldritch-inclined apiarists
Added uncommon rarity to Thaumium scoop/grafter for consistant tool look
2018-06-15 16:22:12 +02:00
KryptonCaptain 918334e5bf More Thaumcraft compat
Fixed only some hives having aspects assigned
Removed the [MB] tag from research. This hasn't been needed since TC3, when addons didn't have their own tabs
Added Void metal scoop and grafter for the eldritch-inclined apiarists
Added uncommon rarity to Thaumium scoop/grafter for consistant tool look
2018-06-11 19:36:19 +10:00
KryptonCaptain afee91a925 quick fixes 2
Added TE signalum and lumium bees
Investigating why Amped/Rocking spawn Blizz instead of respective TE mobs
2017-09-20 13:54:41 +10:00
KryptonCaptain 9196bee240 quick fixes 1
Fix for Brainy producing a deprecated Thaumcraft item
2017-09-15 22:53:42 +10:00
Elec332 824e72ac82 Fixed missing import from @rmunn 's fix 2017-08-24 00:14:43 +02:00
Elec332 fe7824eef4 build stuff 2017-08-23 10:55:26 +02:00
Robin Munn c796902c91 Fix nodes growing without limit (#33)
With this patch, aura node growth from Nexus bees will be properly
capped at 256 points per aspect, as originally intended, instead of
aspect nodes growing without any limit.
2017-08-20 12:43:13 -07:00
mezz d13d5ec3dd Merge pull request #25 from rmunn/mc-1.7.10
Fix #23: Allow Valiant bees to sometimes drop from hives
2017-07-20 20:27:45 -07:00
Robin Munn 90186aa9be Allow Valiant bees to sometimes drop from hives
Fixes #23.
2017-07-20 21:58:48 +07:00
Robin Munn 155d638647 Fix frequency of rare bee products (#18)
Due to a bug from 2015, many bee products with production chances under
10% were produced 10 times as often as they should have been. For
example, diamond shards were supposed to have a rarity of 6%, but the
bug caused them to have a rarity of 60% instead. This fixes that bug.
2017-07-13 21:04:50 -07:00
Gigabit101 130b7c6836 Added config to disable magnet sounds, Fixed effect jar not dropping inv (#144)
* Added config to disable magnet sounds

* version bump

* Fixed effect jar not dropping inv closes #108
2016-05-02 11:58:03 -07:00
Jason McRay a2ab168d69 Changed oredict entry for Emerald, Diamond and Apatite shards (#142)
Changed oredict for Emerald, Diamond and Apatite shards to nuggets
2016-04-30 12:57:49 -07:00
MysteriousAges 7987c846aa Merge branch 'master' of github.com:MagicBees/MagicBees 2016-02-19 16:29:08 -06:00
MysteriousAges 11eb9e4fb1 Version bump. 2016-02-19 16:28:53 -06:00
MysteriousAges 0569b81126 Merge pull request #127 from MagicBees/gradle-magic
Use gradle magic instead of libs folder
2016-02-19 13:27:41 -06:00
MysteriousAges 264385c778 Version bump. 2016-02-18 21:43:27 -06:00
mezz 93c8fb9dd0 Use gradle magic instead of libs folder 2016-02-11 19:53:23 -08:00
MysteriousAges 36e3209167 Bump remote version check. 2016-01-27 14:39:14 -06:00
MysteriousAges 5c81c964b1 Fixing incorrect EE3 item name for integration. 2016-01-27 14:36:42 -06:00
185 changed files with 15470 additions and 12462 deletions

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
# This is the universal Text Editor Configuration
# for all GTNewHorizons projects
# See: https://editorconfig.org/
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.{bat,ini}]
end_of_line = crlf
[*.{dtd,json,info,mcmeta,md,sh,svg,xml,xsd,xsl,yaml,yml}]
indent_size = 2
+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
+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
# bashsupport disable=BP5006 # Global environment variables
RUNDIR="run" \
CRASH="crash-reports" \
SERVERLOG="server.log"
# enable nullglob to get 0 results when no match rather than the pattern
shopt -s nullglob
# store matches in array
crash_reports=("$RUNDIR/$CRASH/crash"*.txt)
# if array not empty there are crash_reports
if [ "${#crash_reports[@]}" -gt 0 ]; then
# get the latest crash_report from array
latest_crash_report="${crash_reports[-1]}"
{
printf 'Latest crash report detected %s:\n' "${latest_crash_report##*/}"
cat "$latest_crash_report"
} >&2
exit 1
fi
if grep --quiet --fixed-strings 'Fatal errors were detected' "$SERVERLOG"; then
{
printf 'Fatal errors detected:\n'
cat server.log
} >&2
exit 1
fi
if grep --quiet --fixed-strings 'The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED' \
"$SERVERLOG"; then
{
printf 'Server force stopped:'
cat server.log
} >&2
exit 1
fi
if ! grep --quiet --perl-regexp --only-matching '.+Done \(.+\)\! For help, type "help" or "\?"' "$SERVERLOG"; then
{
printf 'Server did not finish startup:'
cat server.log
} >&2
exit 1
fi
printf 'No crash reports detected'
exit 0
+13
View File
@@ -0,0 +1,13 @@
name: Build and test
on:
pull_request:
branches: [ master, main ]
push:
branches: [ master, main ]
jobs:
build-and-test:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
secrets: inherit
+14
View File
@@ -0,0 +1,14 @@
name: Release tagged build
on:
push:
tags: [ '*' ]
permissions:
contents: write
jobs:
release-tags:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master
secrets: inherit
+28 -25
View File
@@ -1,28 +1,31 @@
# IntelliJ IDEA Files .gradle
.settings
/.idea/
/run/
/build/
/eclipse/
.classpath
.project
/bin/
/config/
/crash-reports/
/logs/
options.txt
/saves/
usernamecache.json
banned-ips.json
banned-players.json
eula.txt
ops.json
server.properties
servers.dat
usercache.json
whitelist.json
/out/
*.iml *.iml
*.ipr *.ipr
*.iws *.iws
out/ src/main/resources/mixins.*.json
.idea/ *.bat
*.DS_Store
# Eclipse Project Files !gradlew.bat
.classpath
.project
.settings/
eclipse/
# Gradle
.gradle
gradle/
build/
debug/
bin/
config/
crash-reports/
logs/
mods/
saves/
usernamecache.json
options.txt
asm
Thumbs.db
-3
View File
@@ -1,3 +0,0 @@
[submodule "src/api/java/thaumcraft/api"]
path = src/api/java/thaumcraft/api
url = https://github.com/Azanor/thaumcraft-api
+3
View File
@@ -0,0 +1,3 @@
# Any Github changes require admin approval
/.github/** @GTNewHorizons/admin
+1092 -50
View File
File diff suppressed because it is too large. Load diff
+9
View File
@@ -0,0 +1,9 @@
// Add your dependencies here
dependencies {
compile('com.github.GTNewHorizons:ForestryMC:4.5.2:dev')
compileOnly('com.github.GTNewHorizons:Baubles:1.0.1.14:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:Botania:1.9.2-GTNH:api') {transitive = false}
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') {transitive = false}
}
-3
View File
@@ -1,3 +0,0 @@
2.4.1
false
Bugfixes aplenty! You'll probably want them.
+62 -8
View File
@@ -1,10 +1,64 @@
version_major=2 modName = Magic Bees
version_minor=4
version_rev=2
version_forestry=4.2.5.53 # This is a case-sensitive string to identify your mod. Convention is to use lower case.
version_botania=r1.8-248 modId = MagicBees
version_baubles=1.0.1.10
version_mc=1.7.10 modGroup = magicbees
version_forge=10.13.4.1566-1.7.10
# 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/
# Will update your build.gradle automatically whenever an update is available
autoUpdateBuildScript = false
minecraftVersion = 1.7.10
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
# 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 = VersionInfo.java
gradleTokenModId =
gradleTokenModName =
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenGroupName =
# 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
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 =
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = 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 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 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence 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
# projects. New projects should not use this parameter.
customArchiveBaseName = magicbees
Binary file not shown.
+1 -2
View File
@@ -1,6 +1,5 @@
#Wed Jul 02 15:54:47 CDT 2014
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip
Vendored
+77 -53
View File
@@ -1,4 +1,20 @@
#!/usr/bin/env bash #!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
############################################################################## ##############################################################################
## ##
@@ -6,47 +22,6 @@
## ##
############################################################################## ##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME # Attempt to set APP_HOME
# Resolve links: $0 may be a link # Resolve links: $0 may be a link
PRG="$0" PRG="$0"
@@ -61,9 +36,49 @@ while [ -h "$PRG" ] ; do
fi fi
done done
SAVED="`pwd`" SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&- cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`" APP_HOME="`pwd -P`"
cd "$SAVED" >&- 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"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# 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
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@@ -90,7 +105,7 @@ location of your Java installation."
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n` MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@@ -110,10 +125,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi fi
# For Cygwin, switch paths to Windows format before running java # For Cygwin or MSYS, switch paths to Windows format before running java
if $cygwin ; then if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"` APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath # We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
@@ -154,11 +170,19 @@ if $cygwin ; then
esac esac
fi fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules # Escape application args
function splitJvmOpts() { save () {
JVM_OPTS=("$@") for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
} }
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS APP_ARGS=$(save "$@")
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" # 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"
# 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")"
fi
exec "$JAVACMD" "$@"
Vendored
+20 -10
View File
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%" == "" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@@ -8,14 +24,14 @@
@rem Set local scope for the variables with windows NT shell @rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
@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=
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@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"
@rem Find java.exe @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome if defined JAVA_HOME goto findJavaFromJavaHome
@@ -46,10 +62,9 @@ echo location of your Java installation.
goto fail goto fail
:init :init
@rem Get command-line arguments, handling Windowz variants @rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args :win9xME_args
@rem Slurp the command line arguments. @rem Slurp the command line arguments.
@@ -60,11 +75,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%* set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute :execute
@rem Setup the command line @rem Setup the command line
+2
View File
@@ -0,0 +1,2 @@
before_install:
- ./gradlew setupCIWorkspace
Binary file not shown.
Binary file not shown.
+26
View File
@@ -0,0 +1,26 @@
// Add any additional repositories for your dependencies here
repositories {
maven {
name 'GTNH Maven'
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
allowInsecureProtocol
}
maven {
name 'ic2'
url 'https://maven.ic2.player.to/'
metadataSources {
mavenPom()
artifact()
}
}
maven {
url 'https://jitpack.io'
}
maven {
url 'https://cursemaven.com'
content {
includeGroup 'curse.maven'
}
}
}
+10
View File
@@ -0,0 +1,10 @@
plugins {
id 'com.diffplug.blowdryerSetup' version '1.6.0'
}
apply plugin: 'com.diffplug.blowdryerSetup'
blowdryerSetup {
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.1.5')
//devLocal '.' // Use this when testing config updates locally
}
@@ -2,12 +2,11 @@ package magicbees.api;
import magicbees.api.bees.ITransmutationEffectController; import magicbees.api.bees.ITransmutationEffectController;
public class MagicBeesAPI public class MagicBeesAPI {
{ // Use this object during or after the Mod.Init phase to add your logic to the Transmutation bee effect.
// Use this object during or after the Mod.Init phase to add your logic to the Transmutation bee effect. public static ITransmutationEffectController transmutationEffectController;
public static ITransmutationEffectController transmutationEffectController;
// This is a reference to the Tempus aspect. Initialized after MagicBees's post init phase. // This is a reference to the Tempus aspect. Initialized after MagicBees's post init phase.
// Ensure it is not null, and cast it to thaumcraft.api.aspects.Aspect. // Ensure it is not null, and cast it to thaumcraft.api.aspects.Aspect.
public static Object thaumcraftAspectTempus; public static Object thaumcraftAspectTempus;
} }
@@ -1,8 +1,8 @@
package magicbees.api.bees; package magicbees.api.bees;
public enum AuraChargeType { public enum AuraChargeType {
MUTATION, MUTATION,
DEATH, DEATH,
PRODUCTION, PRODUCTION,
; ;
} }
@@ -8,39 +8,39 @@ package magicbees.api.bees;
*/ */
public interface IMagicApiaryAuraProvider { public interface IMagicApiaryAuraProvider {
/** /**
* Requests a mutation charge from the aura provider. If true is returned, the * Requests a mutation charge from the aura provider. If true is returned, the
* aura provider should decrement its internal charge by one. If there are no * aura provider should decrement its internal charge by one. If there are no
* charges remaining, it should return false. * charges remaining, it should return false.
* *
* @return True if a charge is given; false otherwise. * @return True if a charge is given; false otherwise.
*/ */
boolean getMutationCharge(); boolean getMutationCharge();
/** /**
* Requests a mutation charge from the aura provider. If true is returned, the * Requests a mutation charge from the aura provider. If true is returned, the
* aura provider should decrement its internal charge by one. If there are no * aura provider should decrement its internal charge by one. If there are no
* charges remaining, it should return false. * charges remaining, it should return false.
* *
* @return True if a charge is given; false otherwise. * @return True if a charge is given; false otherwise.
*/ */
boolean getDeathRateCharge(); boolean getDeathRateCharge();
/** /**
* Requests a mutation charge from the aura provider. If true is returned, the * Requests a mutation charge from the aura provider. If true is returned, the
* aura provider should decrement its internal charge by one. If there are no * aura provider should decrement its internal charge by one. If there are no
* charges remaining, it should return false. * charges remaining, it should return false.
* *
* @return True if a charge is given; false otherwise. * @return True if a charge is given; false otherwise.
*/ */
boolean getProductionCharge(); boolean getProductionCharge();
/** /**
* Requests a mutation charge from the aura provider. If true is returned, the * Requests a mutation charge from the aura provider. If true is returned, the
* aura provider should decrement its internal charge by one. If there are no * aura provider should decrement its internal charge by one. If there are no
* charges remaining, it should return false. * charges remaining, it should return false.
* *
* @return True if a charge is given; false otherwise. * @return True if a charge is given; false otherwise.
*/ */
boolean getCharge(AuraChargeType auraChargeType); boolean getCharge(AuraChargeType auraChargeType);
} }
@@ -7,8 +7,6 @@ package magicbees.api.bees;
* @author MysteriousAges * @author MysteriousAges
* *
*/ */
public interface ITransmutationEffectController public interface ITransmutationEffectController {
{ public void addEffectLogic(ITransmutationEffectLogic logic);
public void addEffectLogic(ITransmutationEffectLogic logic);
} }
@@ -12,22 +12,21 @@ import net.minecraft.world.biome.BiomeGenBase;
* @author MysteriousAges * @author MysteriousAges
* *
*/ */
public interface ITransmutationEffectLogic public interface ITransmutationEffectLogic {
{ /**
/** * Allows an external mod to add transmutation logic to the Transmuting bee effect.
* Allows an external mod to add transmutation logic to the Transmuting bee effect. * Called from a list of ITransmutationEffectLogic until one returns true. You can
* Called from a list of ITransmutationEffectLogic until one returns true. You can * implement more than one transmutation effect in a single implementation of the
* implement more than one transmutation effect in a single implementation of the * interface. Function checks for a series of conditions based on block ID/meta, or
* interface. Function checks for a series of conditions based on block ID/meta, or * biome information, or world information.
* biome information, or world information. *
* * @param world World object
* @param world World object * @param biome Biome information for current coordinates
* @param biome Biome information for current coordinates * @param sourceBlock ItemStack representing the block at current coordinates
* @param sourceBlock ItemStack representing the block at current coordinates * @param x Current X coordinate to attempt a transmute
* @param x Current X coordinate to attempt a transmute * @param y Current Y coordinate to attempt a transmute
* @param y Current Y coordinate to attempt a transmute * @param z Current Z coordinate to attempt a transmute
* @param z Current Z coordinate to attempt a transmute * @return true if a block was changed.
* @return true if a block was changed. */
*/ public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z);
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z);
} }
+269 -247
View File
@@ -1,5 +1,15 @@
package magicbees.bees; package magicbees.bees;
import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.apiculture.IAlleleBeeEffect;
import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleEffect;
import forestry.api.genetics.IAlleleFlowers;
import forestry.api.genetics.IAlleleRegistry;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IFlowerProvider;
import magicbees.api.MagicBeesAPI; import magicbees.api.MagicBeesAPI;
import magicbees.bees.allele.effect.AlleleEffectCrumbling; import magicbees.bees.allele.effect.AlleleEffectCrumbling;
import magicbees.bees.allele.effect.AlleleEffectCure; import magicbees.bees.allele.effect.AlleleEffectCure;
@@ -30,286 +40,298 @@ import magicbees.main.utils.compat.ThermalModsHelper;
import net.minecraft.potion.Potion; import net.minecraft.potion.Potion;
import thaumcraft.api.nodes.NodeType; import thaumcraft.api.nodes.NodeType;
import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.apiculture.IAlleleBeeEffect;
import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleEffect;
import forestry.api.genetics.IAlleleFlowers;
import forestry.api.genetics.IAlleleRegistry;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IFlowerProvider;
public class Allele implements IAllele { public class Allele implements IAllele {
private static final String FLOWER_ARS_MAGICA_PLANT = "flowerArsMagicaPlant"; private static final String FLOWER_ARS_MAGICA_PLANT = "flowerArsMagicaPlant";
private static final String FLOWER_BOTANIA = "flowerBotania"; private static final String FLOWER_BOTANIA = "flowerBotania";
private static final String EFFECT_TE_BLIZZY = "TEBlizzy"; private static final String EFFECT_TE_BLIZZY = "TEBlizzy";
private static final String EFFECT_TE_BLITZ = "TEBlitz"; private static final String EFFECT_TE_BLITZ = "TEBlitz";
private static final String EFFECT_TE_BASALZ = "TEBasalz"; private static final String EFFECT_TE_BASALZ = "TEBasalz";
private static final String EFFECT_AM_WISP = "AMWisp"; private static final String EFFECT_AM_WISP = "AMWisp";
private static final String EFFECT_MANA_DRAIN = "ManaDrain"; private static final String EFFECT_MANA_DRAIN = "ManaDrain";
private static final String EFFECT_DREAMING = "Dreaming"; private static final String EFFECT_DREAMING = "Dreaming";
private static final String EFFECT_WISPY = "Wispy"; private static final String EFFECT_WISPY = "Wispy";
private static final String EFFECT_BATTY = "Batty"; private static final String EFFECT_BATTY = "Batty";
private static final String EFFECT_BRAINY = "Brainy"; private static final String EFFECT_BRAINY = "Brainy";
private static final String EFFECT_NODE_RAVENING = "NodeRavening"; private static final String EFFECT_NODE_RAVENING = "NodeRavening";
private static final String EFFECT_NODE_PURIFYING = "NodePurifying"; private static final String EFFECT_NODE_PURIFYING = "NodePurifying";
private static final String EFFECT_NODE_TAINTING = "NodeTainting"; private static final String EFFECT_NODE_TAINTING = "NodeTainting";
private static final String EFFECT_NODE_REPAIR = "NodeRepair"; private static final String EFFECT_NODE_REPAIR = "NodeRepair";
private static final String EFFECT_NODE_EMPOWER = "NodeEmpower"; private static final String EFFECT_NODE_EMPOWER = "NodeEmpower";
private static final String EFFECT_VIS_RECHARGE = "VisRecharge"; private static final String EFFECT_VIS_RECHARGE = "VisRecharge";
private static final String FLOWERS_AURA_NODE = "AuraNode"; private static final String FLOWERS_AURA_NODE = "AuraNode";
private static final String FLOWERS_THAUMCRAFT_PLANT = "ThaumcraftPlant"; private static final String FLOWERS_THAUMCRAFT_PLANT = "ThaumcraftPlant";
public static AlleleFloat speedBlinding; public static AlleleFloat speedBlinding;
public static IAlleleBeeEffect forestryBaseEffect; public static IAlleleBeeEffect forestryBaseEffect;
public static IAlleleFlowers flowerBookshelf; public static IAlleleFlowers flowerBookshelf;
public static IAlleleFlowers flowerThaumcraft; public static IAlleleFlowers flowerThaumcraft;
public static IAlleleFlowers flowerArsMagica; public static IAlleleFlowers flowerArsMagica;
public static IAlleleFlowers flowerAuraNode; public static IAlleleFlowers flowerAuraNode;
public static IAlleleFlowers flowerBotania; public static IAlleleFlowers flowerBotania;
public static IAlleleEffect effectCleansing; public static IAlleleEffect effectCleansing;
public static IAlleleEffect effectDigSpeed; public static IAlleleEffect effectDigSpeed;
public static IAlleleEffect effectMoveSpeed; public static IAlleleEffect effectMoveSpeed;
public static IAlleleEffect effectSlowSpeed; public static IAlleleEffect effectSlowSpeed;
public static IAlleleEffect effectWithering; public static IAlleleEffect effectWithering;
public static IAlleleEffect effectVisRecharge; public static IAlleleEffect effectVisRecharge;
public static IAlleleEffect effectNodeEmpower; public static IAlleleEffect effectNodeEmpower;
public static IAlleleEffect effectNodeRepair; public static IAlleleEffect effectNodeRepair;
public static IAlleleEffect effectNodeConversionTaint; public static IAlleleEffect effectNodeConversionTaint;
public static IAlleleEffect effectNodeConversionPure; public static IAlleleEffect effectNodeConversionPure;
public static IAlleleEffect effectNodeConversionHungry; public static IAlleleEffect effectNodeConversionHungry;
public static IAlleleEffect effectTransmuting; public static IAlleleEffect effectTransmuting;
public static IAlleleEffect effectCrumbling; public static IAlleleEffect effectCrumbling;
public static IAlleleEffect effectInvisibility; public static IAlleleEffect effectInvisibility;
public static IAlleleEffect effectDreaming; public static IAlleleEffect effectDreaming;
public static IAlleleEffect spawnWolf; public static IAlleleEffect spawnWolf;
public static IAlleleEffect spawnBats; public static IAlleleEffect spawnBats;
public static IAlleleEffect spawnCow; public static IAlleleEffect spawnCow;
public static IAlleleEffect spawnChicken; public static IAlleleEffect spawnChicken;
public static IAlleleEffect spawnPig; public static IAlleleEffect spawnPig;
public static IAlleleEffect spawnSheep; public static IAlleleEffect spawnSheep;
public static IAlleleEffect spawnCat; public static IAlleleEffect spawnCat;
public static IAlleleEffect spawnHorse; public static IAlleleEffect spawnHorse;
public static IAlleleEffect spawnGhast; public static IAlleleEffect spawnGhast;
public static IAlleleEffect spawnSpider; public static IAlleleEffect spawnSpider;
public static IAlleleEffect spawnBlaze; public static IAlleleEffect spawnBlaze;
public static IAlleleEffect spawnBrainyZombie; public static IAlleleEffect spawnBrainyZombie;
public static IAlleleEffect spawnWisp; public static IAlleleEffect spawnWisp;
public static IAlleleEffect spawnBlizz; public static IAlleleEffect spawnBlizz;
public static IAlleleEffect spawnBlitz; public static IAlleleEffect spawnBlitz;
public static IAlleleEffect spawnBasalz; public static IAlleleEffect spawnBasalz;
public static IAlleleEffect spawnManaDrainer; public static IAlleleEffect spawnManaDrainer;
public static IAlleleEffect spawnWispOrHecate; public static IAlleleEffect spawnWispOrHecate;
public static void setupAdditionalAlleles() { public static void setupAdditionalAlleles() {
forestryBaseEffect = (IAlleleBeeEffect) getBaseAllele("effectNone"); forestryBaseEffect = (IAlleleBeeEffect) getBaseAllele("effectNone");
IFlowerProvider vanillaFlowers = ((IAlleleFlowers)getBaseAllele("flowersVanilla")).getProvider(); IFlowerProvider vanillaFlowers = ((IAlleleFlowers) getBaseAllele("flowersVanilla")).getProvider();
speedBlinding = new AlleleFloat("speedBlinding", 2f, false, EnumBeeChromosome.SPEED); speedBlinding = new AlleleFloat("speedBlinding", 2f, false, EnumBeeChromosome.SPEED);
flowerBookshelf = new AlleleFlower("Bookshelf", new FlowerProviderBookshelf(), true); flowerBookshelf = new AlleleFlower("Bookshelf", new FlowerProviderBookshelf(), true);
effectCleansing = new AlleleEffectCure("Curative", false); effectCleansing = new AlleleEffectCure("Curative", false);
effectDigSpeed = new AlleleEffectPotion("DigSpeed", Potion.digSpeed, 15, false); effectDigSpeed = new AlleleEffectPotion("DigSpeed", Potion.digSpeed, 15, false);
effectMoveSpeed = new AlleleEffectPotion("MoveSpeed", Potion.moveSpeed, 10, false); effectMoveSpeed = new AlleleEffectPotion("MoveSpeed", Potion.moveSpeed, 10, false);
effectSlowSpeed = new AlleleEffectPotion("SlowSpeed", Potion.moveSlowdown, 3, false).setMalicious(); effectSlowSpeed = new AlleleEffectPotion("SlowSpeed", Potion.moveSlowdown, 3, false).setMalicious();
effectWithering = new AlleleEffectPotion("Withering", Potion.wither, 10, false).setMalicious(); effectWithering = new AlleleEffectPotion("Withering", Potion.wither, 10, false).setMalicious();
TransmutationEffectController controller = new TransmutationEffectController( TransmutationEffectController controller =
new TransmutationEffectRailcraft(), new TransmutationEffectController(new TransmutationEffectRailcraft(), new TransmutationEffectVanilla());
new TransmutationEffectVanilla() MagicBeesAPI.transmutationEffectController = controller;
); effectTransmuting = new AlleleEffectTransmuting("Transmuting", true, controller, 200);
MagicBeesAPI.transmutationEffectController = controller; effectCrumbling = new AlleleEffectCrumbling("Crumbling", true);
effectTransmuting = new AlleleEffectTransmuting("Transmuting", true, controller, 200);
effectCrumbling = new AlleleEffectCrumbling("Crumbling", true);
effectInvisibility = new AlleleEffectPotion("Invisibility", Potion.invisibility, 10, false); effectInvisibility = new AlleleEffectPotion("Invisibility", Potion.invisibility, 10, false);
spawnGhast = new AlleleEffectSpawnMob("Ghastly", false, "Ghast", "mob.ghast.moan") spawnGhast = new AlleleEffectSpawnMob("Ghastly", false, "Ghast", "mob.ghast.moan")
.setThrottle(2060) .setThrottle(2060)
.setChanceToSpawn(10) .setChanceToSpawn(10)
.setMaxMobsInSpawnZone(1); .setMaxMobsInSpawnZone(1);
spawnSpider = new AlleleEffectSpawnMob("Spidery", false, "Spider", "mob.spider.step") spawnSpider = new AlleleEffectSpawnMob("Spidery", false, "Spider", "mob.spider.step")
.setThrottle(400) .setThrottle(400)
.setChanceToSpawn(70) .setChanceToSpawn(70)
.setMaxMobsInSpawnZone(4); .setMaxMobsInSpawnZone(4);
spawnBlaze = new AlleleEffectSpawnMob("Ablaze", false, "Blaze", "mob.blaze.breathe") spawnBlaze = new AlleleEffectSpawnMob("Ablaze", false, "Blaze", "mob.blaze.breathe")
.setThrottle(800) .setThrottle(800)
.setChanceToSpawn(60) .setChanceToSpawn(60)
.setMaxMobsInSpawnZone(2); .setMaxMobsInSpawnZone(2);
spawnWolf = new AlleleEffectSpawnMob("Canine", false , "Wolf", "mob.wolf.panting") spawnWolf = new AlleleEffectSpawnMob("Canine", false, "Wolf", "mob.wolf.panting")
.setThrottle(650) .setThrottle(650)
.setChanceToSpawn(40) .setChanceToSpawn(40)
.setMaxMobsInSpawnZone(2); .setMaxMobsInSpawnZone(2);
spawnPig = new AlleleEffectSpawnMob("Porcine", true, "Pig", "mob.pig.say") spawnPig = new AlleleEffectSpawnMob("Porcine", true, "Pig", "mob.pig.say")
.setThrottle(350) .setThrottle(350)
.setMaxMobsInSpawnZone(4); .setMaxMobsInSpawnZone(4);
spawnCow = new AlleleEffectSpawnMob("Bovine", true, "Cow", "mob.cow.say") spawnCow = new AlleleEffectSpawnMob("Bovine", true, "Cow", "mob.cow.say")
.setThrottle(640) .setThrottle(640)
.setMaxMobsInSpawnZone(3); .setMaxMobsInSpawnZone(3);
spawnChicken = new AlleleEffectSpawnMob("Chicken", true, "Chicken", "mob.chicken.hurt") spawnChicken = new AlleleEffectSpawnMob("Chicken", true, "Chicken", "mob.chicken.hurt")
.setThrottle(20) .setThrottle(20)
.setMaxMobsInSpawnZone(20); .setMaxMobsInSpawnZone(20);
spawnSheep = new AlleleEffectSpawnMob("Sheep", false, "Sheep", "mob.sheep.say") spawnSheep = new AlleleEffectSpawnMob("Sheep", false, "Sheep", "mob.sheep.say")
.setThrottle(450) .setThrottle(450)
.setMaxMobsInSpawnZone(5); .setMaxMobsInSpawnZone(5);
spawnCat = new AlleleEffectSpawnMob("Catty", false, "Ozelot", "mob.cat.meow") spawnCat = new AlleleEffectSpawnMob("Catty", false, "Ozelot", "mob.cat.meow")
.setThrottle(702) .setThrottle(702)
.setChanceToSpawn(60) .setChanceToSpawn(60)
.setMaxMobsInSpawnZone(2); .setMaxMobsInSpawnZone(2);
spawnHorse = new AlleleEffectSpawnMob("Horse", false, "EntityHorse", "mob.horse.idle") spawnHorse = new AlleleEffectSpawnMob("Horse", false, "EntityHorse", "mob.horse.idle")
.setThrottle(450) .setThrottle(450)
.setChanceToSpawn(59) .setChanceToSpawn(59)
.setMaxMobsInSpawnZone(2); .setMaxMobsInSpawnZone(2);
if (ThaumcraftHelper.isActive()) { if (ThaumcraftHelper.isActive()) {
flowerThaumcraft = new AlleleFlower(FLOWERS_THAUMCRAFT_PLANT, new FlowerProviderThaumcraftFlower(), false); flowerThaumcraft = new AlleleFlower(FLOWERS_THAUMCRAFT_PLANT, new FlowerProviderThaumcraftFlower(), false);
flowerAuraNode = new AlleleFlower(FLOWERS_AURA_NODE, new FlowerProviderAuraNode(), true); flowerAuraNode = new AlleleFlower(FLOWERS_AURA_NODE, new FlowerProviderAuraNode(), true);
effectVisRecharge = new AlleleEffectRecharge(EFFECT_VIS_RECHARGE, false); effectVisRecharge = new AlleleEffectRecharge(EFFECT_VIS_RECHARGE, false);
effectNodeEmpower = new AlleleEffectEmpowering(EFFECT_NODE_EMPOWER, false); effectNodeEmpower = new AlleleEffectEmpowering(EFFECT_NODE_EMPOWER, false);
effectNodeRepair = new AlleleEffectNodeRepair(EFFECT_NODE_REPAIR, false); effectNodeRepair = new AlleleEffectNodeRepair(EFFECT_NODE_REPAIR, false);
effectNodeConversionTaint = new AlleleEffectNodeConversion(EFFECT_NODE_TAINTING, NodeType.TAINTED, false, 250); effectNodeConversionTaint =
effectNodeConversionPure = new AlleleEffectNodeConversion(EFFECT_NODE_PURIFYING, NodeType.PURE, false, 250); new AlleleEffectNodeConversion(EFFECT_NODE_TAINTING, NodeType.TAINTED, false, 250);
effectNodeConversionHungry = new AlleleEffectNodeConversion(EFFECT_NODE_RAVENING, NodeType.HUNGRY, false, 2); effectNodeConversionPure = new AlleleEffectNodeConversion(EFFECT_NODE_PURIFYING, NodeType.PURE, false, 250);
effectNodeConversionHungry =
new AlleleEffectNodeConversion(EFFECT_NODE_RAVENING, NodeType.HUNGRY, false, 2);
spawnBrainyZombie = new AlleleEffectSpawnMob(EFFECT_BRAINY, false, ThaumcraftHelper.Entity.BRAINY_ZOMBIE.entityID) spawnBrainyZombie = new AlleleEffectSpawnMob(
.setAggrosPlayerOnSpawn() EFFECT_BRAINY, false, ThaumcraftHelper.Entity.BRAINY_ZOMBIE.entityID)
.setThrottle(800) .setAggrosPlayerOnSpawn()
.setSpawnsOnPlayerNear(null) .setThrottle(800)
.setMaxMobsInSpawnZone(2); .setSpawnsOnPlayerNear(null)
.setMaxMobsInSpawnZone(2);
spawnBats = new AlleleEffectSpawnMob(EFFECT_BATTY, false, ThaumcraftHelper.Entity.FIREBAT.entityID) spawnBats = new AlleleEffectSpawnMob(EFFECT_BATTY, false, ThaumcraftHelper.Entity.FIREBAT.entityID)
.setThrottle(300) .setThrottle(300)
.setSpawnsOnPlayerNear("Bat"); .setSpawnsOnPlayerNear("Bat");
spawnWisp = new AlleleEffectSpawnWisp(EFFECT_WISPY, false, ThaumcraftHelper.Entity.WISP.entityID, "thaumcraft.wisplive") spawnWisp = new AlleleEffectSpawnWisp(
.setThrottle(1800) EFFECT_WISPY, false, ThaumcraftHelper.Entity.WISP.entityID, "thaumcraft.wisplive")
.setChanceToSpawn(79); .setThrottle(1800)
} .setChanceToSpawn(79);
else { } else {
spawnBats = new AlleleEffectSpawnMob(EFFECT_BATTY, false, "Bat") spawnBats = new AlleleEffectSpawnMob(EFFECT_BATTY, false, "Bat").setThrottle(150);
.setThrottle(150);
flowerThaumcraft = new AlleleFlower(FLOWERS_THAUMCRAFT_PLANT, vanillaFlowers, false); flowerThaumcraft = new AlleleFlower(FLOWERS_THAUMCRAFT_PLANT, vanillaFlowers, false);
flowerAuraNode = new AlleleFlower(FLOWERS_AURA_NODE, vanillaFlowers, true);Allele.effectVisRecharge = new AlleleEffectRecharge(EFFECT_VIS_RECHARGE, false); flowerAuraNode = new AlleleFlower(FLOWERS_AURA_NODE, vanillaFlowers, true);
effectNodeEmpower = new AlleleEffectPlaceholder(EFFECT_NODE_EMPOWER, false); Allele.effectVisRecharge = new AlleleEffectRecharge(EFFECT_VIS_RECHARGE, false);
effectNodeRepair = new AlleleEffectPlaceholder(EFFECT_NODE_REPAIR, false); effectNodeEmpower = new AlleleEffectPlaceholder(EFFECT_NODE_EMPOWER, false);
effectNodeConversionTaint = new AlleleEffectPlaceholder(EFFECT_NODE_TAINTING, false); effectNodeRepair = new AlleleEffectPlaceholder(EFFECT_NODE_REPAIR, false);
effectNodeConversionPure = new AlleleEffectPlaceholder(EFFECT_NODE_PURIFYING, false); effectNodeConversionTaint = new AlleleEffectPlaceholder(EFFECT_NODE_TAINTING, false);
effectNodeConversionHungry = new AlleleEffectPlaceholder(EFFECT_NODE_RAVENING, false); effectNodeConversionPure = new AlleleEffectPlaceholder(EFFECT_NODE_PURIFYING, false);
spawnBrainyZombie = new AlleleEffectPlaceholder(EFFECT_BRAINY, false); effectNodeConversionHungry = new AlleleEffectPlaceholder(EFFECT_NODE_RAVENING, false);
spawnWisp = new AlleleEffectPlaceholder(EFFECT_WISPY, false); spawnBrainyZombie = new AlleleEffectPlaceholder(EFFECT_BRAINY, false);
} spawnWisp = new AlleleEffectPlaceholder(EFFECT_WISPY, false);
}
if (BotaniaHelper.isActive()) { if (BotaniaHelper.isActive()) {
flowerBotania = new AlleleFlower(FLOWER_BOTANIA, new FlowerProviderBotania(), true); flowerBotania = new AlleleFlower(FLOWER_BOTANIA, new FlowerProviderBotania(), true);
effectDreaming = new AlleleEffectTransmuting(EFFECT_DREAMING, false, effectDreaming = new AlleleEffectTransmuting(
new TransmutationEffectController(new TransmutationEffectLBotaniaLiving()), 100); EFFECT_DREAMING,
} false,
else { new TransmutationEffectController(new TransmutationEffectLBotaniaLiving()),
flowerBotania = new AlleleFlower(FLOWER_BOTANIA, vanillaFlowers, true); 100);
effectDreaming = new AlleleEffectPlaceholder(EFFECT_DREAMING, false); } else {
} flowerBotania = new AlleleFlower(FLOWER_BOTANIA, vanillaFlowers, true);
effectDreaming = new AlleleEffectPlaceholder(EFFECT_DREAMING, false);
}
if (ArsMagicaHelper.isActive()) { if (ArsMagicaHelper.isActive()) {
flowerArsMagica = new AlleleFlower(FLOWER_ARS_MAGICA_PLANT, new FlowerProviderArsMagicaFlower(), false); flowerArsMagica = new AlleleFlower(FLOWER_ARS_MAGICA_PLANT, new FlowerProviderArsMagicaFlower(), false);
spawnManaDrainer = new AlleleEffectSpawnMobWeighted(EFFECT_MANA_DRAIN, true, 20, spawnManaDrainer = new AlleleEffectSpawnMobWeighted(
new String[] { ArsMagicaHelper.Name + ".MobManaCreeper", ArsMagicaHelper.Name + ".ManaVortex" }, EFFECT_MANA_DRAIN,
new int[] { 60, 2 } true,
); 20,
new String[] {ArsMagicaHelper.Name + ".MobManaCreeper", ArsMagicaHelper.Name + ".ManaVortex"},
new int[] {60, 2});
spawnWispOrHecate = new AlleleEffectSpawnMobWeighted(EFFECT_AM_WISP, true, 20, spawnWispOrHecate = new AlleleEffectSpawnMobWeighted(
new String[] { ArsMagicaHelper.Name + ".MobWisp", ArsMagicaHelper.Name + ".MobHecate" }, EFFECT_AM_WISP,
new int[] { 40, 3 } true,
); 20,
} new String[] {ArsMagicaHelper.Name + ".MobWisp", ArsMagicaHelper.Name + ".MobHecate"},
else { new int[] {40, 3});
flowerArsMagica = new AlleleFlower(FLOWER_ARS_MAGICA_PLANT, vanillaFlowers, false); } else {
spawnManaDrainer = new AlleleEffectPlaceholder(EFFECT_MANA_DRAIN, true); flowerArsMagica = new AlleleFlower(FLOWER_ARS_MAGICA_PLANT, vanillaFlowers, false);
spawnWispOrHecate = new AlleleEffectPlaceholder(EFFECT_AM_WISP, true); spawnManaDrainer = new AlleleEffectPlaceholder(EFFECT_MANA_DRAIN, true);
} spawnWispOrHecate = new AlleleEffectPlaceholder(EFFECT_AM_WISP, true);
}
if (ThermalModsHelper.isActive()) { // TODO TE spawning
spawnBlizz = new AlleleEffectSpawnMob(EFFECT_TE_BLIZZY, true, ThermalModsHelper.Entity.BLIZZ.entityID, ThermalModsHelper.Entity.BLIZZ.soundName) if (ThermalModsHelper.isActive()) {
.setThrottle(100) spawnBlizz = new AlleleEffectSpawnMob(
.setChanceToSpawn(80); EFFECT_TE_BLIZZY,
spawnBlitz = new AlleleEffectSpawnMob(EFFECT_TE_BLITZ, true, ThermalModsHelper.Entity.BLIZZ.entityID, ThermalModsHelper.Entity.BLIZZ.soundName) true,
.setThrottle(100) ThermalModsHelper.Entity.BLIZZ.entityID,
.setChanceToSpawn(80); ThermalModsHelper.Entity.BLIZZ.soundName)
spawnBasalz = new AlleleEffectSpawnMob(EFFECT_TE_BASALZ, true, ThermalModsHelper.Entity.BLIZZ.entityID, ThermalModsHelper.Entity.BLIZZ.soundName) .setThrottle(100)
.setThrottle(100) .setChanceToSpawn(80);
.setChanceToSpawn(80); spawnBlitz = new AlleleEffectSpawnMob(
} EFFECT_TE_BLITZ,
else { true,
spawnBlizz = new AlleleEffectPlaceholder(EFFECT_TE_BLIZZY, true); ThermalModsHelper.Entity.BLITZ.entityID,
spawnBlitz = new AlleleEffectPlaceholder(EFFECT_TE_BLITZ, true); ThermalModsHelper.Entity.BLITZ.soundName)
spawnBasalz = new AlleleEffectPlaceholder(EFFECT_TE_BASALZ, true); .setThrottle(100)
} .setChanceToSpawn(80);
} spawnBasalz = new AlleleEffectSpawnMob(
EFFECT_TE_BASALZ,
true,
ThermalModsHelper.Entity.BASALZ.entityID,
ThermalModsHelper.Entity.BASALZ.soundName)
.setThrottle(100)
.setChanceToSpawn(80);
} else {
spawnBlizz = new AlleleEffectPlaceholder(EFFECT_TE_BLIZZY, true);
spawnBlitz = new AlleleEffectPlaceholder(EFFECT_TE_BLITZ, true);
spawnBasalz = new AlleleEffectPlaceholder(EFFECT_TE_BASALZ, true);
}
}
public static void registerDeprecatedAlleleReplacements() { public static void registerDeprecatedAlleleReplacements() {
IAlleleRegistry registry = AlleleManager.alleleRegistry; IAlleleRegistry registry = AlleleManager.alleleRegistry;
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodeAttract", effectNodeEmpower); registry.registerDeprecatedAlleleReplacement("magicbees.effectNodeAttract", effectNodeEmpower);
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodePurify", effectNodeConversionPure); registry.registerDeprecatedAlleleReplacement("magicbees.effectNodePurify", effectNodeConversionPure);
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodeFlux", effectNodeConversionTaint); registry.registerDeprecatedAlleleReplacement("magicbees.effectNodeFlux", effectNodeConversionTaint);
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodeCharge", effectNodeEmpower); registry.registerDeprecatedAlleleReplacement("magicbees.effectNodeCharge", effectNodeEmpower);
registry.registerDeprecatedAlleleReplacement("magicbees.speciesTCAttractive", BeeSpecies.TC_EMPOWERING.getSpecies()); registry.registerDeprecatedAlleleReplacement(
registry.registerDeprecatedAlleleReplacement("magicbees.speciesBMBloodyBMBloody", BeeSpecies.EARTHY.getSpecies()); "magicbees.speciesTCAttractive", BeeSpecies.TC_EMPOWERING.getSpecies());
registry.registerDeprecatedAlleleReplacement("magicbees.speciesBMBloodyBMBound", BeeSpecies.ARCANE.getSpecies()); registry.registerDeprecatedAlleleReplacement(
} "magicbees.speciesBMBloodyBMBloody", BeeSpecies.EARTHY.getSpecies());
registry.registerDeprecatedAlleleReplacement(
"magicbees.speciesBMBloodyBMBound", BeeSpecies.ARCANE.getSpecies());
}
public static IAlleleBeeSpecies getBaseSpecies(String name) { public static IAlleleBeeSpecies getBaseSpecies(String name) {
return (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele((new StringBuilder()).append("forestry.species").append(name).toString()); return (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele(
} (new StringBuilder()).append("forestry.species").append(name).toString());
}
public static IAlleleBeeSpecies getExtraSpecies(String name) { public static IAlleleBeeSpecies getExtraSpecies(String name) {
return (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele((new StringBuilder()).append("extrabees.species.").append(name.toLowerCase()) return (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele((new StringBuilder())
.toString()); .append("extrabees.species.")
} .append(name.toLowerCase())
.toString());
}
public static IAllele getBaseAllele(String name) { public static IAllele getBaseAllele(String name) {
return AlleleManager.alleleRegistry.getAllele("forestry." + name); return AlleleManager.alleleRegistry.getAllele("forestry." + name);
} }
public static IAllele getAllele(String name) { public static IAllele getAllele(String name) {
return AlleleManager.alleleRegistry.getAllele(name); return AlleleManager.alleleRegistry.getAllele(name);
} }
private String uid; private String uid;
private boolean dominant; private boolean dominant;
public Allele(String id, boolean isDominant, IChromosomeType... chromosomeTypes) { public Allele(String id, boolean isDominant, IChromosomeType... chromosomeTypes) {
this.uid = "magicbees." + id; this.uid = "magicbees." + id;
this.dominant = isDominant; this.dominant = isDominant;
AlleleManager.alleleRegistry.registerAllele(this, chromosomeTypes); AlleleManager.alleleRegistry.registerAllele(this, chromosomeTypes);
} }
@Override @Override
public String getUID() { public String getUID() {
return this.uid; return this.uid;
} }
@Override @Override
public boolean isDominant() { public boolean isDominant() {
return this.dominant; return this.dominant;
} }
@Override @Override
public String getName() { public String getName() {
return LocalizationManager.getLocalizedString(getUID()); return LocalizationManager.getLocalizedString(getUID());
} }
@Override
public String getUnlocalizedName() {
return this.uid;
}
@Override
public String getUnlocalizedName() {
return this.uid;
}
} }
+61 -74
View File
@@ -1,95 +1,82 @@
package magicbees.bees; package magicbees.bees;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChunkCoordinates;
import forestry.api.apiculture.EnumBeeChromosome; import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.apiculture.IAlleleBeeEffect; import forestry.api.apiculture.IAlleleBeeEffect;
import forestry.api.apiculture.IBeeGenome; import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing; import forestry.api.apiculture.IBeeHousing;
import forestry.api.genetics.IEffectData; import forestry.api.genetics.IEffectData;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChunkCoordinates;
public abstract class AlleleEffect extends Allele implements IAlleleBeeEffect public abstract class AlleleEffect extends Allele implements IAlleleBeeEffect {
{ protected int throttle;
protected int throttle; protected boolean combinable;
protected boolean combinable;
public AlleleEffect(String id, boolean isDominant, int timeout) public AlleleEffect(String id, boolean isDominant, int timeout) {
{ super("effect" + id, isDominant, EnumBeeChromosome.EFFECT);
super("effect" + id, isDominant, EnumBeeChromosome.EFFECT); this.throttle = timeout;
this.throttle = timeout; combinable = false;
combinable = false; }
}
@Override @Override
public boolean isCombinable() public boolean isCombinable() {
{ return combinable;
return combinable; }
}
public AlleleEffect setIsCombinable(boolean canCombine) { public AlleleEffect setIsCombinable(boolean canCombine) {
combinable = canCombine; combinable = canCombine;
return this; return this;
} }
@Override @Override
public abstract IEffectData validateStorage(IEffectData storedData); public abstract IEffectData validateStorage(IEffectData storedData);
@Override @Override
public final IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) public final IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
{ int count = storedData.getInteger(0);
int count = storedData.getInteger(0); if (count >= this.throttle) {
if (count >= this.throttle) storedData = this.doEffectThrottled(genome, storedData, housing);
{ } else {
storedData = this.doEffectThrottled(genome, storedData, housing); storedData.setInteger(0, count + 1);
} }
else return storedData;
{ }
storedData.setInteger(0, count + 1);
}
return storedData;
}
/** /**
* @param genome * @param genome
* @param storedData * @param storedData
* @param housing * @param housing
* @return * @return
*/ */
protected abstract IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing); protected abstract IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing);
@Override @Override
public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
{ return Allele.forestryBaseEffect.doFX(genome, storedData, housing);
return Allele.forestryBaseEffect.doFX(genome, storedData, housing); }
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected <T extends Entity> List<T> getEntitiesWithinRange(IBeeGenome genome, IBeeHousing housing, Class<T> entityClass) protected <T extends Entity> List<T> getEntitiesWithinRange(
{ IBeeGenome genome, IBeeHousing housing, Class<T> entityClass) {
// Get the size of the affected area // Get the size of the affected area
int[] area = genome.getTerritory(); int[] area = genome.getTerritory();
ChunkCoordinates coords = housing.getCoordinates(); ChunkCoordinates coords = housing.getCoordinates();
// Calculate offset // Calculate offset
int[] min = new int[3]; int[] min = new int[3];
int[] max = new int[3]; int[] max = new int[3];
min[0] = coords.posX - area[0] / 2; min[0] = coords.posX - area[0] / 2;
max[0] = coords.posX + area[0] / 2; max[0] = coords.posX + area[0] / 2;
min[1] = coords.posY - area[1] / 2; min[1] = coords.posY - area[1] / 2;
max[1] = coords.posY + area[1] / 2; max[1] = coords.posY + area[1] / 2;
min[2] = coords.posZ - area[2] / 2; min[2] = coords.posZ - area[2] / 2;
max[2] = coords.posZ + area[2] / 2; max[2] = coords.posZ + area[2] / 2;
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(min[0], min[1], min[2], max[0], max[1], max[2]);
return (List<T>)housing.getWorld().getEntitiesWithinAABB(entityClass, bounds);
}
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(min[0], min[1], min[2], max[0], max[1], max[2]);
return (List<T>) housing.getWorld().getEntitiesWithinAABB(entityClass, bounds);
}
} }
+10 -14
View File
@@ -3,20 +3,16 @@ package magicbees.bees;
import forestry.api.genetics.IAlleleFloat; import forestry.api.genetics.IAlleleFloat;
import forestry.api.genetics.IChromosomeType; import forestry.api.genetics.IChromosomeType;
public class AlleleFloat extends Allele implements IAlleleFloat public class AlleleFloat extends Allele implements IAlleleFloat {
{ private float value;
private float value;
public AlleleFloat(String id, float val, boolean isDominant, IChromosomeType... chromosomeTypes) public AlleleFloat(String id, float val, boolean isDominant, IChromosomeType... chromosomeTypes) {
{ super(id, isDominant, chromosomeTypes);
super(id, isDominant, chromosomeTypes); this.value = val;
this.value = val; }
}
@Override
public float getValue()
{
return this.value;
}
@Override
public float getValue() {
return this.value;
}
} }
+14 -19
View File
@@ -1,29 +1,24 @@
package magicbees.bees; package magicbees.bees;
import forestry.api.apiculture.EnumBeeChromosome; import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAlleleFlowers; import forestry.api.genetics.IAlleleFlowers;
import forestry.api.genetics.IFlowerProvider; import forestry.api.genetics.IFlowerProvider;
public class AlleleFlower extends Allele implements IAlleleFlowers public class AlleleFlower extends Allele implements IAlleleFlowers {
{ private IFlowerProvider provider;
private IFlowerProvider provider;
public AlleleFlower(String uid, IFlowerProvider flowerProvider, boolean isDominant) public AlleleFlower(String uid, IFlowerProvider flowerProvider, boolean isDominant) {
{ super("flower" + uid, isDominant, EnumBeeChromosome.FLOWER_PROVIDER);
super("flower" + uid, isDominant, EnumBeeChromosome.FLOWER_PROVIDER); this.provider = flowerProvider;
this.provider = flowerProvider; }
}
@Override @Override
public IFlowerProvider getProvider() public IFlowerProvider getProvider() {
{ return this.provider;
return this.provider; }
}
@Override
public String getName() {
return this.provider.getDescription();
}
@Override
public String getName() {
return this.provider.getDescription();
}
} }
+24 -23
View File
@@ -3,31 +3,32 @@ package magicbees.bees;
import magicbees.api.bees.AuraChargeType; import magicbees.api.bees.AuraChargeType;
public enum AuraCharge { public enum AuraCharge {
MUTATION(AuraChargeType.MUTATION, 850, 11), MUTATION(AuraChargeType.MUTATION, 850, 11),
DEATH(AuraChargeType.DEATH, 400, 5), DEATH(AuraChargeType.DEATH, 400, 5),
PRODUCTION(AuraChargeType.PRODUCTION, 300, 3), PRODUCTION(AuraChargeType.PRODUCTION, 300, 3),
; ;
public final AuraChargeType type; public final AuraChargeType type;
public final int duration; public final int duration;
/** The number of ticks to count between draining vis from the environment **/ /** The number of ticks to count between draining vis from the environment **/
public final int tickRate; public final int tickRate;
public final int flag;
AuraCharge(AuraChargeType chargeType, int duration, int tickRate) { public final int flag;
this.type = chargeType;
this.duration = duration;
this.tickRate = tickRate;
flag = 1 << ordinal();
}
public static AuraCharge fromChargeType(AuraChargeType type) { AuraCharge(AuraChargeType chargeType, int duration, int tickRate) {
for (AuraCharge charge : values()) { this.type = chargeType;
if (type == charge.type) { this.duration = duration;
return charge; this.tickRate = tickRate;
} flag = 1 << ordinal();
} }
return null; public static AuraCharge fromChargeType(AuraChargeType type) {
} for (AuraCharge charge : values()) {
if (type == charge.type) {
return charge;
}
}
return null;
}
} }
@@ -1,128 +1,110 @@
package magicbees.bees; package magicbees.bees;
import java.util.ArrayList;
import magicbees.main.utils.LocalizationManager;
import forestry.api.genetics.AlleleManager; import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAlleleSpecies; import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IClassification; import forestry.api.genetics.IClassification;
import java.util.ArrayList;
import magicbees.main.utils.LocalizationManager;
public enum BeeClassification implements IClassification public enum BeeClassification implements IClassification {
{ VEILED("Veiled", "Velatapis"),
VEILED("Veiled", "Velatapis"), ARCANE("Arcane", "Arcanapis"),
ARCANE("Arcane", "Arcanapis"), SUPERNATURAL("Supernatural", "Occultapis"),
SUPERNATURAL("Supernatural", "Occultapis"), SCHOLARLY("Scholarly", "Doctapis"),
SCHOLARLY("Scholarly", "Doctapis"), SKULKING("Skulking", "Malevolenapis"),
SKULKING("Skulking", "Malevolenapis"), MAGICAL("Magic", "Magicapis"),
MAGICAL("Magic", "Magicapis"), TIME("Time", "Tempestivapis"),
TIME("Time", "Tempestivapis"), SOUL("Soul", "Animapis"),
SOUL("Soul", "Animapis"),
ABOMINABLE("Abominable", "Detestabilapis"), ABOMINABLE("Abominable", "Detestabilapis"),
EXTRINSIC("Extrinsic", "Extrarapis"), EXTRINSIC("Extrinsic", "Extrarapis"),
METALLIC("Metallic", "Metalliapis"), METALLIC("Metallic", "Metalliapis"),
GEM("Gem", "Lapidapis"), GEM("Gem", "Lapidapis"),
TRANSMUTING("Transmuting", "Transmutapis"), TRANSMUTING("Transmuting", "Transmutapis"),
THAUMIC("Thaumic", "Thaumiapis"), THAUMIC("Thaumic", "Thaumiapis"),
FLESHY("Fleshy", "Carnosapis"), FLESHY("Fleshy", "Carnosapis"),
ALCHEMICAL("Alchemical", "Alchimiapis"), ALCHEMICAL("Alchemical", "Alchimiapis"),
ESSENTIAL("Essential", "Essentiapis"), ESSENTIAL("Essential", "Essentiapis"),
THERMAL("Thermal", "Thermametallic"), THERMAL("Thermal", "Thermametallic"),
ADORABLE("Adorable", "Amabilis"), ADORABLE("Adorable", "Amabilis"),
BLOODY("Bloody", "Sanguis"), BLOODY("Bloody", "Sanguis"),
BOTANICAL("Botanical", "Botanica"), BOTANICAL("Botanical", "Botanica"),
; ;
private String uID; private String uID;
private String latin; private String latin;
private ArrayList<IAlleleSpecies> species; private ArrayList<IAlleleSpecies> species;
private IClassification parent; private IClassification parent;
private EnumClassLevel level; private EnumClassLevel level;
private BeeClassification(String name, String scientific) private BeeClassification(String name, String scientific) {
{ this.uID = "classification." + name.toLowerCase();
this.uID = "classification." + name.toLowerCase(); this.latin = scientific;
this.latin = scientific; this.level = EnumClassLevel.GENUS;
this.level = EnumClassLevel.GENUS; this.species = new ArrayList<IAlleleSpecies>();
this.species = new ArrayList<IAlleleSpecies>(); this.parent = AlleleManager.alleleRegistry.getClassification("family.apidae");
this.parent = AlleleManager.alleleRegistry.getClassification("family.apidae"); AlleleManager.alleleRegistry.registerClassification(this);
AlleleManager.alleleRegistry.registerClassification(this); }
}
@Override @Override
public EnumClassLevel getLevel() public EnumClassLevel getLevel() {
{ return this.level;
return this.level; }
}
@Override @Override
public String getUID() public String getUID() {
{ return this.uID;
return this.uID; }
}
@Override @Override
public String getName() public String getName() {
{ return LocalizationManager.getLocalizedString(getUID());
return LocalizationManager.getLocalizedString(getUID()); }
}
@Override @Override
public String getScientific() public String getScientific() {
{ return this.latin;
return this.latin; }
}
@Override @Override
public String getDescription() public String getDescription() {
{ return LocalizationManager.getLocalizedString(getUID() + ".description");
return LocalizationManager.getLocalizedString(getUID() + ".description"); }
}
@Override @Override
public IClassification[] getMemberGroups() public IClassification[] getMemberGroups() {
{ return null;
return null; }
}
@Override @Override
public void addMemberGroup(IClassification group) public void addMemberGroup(IClassification group) {}
{
} @Override
public IAlleleSpecies[] getMemberSpecies() {
return this.species.toArray(new IAlleleSpecies[this.species.size()]);
}
@Override @Override
public IAlleleSpecies[] getMemberSpecies() public void addMemberSpecies(IAlleleSpecies species) {
{ if (!this.species.contains(species)) {
return this.species.toArray(new IAlleleSpecies[this.species.size()]); this.species.add(species);
} }
}
@Override @Override
public void addMemberSpecies(IAlleleSpecies species) public IClassification getParent() {
{ return this.parent;
if (!this.species.contains(species)) }
{
this.species.add(species);
}
}
@Override
public IClassification getParent()
{
return this.parent;
}
@Override
public void setParent(IClassification parent)
{
this.parent = parent;
}
@Override
public void setParent(IClassification parent) {
this.parent = parent;
}
} }
File diff suppressed because it is too large. Load diff
@@ -1,23 +1,22 @@
package magicbees.bees; package magicbees.bees;
import forestry.api.apiculture.IBeeIconColourProvider;
import java.awt.Color; import java.awt.Color;
import forestry.api.apiculture.IBeeIconColourProvider;
public enum BeeIconColourProvider implements IBeeIconColourProvider { public enum BeeIconColourProvider implements IBeeIconColourProvider {
RAINBOW { RAINBOW {
@Override @Override
public int getIconColour(int renderPass) { public int getIconColour(int renderPass) {
if (renderPass == 0) { if (renderPass == 0) {
int hue = (int) (System.currentTimeMillis() >> 2) % 360; int hue = (int) (System.currentTimeMillis() >> 2) % 360;
return Color.getHSBColor(hue / 360f, 0.75f, 0.80f).getRGB(); return Color.getHSBColor(hue / 360f, 0.75f, 0.80f).getRGB();
} else if (renderPass == 1) { } else if (renderPass == 1) {
int hue = (int) (System.currentTimeMillis() >> 3) % 360; int hue = (int) (System.currentTimeMillis() >> 3) % 360;
hue += 60; hue += 60;
hue = hue % 360; hue = hue % 360;
return Color.getHSBColor(hue / 360f, 0.5f, 0.6f).getRGB(); return Color.getHSBColor(hue / 360f, 0.5f, 0.6f).getRGB();
} }
return 0xffffff; return 0xffffff;
} }
} }
} }
@@ -1,51 +1,47 @@
package magicbees.bees; package magicbees.bees;
import java.util.Locale;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.apiculture.EnumBeeType; import forestry.api.apiculture.EnumBeeType;
import forestry.api.apiculture.IBeeIconProvider; import forestry.api.apiculture.IBeeIconProvider;
import java.util.Locale;
import magicbees.main.CommonProxy; import magicbees.main.CommonProxy;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
public enum BeeIconProvider implements IBeeIconProvider { public enum BeeIconProvider implements IBeeIconProvider {
SKULKING(CommonProxy.DOMAIN + ":bees/skulking/"), SKULKING(CommonProxy.DOMAIN + ":bees/skulking/"),
DOCTORAL(CommonProxy.DOMAIN + ":bees/doctoral/"); DOCTORAL(CommonProxy.DOMAIN + ":bees/doctoral/");
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon[][] icons; private IIcon[][] icons;
private final String iconPath;
BeeIconProvider(String iconPath) { private final String iconPath;
this.iconPath = iconPath;
}
@Override BeeIconProvider(String iconPath) {
public void registerIcons(IIconRegister itemMap) { this.iconPath = iconPath;
this.icons = new IIcon[EnumBeeType.VALUES.length][3]; }
IIcon body1 = itemMap.registerIcon(iconPath + "body1"); @Override
public void registerIcons(IIconRegister itemMap) {
this.icons = new IIcon[EnumBeeType.VALUES.length][3];
for (int i = 0; i < EnumBeeType.VALUES.length; i++) { IIcon body1 = itemMap.registerIcon(iconPath + "body1");
EnumBeeType beeType = EnumBeeType.VALUES[i];
if (beeType == EnumBeeType.NONE)
continue;
String beeTypeIconPath = iconPath + beeType.toString().toLowerCase(Locale.ENGLISH); for (int i = 0; i < EnumBeeType.VALUES.length; i++) {
EnumBeeType beeType = EnumBeeType.VALUES[i];
if (beeType == EnumBeeType.NONE) continue;
icons[i][0] = itemMap.registerIcon(beeTypeIconPath + ".outline"); String beeTypeIconPath = iconPath + beeType.toString().toLowerCase(Locale.ENGLISH);
icons[i][1] = (beeType != EnumBeeType.LARVAE) ? body1 : itemMap.registerIcon(beeTypeIconPath + ".body");
icons[i][2] = itemMap.registerIcon(beeTypeIconPath + ".body2");
}
}
@Override icons[i][0] = itemMap.registerIcon(beeTypeIconPath + ".outline");
public IIcon getIcon(EnumBeeType type, int renderPass) { icons[i][1] = (beeType != EnumBeeType.LARVAE) ? body1 : itemMap.registerIcon(beeTypeIconPath + ".body");
return icons[type.ordinal()][Math.min(renderPass, 2)]; icons[i][2] = itemMap.registerIcon(beeTypeIconPath + ".body2");
} }
}
@Override
public IIcon getIcon(EnumBeeType type, int renderPass) {
return icons[type.ordinal()][Math.min(renderPass, 2)];
}
} }
+81 -83
View File
@@ -1,16 +1,5 @@
package magicbees.bees; package magicbees.bees;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import magicbees.block.types.HiveType;
import magicbees.item.types.DropType;
import magicbees.main.Config;
import magicbees.main.utils.Tuple;
import magicbees.main.utils.compat.ExtraBeesHelper;
import net.minecraft.item.ItemStack;
import forestry.api.apiculture.EnumBeeType; import forestry.api.apiculture.EnumBeeType;
import forestry.api.apiculture.IAlleleBeeSpecies; import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.api.apiculture.IBee; import forestry.api.apiculture.IBee;
@@ -18,95 +7,104 @@ import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeRoot; import forestry.api.apiculture.IBeeRoot;
import forestry.api.genetics.AlleleManager; import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele; import forestry.api.genetics.IAllele;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import magicbees.block.types.HiveType;
import magicbees.item.types.DropType;
import magicbees.main.Config;
import magicbees.main.utils.Tuple;
import magicbees.main.utils.compat.ExtraBeesHelper;
import net.minecraft.item.ItemStack;
public class BeeManager public class BeeManager {
{ public static IBeeRoot beeRoot;
public static IBeeRoot beeRoot;
private static List<Tuple<IAlleleBeeSpecies, Double>> worldgenSpeciesWeights = new ArrayList<Tuple<IAlleleBeeSpecies, Double>>(); private static List<Tuple<IAlleleBeeSpecies, Double>> worldgenSpeciesWeights =
private static double worldgenSpeciesWeightsTotal = 0; new ArrayList<Tuple<IAlleleBeeSpecies, Double>>();
private static double worldgenSpeciesWeightsTotal = 0;
public static void getBeeRoot() { public static void getBeeRoot() {
beeRoot = (IBeeRoot)AlleleManager.alleleRegistry.getSpeciesRoot("rootBees"); beeRoot = (IBeeRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootBees");
} }
public static void setupAlleles() { public static void setupAlleles() {
Allele.setupAdditionalAlleles(); Allele.setupAdditionalAlleles();
BeeSpecies.setupBeeSpecies(); BeeSpecies.setupBeeSpecies();
Allele.registerDeprecatedAlleleReplacements(); Allele.registerDeprecatedAlleleReplacements();
} }
public static void lateBeeInit() public static void lateBeeInit() {
{ BeeMutation.setupMutations();
BeeMutation.setupMutations(); BeeProductHelper.initBaseProducts();
BeeProductHelper.initBaseProducts(); BeeProductHelper.initOreDictSProducts();
BeeProductHelper.initOreDictSProducts();
HiveType.initHiveData(); HiveType.initHiveData();
beeRoot.setResearchSuitability(Config.drops.getStackForType(DropType.INTELLECT), 0.5f); beeRoot.setResearchSuitability(Config.drops.getStackForType(DropType.INTELLECT), 0.5f);
} }
public static ItemStack getDefaultItemStackForSpecies(IAlleleBeeSpecies beeSpecies, EnumBeeType type) { public static ItemStack getDefaultItemStackForSpecies(IAlleleBeeSpecies beeSpecies, EnumBeeType type) {
IBee bee = getBeeFromSpecies(beeSpecies, false); IBee bee = getBeeFromSpecies(beeSpecies, false);
return BeeManager.beeRoot.getMemberStack(bee, type.ordinal()); return BeeManager.beeRoot.getMemberStack(bee, type.ordinal());
} }
public static IBee getBeeFromSpecies(IAlleleBeeSpecies beeSpecies, boolean applyRainResist) { public static IBee getBeeFromSpecies(IAlleleBeeSpecies beeSpecies, boolean applyRainResist) {
IAllele[] speciesTemplate = BeeManager.beeRoot.getTemplate(beeSpecies.getUID()); IAllele[] speciesTemplate = BeeManager.beeRoot.getTemplate(beeSpecies.getUID());
if (applyRainResist) { if (applyRainResist) {
speciesTemplate = BeeGenomeManager.addRainResist(speciesTemplate); speciesTemplate = BeeGenomeManager.addRainResist(speciesTemplate);
} }
IBeeGenome genome = BeeManager.beeRoot.templateAsGenome(speciesTemplate); IBeeGenome genome = BeeManager.beeRoot.templateAsGenome(speciesTemplate);
return BeeManager.beeRoot.getBee(null, genome); return BeeManager.beeRoot.getBee(null, genome);
} }
public static IAlleleBeeSpecies getRandomWorldgenSpecies(Random r) { public static IAlleleBeeSpecies getRandomWorldgenSpecies(Random r) {
Collections.shuffle(worldgenSpeciesWeights); Collections.shuffle(worldgenSpeciesWeights);
double value = r.nextDouble() * worldgenSpeciesWeightsTotal; double value = r.nextDouble() * worldgenSpeciesWeightsTotal;
IAlleleBeeSpecies species = Allele.getBaseSpecies("Forest"); IAlleleBeeSpecies species = Allele.getBaseSpecies("Forest");
for (Tuple<IAlleleBeeSpecies, Double> t : worldgenSpeciesWeights) { for (Tuple<IAlleleBeeSpecies, Double> t : worldgenSpeciesWeights) {
value -= t.right.doubleValue(); value -= t.right.doubleValue();
if (value <= 0.0) { if (value <= 0.0) {
species = t.left; species = t.left;
break; break;
} }
} }
return species; return species;
} }
public static void addWorldgenSpeciesWeight(IAlleleBeeSpecies species, double d) { public static void addWorldgenSpeciesWeight(IAlleleBeeSpecies species, double d) {
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(species, d)); worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(species, d));
worldgenSpeciesWeightsTotal += d; worldgenSpeciesWeightsTotal += d;
} }
public static void populateSpeciesListRarity() { public static void populateSpeciesListRarity() {
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Forest"), 20.0)); worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Forest"), 20.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Meadows"), 20.0)); worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Meadows"), 20.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Tropical"), 10.0)); worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Tropical"), 10.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Modest"), 16.0)); worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Modest"), 16.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Wintry"), 10.0)); worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Wintry"), 10.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Ended"), 0.5)); worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Ended"), 0.5));
if (ExtraBeesHelper.isActive()) { if (ExtraBeesHelper.isActive()) {
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getExtraSpecies("Water"), 12.0)); worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getExtraSpecies("Water"), 12.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getExtraSpecies("Rock"), 16.0)); worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getExtraSpecies("Rock"), 16.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getExtraSpecies("Basalt"), 10.0)); worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getExtraSpecies("Basalt"), 10.0));
} }
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.MYSTICAL.getSpecies(), 20.0)); worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.MYSTICAL.getSpecies(), 20.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.UNUSUAL.getSpecies(), 20.0)); worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.UNUSUAL.getSpecies(), 20.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.SORCEROUS.getSpecies(), 13.0)); worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.SORCEROUS.getSpecies(), 13.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.ATTUNED.getSpecies(), 6.0)); worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.ATTUNED.getSpecies(), 6.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.INFERNAL.getSpecies(), 10.0)); worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.INFERNAL.getSpecies(), 10.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.OBLIVION.getSpecies(), 1.0)); worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.OBLIVION.getSpecies(), 1.0));
for (Tuple<IAlleleBeeSpecies, Double> t : worldgenSpeciesWeights) { for (Tuple<IAlleleBeeSpecies, Double> t : worldgenSpeciesWeights) {
worldgenSpeciesWeightsTotal += t.right.doubleValue(); worldgenSpeciesWeightsTotal += t.right.doubleValue();
} }
} }
} }
File diff suppressed because it is too large. Load diff
+408 -364
View File
@@ -1,5 +1,7 @@
package magicbees.bees; package magicbees.bees;
import static magicbees.bees.BeeSpecies.*;
import magicbees.item.types.CombType; import magicbees.item.types.CombType;
import magicbees.item.types.DropType; import magicbees.item.types.DropType;
import magicbees.item.types.NuggetType; import magicbees.item.types.NuggetType;
@@ -11,426 +13,468 @@ import magicbees.main.utils.LogHelper;
import magicbees.main.utils.compat.AppliedEnergisticsHelper; import magicbees.main.utils.compat.AppliedEnergisticsHelper;
import magicbees.main.utils.compat.ArsMagicaHelper; import magicbees.main.utils.compat.ArsMagicaHelper;
import magicbees.main.utils.compat.BotaniaHelper; import magicbees.main.utils.compat.BotaniaHelper;
import magicbees.main.utils.compat.BotaniaHelper.PastureSeed;
import magicbees.main.utils.compat.EquivalentExchangeHelper; import magicbees.main.utils.compat.EquivalentExchangeHelper;
import magicbees.main.utils.compat.ForestryHelper; import magicbees.main.utils.compat.ForestryHelper;
import magicbees.main.utils.compat.RedstoneArsenalHelper; import magicbees.main.utils.compat.RedstoneArsenalHelper;
import magicbees.main.utils.compat.ThaumcraftHelper; import magicbees.main.utils.compat.ThaumcraftHelper;
import magicbees.main.utils.compat.ThermalModsHelper; import magicbees.main.utils.compat.ThermalModsHelper;
import magicbees.main.utils.compat.BotaniaHelper.PastureSeed;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import static magicbees.bees.BeeSpecies.*;
public class BeeProductHelper { public class BeeProductHelper {
public static void initBaseProducts() { public static void initBaseProducts() {
MYSTICAL.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.15f); MYSTICAL.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.15f);
SORCEROUS.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.15f); SORCEROUS.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.15f);
UNUSUAL.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.15f); UNUSUAL.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.15f);
ATTUNED.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.15f); ATTUNED.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.15f);
ELDRITCH.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.15f); ELDRITCH.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.15f);
ESOTERIC.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.18f); ESOTERIC.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.18f);
MYSTERIOUS.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.20f); MYSTERIOUS.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.20f);
ARCANE.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.25f) ARCANE.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.25f)
.addSpecialty(Config.drops.getStackForType(DropType.ENCHANTED, 1), 0.9f); .addSpecialty(Config.drops.getStackForType(DropType.ENCHANTED, 1), 0.09f);
CHARMED.addProduct(Config.combs.getStackForType(CombType.OTHERWORLDLY), 0.18f); CHARMED.addProduct(Config.combs.getStackForType(CombType.OTHERWORLDLY), 0.18f);
ENCHANTED.addProduct(Config.combs.getStackForType(CombType.OTHERWORLDLY), 0.20f); ENCHANTED.addProduct(Config.combs.getStackForType(CombType.OTHERWORLDLY), 0.20f);
SUPERNATURAL.addProduct(Config.combs.getStackForType(CombType.OTHERWORLDLY), 0.25f) SUPERNATURAL
.addSpecialty(Config.pollen.getStackForType(PollenType.UNUSUAL), 0.8f); .addProduct(Config.combs.getStackForType(CombType.OTHERWORLDLY), 0.25f)
.addSpecialty(Config.pollen.getStackForType(PollenType.UNUSUAL), 0.08f);
ETHEREAL.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.10f) ETHEREAL.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.OTHERWORLDLY), 0.10f); .addProduct(Config.combs.getStackForType(CombType.OTHERWORLDLY), 0.10f);
WINDY.addProduct(Config.combs.getStackForType(CombType.AIRY), 0.25f); WINDY.addProduct(Config.combs.getStackForType(CombType.AIRY), 0.25f);
FIREY.addProduct(Config.combs.getStackForType(CombType.FIREY), 0.25f); FIREY.addProduct(Config.combs.getStackForType(CombType.FIREY), 0.25f);
EARTHY.addProduct(Config.combs.getStackForType(CombType.EARTHY), 0.25f); EARTHY.addProduct(Config.combs.getStackForType(CombType.EARTHY), 0.25f);
WATERY.addProduct(Config.combs.getStackForType(CombType.WATERY), 0.25f) WATERY.addProduct(Config.combs.getStackForType(CombType.WATERY), 0.25f)
.addSpecialty(new ItemStack(Blocks.ice), 0.025f); .addSpecialty(new ItemStack(Blocks.ice), 0.025f);
PUPIL.addProduct(Config.combs.getStackForType(CombType.PAPERY), 0.20f); PUPIL.addProduct(Config.combs.getStackForType(CombType.PAPERY), 0.20f);
SCHOLARLY.addProduct(Config.combs.getStackForType(CombType.PAPERY), 0.25f); SCHOLARLY.addProduct(Config.combs.getStackForType(CombType.PAPERY), 0.25f);
SAVANT.addProduct(Config.combs.getStackForType(CombType.PAPERY), 0.40f); SAVANT.addProduct(Config.combs.getStackForType(CombType.PAPERY), 0.40f);
AWARE.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.18f); AWARE.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.18f);
SPIRIT.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.22f) SPIRIT.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.22f)
.addSpecialty(Config.combs.getStackForType(CombType.SOUL), 0.16f); .addSpecialty(Config.combs.getStackForType(CombType.SOUL), 0.16f);
SOUL.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.28f) SOUL.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.28f)
.addSpecialty(Config.combs.getStackForType(CombType.SOUL), 0.20f); .addSpecialty(Config.combs.getStackForType(CombType.SOUL), 0.20f);
SKULKING.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f); SKULKING.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f);
GHASTLY.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.8f) GHASTLY.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.08f)
.addSpecialty(new ItemStack(Items.ghast_tear), 0.099f); .addSpecialty(new ItemStack(Items.ghast_tear), 0.099f);
SPIDERY.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.13f) SPIDERY.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.13f)
.addProduct(new ItemStack(Items.string), 0.08f) .addProduct(new ItemStack(Items.string), 0.08f)
.addSpecialty(new ItemStack(Items.spider_eye), 0.08f); .addSpecialty(new ItemStack(Items.spider_eye), 0.08f);
SMOULDERING.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f) SMOULDERING
.addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.10f) .addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f)
.addSpecialty(new ItemStack(Items.blaze_rod), 0.05f); .addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.10f)
BRAINY.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f) .addSpecialty(new ItemStack(Items.blaze_rod), 0.05f);
.addProduct(new ItemStack(Items.rotten_flesh), 0.6f); BRAINY.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f)
BIGBAD.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.18f) .addProduct(new ItemStack(Items.rotten_flesh), 0.06f);
.addProduct(new ItemStack(Items.beef), 0.12f) BIGBAD.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.18f)
.addProduct(new ItemStack(Items.chicken), 0.12f) .addProduct(new ItemStack(Items.beef), 0.12f)
.addSpecialty(new ItemStack(Items.melon), 0.20f); .addProduct(new ItemStack(Items.chicken), 0.12f)
BATTY.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f) .addSpecialty(new ItemStack(Items.melon), 0.20f);
.addSpecialty(new ItemStack(Items.string), 0.00001f); BATTY.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f)
CHICKEN.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.23f) .addSpecialty(new ItemStack(Items.string), 0.20f);
.addSpecialty(new ItemStack(Items.feather), 0.08f) CHICKEN.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.23f)
.addSpecialty(new ItemStack(Items.egg), 0.08f); .addSpecialty(new ItemStack(Items.feather), 0.08f)
BEEF.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.25f) .addSpecialty(new ItemStack(Items.egg), 0.08f);
.addSpecialty(new ItemStack(Items.leather), 0.165f); BEEF.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.25f)
PORK.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f) .addSpecialty(new ItemStack(Items.leather), 0.165f);
.addSpecialty(new ItemStack(Items.carrot), 0.165f); PORK.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f)
SHEEPISH.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.25f) .addSpecialty(new ItemStack(Items.carrot), 0.165f);
.addSpecialty(new ItemStack(Blocks.wool), 0.16f) SHEEPISH.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.25f)
.addSpecialty(new ItemStack(Items.wheat), 0.24f); .addSpecialty(new ItemStack(Blocks.wool), 0.16f)
HORSE.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.25f) .addSpecialty(new ItemStack(Items.wheat), 0.24f);
.addSpecialty(new ItemStack(Items.leather), 0.24f) HORSE.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.25f)
.addSpecialty(new ItemStack(Items.apple), 0.38f); .addSpecialty(new ItemStack(Items.leather), 0.24f)
CATTY.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.25f) .addSpecialty(new ItemStack(Items.apple), 0.38f);
.addSpecialty(new ItemStack(Items.fish), 0.24f); CATTY.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.25f)
.addSpecialty(new ItemStack(Items.fish), 0.24f);
TIMELY.addProduct(Config.combs.getStackForType(CombType.TEMPORAL), 0.16f); TIMELY.addProduct(Config.combs.getStackForType(CombType.TEMPORAL), 0.16f);
LORDLY.addProduct(Config.combs.getStackForType(CombType.TEMPORAL), 0.19f); LORDLY.addProduct(Config.combs.getStackForType(CombType.TEMPORAL), 0.19f);
DOCTORAL.addProduct(Config.combs.getStackForType(CombType.TEMPORAL), 0.24f) DOCTORAL.addProduct(Config.combs.getStackForType(CombType.TEMPORAL), 0.24f)
.addSpecialty(new ItemStack(Config.jellyBaby), 0.078f); .addSpecialty(new ItemStack(Config.jellyBaby), 0.078f);
INFERNAL.addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.12f); INFERNAL.addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.12f);
HATEFUL.addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.18f); HATEFUL.addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.18f);
SPITEFUL.addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.24f); SPITEFUL.addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.24f);
WITHERING.addSpecialty(Config.miscResources.getStackForType(ResourceType.SKULL_CHIP), 0.15f); WITHERING.addSpecialty(Config.miscResources.getStackForType(ResourceType.SKULL_CHIP), 0.15f);
OBLIVION.addProduct(Config.combs.getStackForType(CombType.FORGOTTEN), 0.14f); OBLIVION.addProduct(Config.combs.getStackForType(CombType.FORGOTTEN), 0.14f);
NAMELESS.addProduct(Config.combs.getStackForType(CombType.FORGOTTEN), 0.19f); NAMELESS.addProduct(Config.combs.getStackForType(CombType.FORGOTTEN), 0.19f);
ABANDONED.addProduct(Config.combs.getStackForType(CombType.FORGOTTEN), 0.24f); ABANDONED.addProduct(Config.combs.getStackForType(CombType.FORGOTTEN), 0.24f);
FORLORN.addProduct(Config.combs.getStackForType(CombType.FORGOTTEN), 0.30f); FORLORN.addProduct(Config.combs.getStackForType(CombType.FORGOTTEN), 0.30f);
DRACONIC.addSpecialty(Config.miscResources.getStackForType(ResourceType.DRAGON_DUST), 0.15f); DRACONIC.addSpecialty(Config.miscResources.getStackForType(ResourceType.DRAGON_DUST), 0.15f);
IRON.addProduct(ForestryHelper.itemHoneycomb, 0.10f) IRON.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
.addSpecialty(Config.nuggets.getStackForType(NuggetType.IRON), 0.18f); .addSpecialty(Config.nuggets.getStackForType(NuggetType.IRON), 0.18f);
GOLD.addProduct(ForestryHelper.itemHoneycomb, 0.10f) GOLD.addProduct(ForestryHelper.itemHoneycomb, 0.10f).addSpecialty(new ItemStack(Items.gold_nugget, 1), 0.16f);
.addSpecialty(new ItemStack(Items.gold_nugget, 1), 0.16f); DIAMOND.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
DIAMOND.addProduct(ForestryHelper.itemHoneycomb, 0.10f) .addSpecialty(Config.nuggets.getStackForType(NuggetType.DIAMOND), 0.06f);
.addSpecialty(Config.nuggets.getStackForType(NuggetType.DIAMOND), 0.6f); EMERALD.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
EMERALD.addProduct(ForestryHelper.itemHoneycomb, 0.10f) .addSpecialty(Config.nuggets.getStackForType(NuggetType.EMERALD), 0.04f);
.addSpecialty(Config.nuggets.getStackForType(NuggetType.EMERALD), 0.4f); COPPER.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
COPPER.addProduct(ForestryHelper.itemHoneycomb, 0.10f) .addSpecialty(Config.nuggets.getStackForType(NuggetType.COPPER), 0.20f);
.addSpecialty(Config.nuggets.getStackForType(NuggetType.COPPER), 0.20f); TIN.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
TIN.addProduct(ForestryHelper.itemHoneycomb, 0.10f) .addSpecialty(Config.nuggets.getStackForType(NuggetType.TIN), 0.20f);
.addSpecialty(Config.nuggets.getStackForType(NuggetType.TIN), 0.20f); APATITE.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
APATITE.addProduct(ForestryHelper.itemHoneycomb, 0.10f) .addSpecialty(Config.nuggets.getStackForType(NuggetType.APATITE), 0.10f);
.addSpecialty(Config.nuggets.getStackForType(NuggetType.APATITE), 0.10f);
MUTABLE.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.PARCHED.ordinal()), 0.30f) MUTABLE.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.PARCHED.ordinal()), 0.30f)
.addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.10f); .addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.10f);
TRANSMUTING.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.PARCHED.ordinal()), 0.10f) TRANSMUTING
.addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.30f) .addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.PARCHED.ordinal()), 0.10f)
.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.SILKY.ordinal()), 0.5f) .addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.30f)
.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.SIMMERING.ordinal()), 0.5f); .addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.SILKY.ordinal()), 0.05f)
CRUMBLING.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.PARCHED.ordinal()), 0.10f) .addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.SIMMERING.ordinal()), 0.05f);
.addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.30f) CRUMBLING
.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.POWDERY.ordinal()), 0.10f) .addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.PARCHED.ordinal()), 0.10f)
.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.COCOA.ordinal()), 0.15f); .addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.30f)
.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.POWDERY.ordinal()), 0.10f)
.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.COCOA.ordinal()), 0.15f);
INVISIBLE.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.35f); INVISIBLE.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.35f);
}
} public static void initOreDictSProducts() {
SILVER.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("ingotSilver").size() > 0) {
SILVER.addSpecialty(Config.nuggets.getStackForType(NuggetType.SILVER), 0.16f);
} else {
SILVER.setInactive();
}
public static void initOreDictSProducts() { LEAD.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
SILVER.addProduct(ForestryHelper.itemHoneycomb, 0.10f); if (OreDictionary.getOres("ingotLead").size() > 0) {
if (OreDictionary.getOres("ingotSilver").size() > 0) { LEAD.addSpecialty(Config.nuggets.getStackForType(NuggetType.LEAD), 0.17f);
SILVER.addSpecialty(Config.nuggets.getStackForType(NuggetType.SILVER), 0.16f); } else {
} LEAD.setInactive();
else { }
SILVER.setInactive();
}
LEAD.addProduct(ForestryHelper.itemHoneycomb, 0.10f); ALUMINUM.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("ingotLead").size() > 0) { if (OreDictionary.getOres("nuggetAluminum").size() > 0) {
LEAD.addSpecialty(Config.nuggets.getStackForType(NuggetType.LEAD), 0.17f); ALUMINUM.addSpecialty(OreDictionary.getOres("nuggetAluminum").get(0), 0.20f);
} } else {
else { ALUMINUM.setInactive();
LEAD.setInactive(); }
}
ALUMINUM.addProduct(ForestryHelper.itemHoneycomb, 0.10f); TE_PLATINUM.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetAluminum").size() > 0) { if (OreDictionary.getOres("nuggetPlatinum").size() > 0
ALUMINUM.addSpecialty(OreDictionary.getOres("nuggetAluminum").get(0), 0.20f); && OreDictionary.getOres("ingotPlatinum").size() > 0) {
} else { TE_PLATINUM.addSpecialty(OreDictionary.getOres("nuggetPlatinum").get(0), 0.18f);
ALUMINUM.setInactive(); } else {
} TE_PLATINUM.setInactive();
}
TE_PLATINUM.addProduct(ForestryHelper.itemHoneycomb, 0.10f); TE_NICKEL.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetPlatinum").size() > 0&& OreDictionary.getOres("ingotPlatinum").size() > 0) { if (OreDictionary.getOres("nuggetNickel").size() > 0
TE_PLATINUM.addSpecialty(OreDictionary.getOres("nuggetPlatinum").get(0), 0.18f); && OreDictionary.getOres("ingotNickel").size() > 0) {
} else { TE_NICKEL.addSpecialty(OreDictionary.getOres("nuggetNickel").get(0), 0.18f);
TE_PLATINUM.setInactive(); } else {
} TE_NICKEL.setInactive();
}
TE_NICKEL.addProduct(ForestryHelper.itemHoneycomb, 0.10f); ARDITE.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetNickel").size() > 0 && OreDictionary.getOres("ingotNickel").size() > 0) { if (OreDictionary.getOres("nuggetArdite").size() > 0) {
TE_NICKEL.addSpecialty(OreDictionary.getOres("nuggetNickel").get(0), 0.18f); ARDITE.addSpecialty(OreDictionary.getOres("nuggetArdite").get(0), 0.18f);
} else { } else {
TE_NICKEL.setInactive(); ARDITE.setInactive();
} }
ARDITE.addProduct(ForestryHelper.itemHoneycomb, 0.10f); COBALT.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetArdite").size() > 0) { if (OreDictionary.getOres("nuggetCobalt").size() > 0) {
ARDITE.addSpecialty(OreDictionary.getOres("nuggetArdite").get(0), 0.18f); COBALT.addSpecialty(OreDictionary.getOres("nuggetCobalt").get(0), 0.18f);
} else { }
ARDITE.setInactive(); if (OreDictionary.getOres("nuggetNaturalCobalt").size() > 0) {
} COBALT.addSpecialty(OreDictionary.getOres("nuggetNaturalCobalt").get(0), 0.24f);
}
if (COBALT.getSpecies().getSpecialtyChances().size() <= 0) {
COBALT.setInactive();
}
COBALT.addProduct(ForestryHelper.itemHoneycomb, 0.10f); TE_BRONZE.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetCobalt").size() > 0) { if (OreDictionary.getOres("nuggetBronze").size() > 0
COBALT.addSpecialty(OreDictionary.getOres("nuggetCobalt").get(0), 0.18f); && OreDictionary.getOres("ingotBronze").size() > 0) {
} TE_BRONZE.addSpecialty(OreDictionary.getOres("nuggetBronze").get(0), 0.18f);
if (OreDictionary.getOres("nuggetNaturalCobalt").size() > 0) { } else {
COBALT.addSpecialty(OreDictionary.getOres("nuggetNaturalCobalt").get(0), 0.24f); TE_BRONZE.setInactive();
} }
if (COBALT.getSpecies().getSpecialtyChances().size() <= 0) {
COBALT.setInactive();
}
TE_BRONZE.addProduct(ForestryHelper.itemHoneycomb, 0.10f); TE_INVAR.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetBronze").size() > 0 && OreDictionary.getOres("ingotBronze").size() > 0) { if (OreDictionary.getOres("nuggetInvar").size() > 0
TE_BRONZE.addSpecialty(OreDictionary.getOres("nuggetBronze").get(0), 0.18f); && OreDictionary.getOres("ingotInvar").size() > 0) {
} else { TE_INVAR.addSpecialty(OreDictionary.getOres("nuggetInvar").get(0), 0.18f);
TE_BRONZE.setInactive(); } else {
} TE_INVAR.setInactive();
}
TE_INVAR.addProduct(ForestryHelper.itemHoneycomb, 0.10f); TE_ELECTRUM.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetInvar").size() > 0 && OreDictionary.getOres("ingotInvar").size() > 0) { if (OreDictionary.getOres("nuggetElectrum").size() > 0
TE_INVAR.addSpecialty(OreDictionary.getOres("nuggetInvar").get(0), 0.18f); && OreDictionary.getOres("ingotElectrum").size() > 0) {
} else { TE_ELECTRUM.addSpecialty(OreDictionary.getOres("nuggetElectrum").get(0), 0.18f);
TE_INVAR.setInactive(); } else {
} TE_ELECTRUM.setInactive();
}
TE_ELECTRUM.addProduct(ForestryHelper.itemHoneycomb, 0.10f); MANYULLYN.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetElectrum").size() > 0 && OreDictionary.getOres("ingotElectrum").size() > 0) { if (OreDictionary.getOres("nuggetManyullyn").size() > 0) {
TE_ELECTRUM.addSpecialty(OreDictionary.getOres("nuggetElectrum").get(0), 0.18f); MANYULLYN.addSpecialty(OreDictionary.getOres("nuggetManyullyn").get(0), 0.16f);
} else { } else {
TE_ELECTRUM.setInactive(); MANYULLYN.setInactive();
} }
MANYULLYN.addProduct(ForestryHelper.itemHoneycomb, 0.10f); OSMIUM.addProduct(ForestryHelper.itemHoneycomb, 0.15f);
if (OreDictionary.getOres("nuggetManyullyn").size() > 0) { if (OreDictionary.getOres("nuggetOsmium").size() > 0) {
MANYULLYN.addSpecialty(OreDictionary.getOres("nuggetManyullyn").get(0), 0.16f); OSMIUM.addSpecialty(OreDictionary.getOres("nuggetOsmium").get(0), 0.16f);
} else { } else {
MANYULLYN.setInactive(); OSMIUM.setInactive();
} }
OSMIUM.addProduct(ForestryHelper.itemHoneycomb, 0.15f); CERTUS.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetOsmium").size() > 0) { if (OreDictionary.getOres("crystalCertusQuartz").size() > 0) {
OSMIUM.addSpecialty(OreDictionary.getOres("nuggetOsmium").get(0), 0.16f); CERTUS.addSpecialty(OreDictionary.getOres("crystalCertusQuartz").get(0), 0.08f);
} } else {
else { CERTUS.setInactive();
OSMIUM.setInactive(); }
}
CERTUS.addProduct(ForestryHelper.itemHoneycomb, 0.10f); SILICON.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("crystalCertusQuartz").size() > 0) { if (OreDictionary.getOres("itemSilicon").size() > 0) {
CERTUS.addSpecialty(OreDictionary.getOres("crystalCertusQuartz").get(0), 0.8f); SILICON.addSpecialty(OreDictionary.getOres("itemSilicon").get(0), 0.16f);
} } else {
else { SILICON.setInactive();
CERTUS.setInactive(); }
}
SILICON.addProduct(ForestryHelper.itemHoneycomb, 0.10f); FLUIX.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("itemSilicon").size() > 0) { if (OreDictionary.getOres("crystalFluix").size() > 0) {
SILICON.addSpecialty(OreDictionary.getOres("itemSilicon").get(0), 0.16f); FLUIX.addSpecialty(OreDictionary.getOres("crystalFluix").get(0), 0.06f);
} } else {
else { FLUIX.setInactive();
SILICON.setInactive(); }
} }
FLUIX.addProduct(ForestryHelper.itemHoneycomb, 0.10f); public static void initThaumcraftProducts() {
if (OreDictionary.getOres("crystalFluix").size() > 0) { TC_AIR.addProduct(Config.combs.getStackForType(CombType.TC_AIR), 0.20f);
FLUIX.addSpecialty(OreDictionary.getOres("crystalFluix").get(0), 0.6f); TC_FIRE.addProduct(Config.combs.getStackForType(CombType.TC_FIRE), 0.20f);
} TC_WATER.addProduct(Config.combs.getStackForType(CombType.TC_WATER), 0.20f);
else { TC_EARTH.addProduct(Config.combs.getStackForType(CombType.TC_EARTH), 0.20f);
FLUIX.setInactive(); TC_ORDER.addProduct(Config.combs.getStackForType(CombType.TC_ORDER), 0.20f);
} TC_CHAOS.addProduct(Config.combs.getStackForType(CombType.TC_CHAOS), 0.20f);
}
public static void initThaumcraftProducts() { TC_VIS.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.10f);
TC_AIR.addProduct(Config.combs.getStackForType(CombType.TC_AIR), 0.20f); TC_REJUVENATING.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.18f);
TC_FIRE.addProduct(Config.combs.getStackForType(CombType.TC_FIRE), 0.20f); TC_EMPOWERING.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.14f);
TC_WATER.addProduct(Config.combs.getStackForType(CombType.TC_WATER), 0.20f); TC_EMPOWERING.addSpecialty(
TC_EARTH.addProduct(Config.combs.getStackForType(CombType.TC_EARTH), 0.20f); new ItemStack(ForestryHelper.pollen, 1, ForestryHelper.Pollen.CRYSTALLINE.ordinal()), 0.02f);
TC_ORDER.addProduct(Config.combs.getStackForType(CombType.TC_ORDER), 0.20f); TC_NEXUS.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.25f);
TC_CHAOS.addProduct(Config.combs.getStackForType(CombType.TC_CHAOS), 0.20f); TC_NEXUS.addProduct(Config.combs.getStackForType(CombType.TEMPORAL), 0.12f);
TC_NEXUS.addSpecialty(
new ItemStack(ForestryHelper.pollen, 1, ForestryHelper.Pollen.CRYSTALLINE.ordinal()), 0.02f);
TC_TAINT.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.18f);
TC_TAINT.addProduct(
new ItemStack(ForestryHelper.craftingResource, 1, ForestryHelper.Propolis.STICKY.ordinal()), 0.213f);
TC_PURE.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.16f);
TC_PURE.addSpecialty(Config.combs.getStackForType(CombType.SOUL), 0.19f);
TC_HUNGRY.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.28f);
TC_HUNGRY.addSpecialty(Config.combs.getStackForType(CombType.TEMPORAL), 0.195f);
TC_WISPY.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.SILKY.ordinal()), 0.22f)
.addSpecialty(
new ItemStack(
ForestryHelper.craftingResource,
1,
ForestryHelper.CraftingMaterial.SILK_WISP.ordinal()),
0.04f);
TC_VOID.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
TC_VIS.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.10f); if (ThaumcraftHelper.isActive()) {
TC_REJUVENATING.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.18f); SCHOLARLY.addSpecialty(Config.miscResources.getStackForType(ResourceType.LORE_FRAGMENT), 0.02f);
TC_EMPOWERING.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.14f); SAVANT.addSpecialty(Config.miscResources.getStackForType(ResourceType.LORE_FRAGMENT), 0.05f);
TC_EMPOWERING.addSpecialty(new ItemStack(ForestryHelper.pollen, 1, ForestryHelper.Pollen.CRYSTALLINE.ordinal()), 0.2f);
TC_NEXUS.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.25f);
TC_NEXUS.addProduct(Config.combs.getStackForType(CombType.TEMPORAL), 0.12f);
TC_NEXUS.addSpecialty(new ItemStack(ForestryHelper.pollen, 1, ForestryHelper.Pollen.CRYSTALLINE.ordinal()), 0.2f);
TC_TAINT.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.18f);
TC_TAINT.addProduct(new ItemStack(ForestryHelper.craftingResource, 1 , ForestryHelper.Propolis.STICKY.ordinal()), 0.213f);
TC_PURE.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.16f);
TC_PURE.addSpecialty(Config.combs.getStackForType(CombType.SOUL), 0.19f);
TC_HUNGRY.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.28f);
TC_HUNGRY.addSpecialty(Config.combs.getStackForType(CombType.TEMPORAL), 0.195f);
TC_WISPY.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.SILKY.ordinal()), 0.22f)
.addSpecialty(new ItemStack(ForestryHelper.craftingResource, 1, ForestryHelper.CraftingMaterial.SILK_WISP.ordinal()), 0.4f);
TC_VOID.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (ThaumcraftHelper.isActive()) { TC_AIR.addSpecialty(Config.propolis.getStackForType(PropolisType.AIR), 0.18f);
SCHOLARLY.addSpecialty(Config.miscResources.getStackForType(ResourceType.LORE_FRAGMENT), 0.2f); TC_FIRE.addSpecialty(Config.propolis.getStackForType(PropolisType.FIRE), 0.18f);
SAVANT.addSpecialty(Config.miscResources.getStackForType(ResourceType.LORE_FRAGMENT), 0.5f); TC_WATER.addSpecialty(Config.propolis.getStackForType(PropolisType.WATER), 0.18f);
TC_EARTH.addSpecialty(Config.propolis.getStackForType(PropolisType.EARTH), 0.18f);
TC_ORDER.addSpecialty(Config.propolis.getStackForType(PropolisType.ORDER), 0.18f);
TC_CHAOS.addSpecialty(Config.propolis.getStackForType(PropolisType.CHAOS), 0.18f);
TC_AIR.addSpecialty(Config.propolis.getStackForType(PropolisType.AIR), 0.18f); BATTY.addSpecialty(new ItemStack(Items.gunpowder), 0.04f);
TC_FIRE.addSpecialty(Config.propolis.getStackForType(PropolisType.FIRE), 0.18f); BRAINY.addSpecialty(new ItemStack(ThaumcraftHelper.zombieBrain, 1), 0.02f);
TC_WATER.addSpecialty(Config.propolis.getStackForType(PropolisType.WATER), 0.18f); CHICKEN.addSpecialty(new ItemStack(ThaumcraftHelper.nuggetChicken, 1), 0.09f);
TC_EARTH.addSpecialty(Config.propolis.getStackForType(PropolisType.EARTH), 0.18f); BEEF.addSpecialty(new ItemStack(ThaumcraftHelper.nuggetBeef, 1), 0.09f);
TC_ORDER.addSpecialty(Config.propolis.getStackForType(PropolisType.ORDER), 0.18f); PORK.addSpecialty(new ItemStack(ThaumcraftHelper.nuggetPork, 1), 0.09f);
TC_CHAOS.addSpecialty(Config.propolis.getStackForType(PropolisType.CHAOS), 0.18f); TC_VOID.addSpecialty(
new ItemStack(ThaumcraftHelper.nuggetMetal, 1, ThaumcraftHelper.NuggetType.VOID_METAL.ordinal()),
0.155f);
}
}
BATTY.addSpecialty(new ItemStack(Items.gunpowder), 0.4f); public static void initEquivalentExchange3Species() {
BRAINY.addSpecialty(new ItemStack(ThaumcraftHelper.miscResource, 1, ThaumcraftHelper.MiscResource.ZOMBIE_BRAIN.ordinal()), 0.2f); EE_MINIUM.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.16f);
CHICKEN.addSpecialty(new ItemStack(ThaumcraftHelper.nuggetChicken, 1), 0.9f);
BEEF.addSpecialty(new ItemStack(ThaumcraftHelper.nuggetBeef, 1), 0.9f);
PORK.addSpecialty(new ItemStack(ThaumcraftHelper.nuggetPork, 1), 0.9f);
TC_VOID.addSpecialty(new ItemStack(ThaumcraftHelper.nuggetMetal, 1, ThaumcraftHelper.NuggetType.VOID_METAL.ordinal()), 0.155f);
}
}
public static void initEquivalentExchange3Species() { if (EquivalentExchangeHelper.isActive()) {
EE_MINIUM.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.16f); EE_MINIUM.addSpecialty(new ItemStack(EquivalentExchangeHelper.minuimShard), 0.06f);
}
}
if (EquivalentExchangeHelper.isActive()) { public static void initArsMagicaSpecies() {
EE_MINIUM.addSpecialty(new ItemStack(EquivalentExchangeHelper.minuimShard), 0.6f); AM_ESSENCE.addProduct(Config.combs.getStackForType(CombType.AM_ESSENCE), 0.12f);
} AM_QUINTESSENCE.addProduct(Config.combs.getStackForType(CombType.AM_ESSENCE), 0.23f);
} AM_EARTH.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f);
AM_AIR.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f);
AM_FIRE.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f);
AM_WATER.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f);
AM_LIGHTNING.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f);
AM_PLANT.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f);
AM_ICE.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f);
AM_ARCANE.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.19f);
AM_VORTEX.addProduct(Config.combs.getStackForType(CombType.AM_ESSENCE), 0.10f);
AM_WIGHT.addProduct(Config.combs.getStackForType(CombType.SOUL), 0.30f)
.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f);
public static void initArsMagicaSpecies() { if (ArsMagicaHelper.isActive()) {
AM_ESSENCE.addProduct(Config.combs.getStackForType(CombType.AM_ESSENCE), 0.12f); AM_QUINTESSENCE.addSpecialty(
AM_QUINTESSENCE.addProduct(Config.combs.getStackForType(CombType.AM_ESSENCE), 0.23f); new ItemStack(
AM_EARTH.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f); ArsMagicaHelper.itemResource, 1, ArsMagicaHelper.ResourceType.ARCANE_COMPOUND.ordinal()),
AM_AIR.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f); 0.05f);
AM_FIRE.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f); AM_EARTH.addSpecialty(
AM_WATER.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f); new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.EARTH.ordinal()), 0.07f);
AM_LIGHTNING.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f); AM_AIR.addSpecialty(
AM_PLANT.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f); new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.AIR.ordinal()), 0.07f);
AM_ICE.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f); AM_FIRE.addSpecialty(
AM_ARCANE.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.19f); new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.FIRE.ordinal()), 0.07f);
AM_VORTEX.addProduct(Config.combs.getStackForType(CombType.AM_ESSENCE), 0.10f); AM_WATER.addSpecialty(
AM_WIGHT.addProduct(Config.combs.getStackForType(CombType.SOUL), 0.30f) new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.WATER.ordinal()), 0.07f);
.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f); AM_LIGHTNING.addSpecialty(
new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.LIGHTNING.ordinal()), 0.07f);
AM_PLANT.addSpecialty(
new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.PLANT.ordinal()), 0.07f);
AM_ICE.addSpecialty(
new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.ICE.ordinal()), 0.07f);
AM_ARCANE.addSpecialty(
new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.ARCANE.ordinal()), 0.11f);
AM_VORTEX.addSpecialty(
new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.EARTH.ordinal()), 0.15f);
AM_WIGHT.addSpecialty(
new ItemStack(
ArsMagicaHelper.itemResource, 1, ArsMagicaHelper.ResourceType.ARCANE_COMPOUND.ordinal()),
0.11f);
}
}
if (ArsMagicaHelper.isActive()) { public static void initThermalExpansionProducts() {
AM_QUINTESSENCE.addSpecialty(new ItemStack(ArsMagicaHelper.itemResource, 1, ArsMagicaHelper.ResourceType.ARCANE_COMPOUND.ordinal()), 0.5f); TE_DANTE.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f)
AM_EARTH.addSpecialty(new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.EARTH.ordinal()), 0.7f); .addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.10f)
AM_AIR.addSpecialty(new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.AIR.ordinal()), 0.7f); .addSpecialty(new ItemStack(Items.blaze_powder), 0.05f);
AM_FIRE.addSpecialty(new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.FIRE.ordinal()), 0.7f); TE_PYRO.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f)
AM_WATER.addSpecialty(new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.WATER.ordinal()), 0.7f); .addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.10f)
AM_LIGHTNING.addSpecialty(new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.LIGHTNING.ordinal()), 0.7f); .addSpecialty(new ItemStack(Items.blaze_powder), 0.05f);
AM_PLANT.addSpecialty(new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.PLANT.ordinal()), 0.7f); TE_DESTABILIZED
AM_ICE.addSpecialty(new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.ICE.ordinal()), 0.7f); .addProduct(Config.combs.getStackForType(CombType.TE_DESTABILIZED), 0.10f)
AM_ARCANE.addSpecialty(new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.ARCANE.ordinal()), 0.11f); .addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.10f)
AM_VORTEX.addSpecialty(new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.EARTH.ordinal()), 0.15f); .addSpecialty(new ItemStack(Items.redstone), 0.05f);
AM_WIGHT.addSpecialty(new ItemStack(ArsMagicaHelper.itemResource, 1, ArsMagicaHelper.ResourceType.ARCANE_COMPOUND.ordinal()), 0.11f); TE_LUX.addProduct(Config.combs.getStackForType(CombType.TE_LUX), 0.10f)
} .addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.10f)
} .addSpecialty(new ItemStack(Items.glowstone_dust), 0.05f);
TE_WINSOME
.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.TE_ENDEARING), 0.05f)
.addSpecialty(new ItemStack(Items.ender_pearl), 0.05f);
TE_ENDEARING
.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.MYSTERIOUS.ordinal()), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.TE_ENDEARING), 0.05f);
TE_COAL.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
.addProduct(Config.combs.getStackForType(CombType.TE_CARBON), 0.05f)
.addSpecialty(new ItemStack(Items.coal), 0.05f);
TE_BLIZZY.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.FROZEN.ordinal()), 0.10f);
TE_GELID.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.FROZEN.ordinal()), 0.10f);
TE_SHOCKING.addProduct(Config.combs.getStackForType(CombType.AIRY), 0.16f);
TE_AMPED.addProduct(Config.combs.getStackForType(CombType.AIRY), 0.29f);
TE_GROUNDED.addProduct(Config.combs.getStackForType(CombType.EARTHY), 0.16f);
TE_ROCKING.addProduct(Config.combs.getStackForType(CombType.EARTHY), 0.29f);
public static void initThermalExpansionProducts() { TE_SIGNALUS
TE_DANTE.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f) .addProduct(Config.combs.getStackForType(CombType.TE_DESTABILIZED), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.10f) .addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.10f);
.addSpecialty(new ItemStack(Items.blaze_powder), 0.5f); TE_LUMIUS
TE_PYRO.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f) .addProduct(Config.combs.getStackForType(CombType.TE_LUX), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.10f) .addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.10f);
.addSpecialty(new ItemStack(Items.blaze_powder), 0.5f);
TE_DESTABILIZED.addProduct(Config.combs.getStackForType(CombType.TE_DESTABILIZED), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.10f)
.addSpecialty(new ItemStack(Items.redstone), 0.5f);
TE_LUX.addProduct(Config.combs.getStackForType(CombType.TE_LUX), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.10f)
.addSpecialty(new ItemStack(Items.glowstone_dust), 0.5f);
TE_WINSOME.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.TE_ENDEARING), 0.5f)
.addSpecialty(new ItemStack(Items.ender_pearl), 0.5f);
TE_ENDEARING.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.MYSTERIOUS.ordinal()), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.TE_ENDEARING), 0.5f);
TE_COAL.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
.addProduct(Config.combs.getStackForType(CombType.TE_CARBON), 0.5f)
.addSpecialty(new ItemStack(Items.coal), 0.5f);
TE_BLIZZY.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.FROZEN.ordinal()), 0.10f);
TE_GELID.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.FROZEN.ordinal()), 0.10f);
TE_SHOCKING.addProduct(Config.combs.getStackForType(CombType.AIRY), 0.16f);
TE_AMPED.addProduct(Config.combs.getStackForType(CombType.AIRY), 0.29f);
TE_GROUNDED.addProduct(Config.combs.getStackForType(CombType.EARTHY), 0.16f);
TE_ROCKING.addProduct(Config.combs.getStackForType(CombType.EARTHY), 0.29f);
if (ThermalModsHelper.isActive()) { if (ThermalModsHelper.isActive()) {
LogHelper.info("Thermal Expansion bees active"); LogHelper.info("Thermal Expansion bees active");
TE_BLIZZY.addSpecialty(ThermalModsHelper.dustBlizz, 0.9f); TE_BLIZZY.addSpecialty(ThermalModsHelper.dustBlizz, 0.09f);
TE_GELID.addSpecialty(ThermalModsHelper.dustCryotheum, 0.9f); TE_GELID.addSpecialty(ThermalModsHelper.dustCryotheum, 0.09f);
TE_DANTE.addSpecialty(ThermalModsHelper.dustSulfur, 0.9f); TE_DANTE.addSpecialty(ThermalModsHelper.dustSulfur, 0.09f);
TE_PYRO.addSpecialty(ThermalModsHelper.dustPyrotheum, 0.9f); TE_PYRO.addSpecialty(ThermalModsHelper.dustPyrotheum, 0.09f);
TE_SHOCKING.addSpecialty(ThermalModsHelper.dustBlitz, 0.9f); TE_SHOCKING.addSpecialty(ThermalModsHelper.dustBlitz, 0.09f);
TE_AMPED.addSpecialty(ThermalModsHelper.dustAerotheum, 0.9f); TE_AMPED.addSpecialty(ThermalModsHelper.dustAerotheum, 0.09f);
TE_GROUNDED.addSpecialty(ThermalModsHelper.dustBasalz, 0.9f); TE_GROUNDED.addSpecialty(ThermalModsHelper.dustBasalz, 0.09f);
TE_ROCKING.addSpecialty(ThermalModsHelper.dustPetrotheum, 0.9f); TE_ROCKING.addSpecialty(ThermalModsHelper.dustPetrotheum, 0.09f);
TE_WINSOME.addSpecialty(ThermalModsHelper.dustPlatinum, 0.9f); TE_WINSOME.addSpecialty(ThermalModsHelper.dustPlatinum, 0.09f);
TE_ENDEARING.addSpecialty(ThermalModsHelper.enderiumNugget, 0.9f); TE_ENDEARING.addSpecialty(ThermalModsHelper.enderiumNugget, 0.09f);
} TE_SIGNALUS.addSpecialty(ThermalModsHelper.signalumNugget, 0.09f);
} TE_LUMIUS.addSpecialty(ThermalModsHelper.lumiumNugget, 0.09f);
}
}
public static void initRedstoneArsenelProducts() { public static void initRedstoneArsenelProducts() {
RSA_FLUXED.addProduct(ForestryHelper.itemHoneycomb, 0.10f); RSA_FLUXED.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (RedstoneArsenalHelper.isActive()) { if (RedstoneArsenalHelper.isActive()) {
RSA_FLUXED.addSpecialty(RedstoneArsenalHelper.fluxNugget, 0.9f); RSA_FLUXED.addSpecialty(RedstoneArsenalHelper.fluxNugget, 0.09f);
} }
} }
public static void initBotaniaProducts() { public static void initBotaniaProducts() {
BOT_ROOTED.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.10f); BOT_ROOTED.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.10f);
BOT_BOTANIC.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.10f) BOT_BOTANIC
.addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.5f); .addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.10f)
BOT_BLOSSOM.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.20f) .addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.05f);
.addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.5f); BOT_BLOSSOM
BOT_FLORAL.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.25f) .addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.20f)
.addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.5f); .addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.05f);
BOT_VAZBEE.addProduct(Config.combs.getStackForType(CombType.SOUL), 0.5f) BOT_FLORAL
.addProduct(new ItemStack(Items.dye, 1, 9), 0.20f) .addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.25f)
.addProduct(new ItemStack(Blocks.wool, 1, 9), 0.2f) .addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.05f);
.addProduct(new ItemStack(Blocks.red_flower, 1, 7), 0.6f) BOT_VAZBEE
.addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.15f); .addProduct(Config.combs.getStackForType(CombType.SOUL), 0.05f)
BOT_SOMNOLENT.addProduct(Config.combs.getStackForType(CombType.WATERY), 0.8f) .addProduct(new ItemStack(Items.dye, 1, 9), 0.20f)
.addProduct(Config.combs.getStackForType(CombType.SOUL), 0.15f); .addProduct(new ItemStack(Blocks.wool, 1, 9), 0.02f)
BOT_DREAMING.addProduct(Config.combs.getStackForType(CombType.WATERY), 0.16f) .addProduct(new ItemStack(Blocks.red_flower, 1, 7), 0.06f)
.addProduct(Config.combs.getStackForType(CombType.SOUL), 0.33f); .addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.15f);
BOT_ALFHEIM.addProduct(Config.combs.getStackForType(CombType.OTHERWORLDLY), 0.28f); BOT_SOMNOLENT
.addProduct(Config.combs.getStackForType(CombType.WATERY), 0.08f)
.addProduct(Config.combs.getStackForType(CombType.SOUL), 0.15f);
BOT_DREAMING
.addProduct(Config.combs.getStackForType(CombType.WATERY), 0.16f)
.addProduct(Config.combs.getStackForType(CombType.SOUL), 0.33f);
BOT_ALFHEIM.addProduct(Config.combs.getStackForType(CombType.OTHERWORLDLY), 0.28f);
if (BotaniaHelper.isActive()) { if (BotaniaHelper.isActive()) {
for (int i = 0; i < 16; ++i) { for (int i = 0; i < 16; ++i) {
ItemStack petal = new ItemStack(BotaniaHelper.itemPetal, 1, i); ItemStack petal = new ItemStack(BotaniaHelper.itemPetal, 1, i);
BOT_BOTANIC.addSpecialty(petal, 0.1f); BOT_BOTANIC.addSpecialty(petal, 0.01f);
BOT_BLOSSOM.addSpecialty(petal, 0.4f); BOT_BLOSSOM.addSpecialty(petal, 0.04f);
BOT_FLORAL.addSpecialty(petal, 0.16f); BOT_FLORAL.addSpecialty(petal, 0.16f);
} }
for (PastureSeed type : PastureSeed.values()) { for (PastureSeed type : PastureSeed.values()) {
BOT_VAZBEE.addSpecialty(new ItemStack(BotaniaHelper.itemPastureSeed, 1, type.ordinal()), 0.4f); BOT_VAZBEE.addSpecialty(new ItemStack(BotaniaHelper.itemPastureSeed, 1, type.ordinal()), 0.04f);
} }
} }
} }
public static void initAppEngProducts() { public static void initAppEngProducts() {
AE_SKYSTONE.addProduct(Config.combs.getStackForType(CombType.EARTHY), 0.19f); AE_SKYSTONE.addProduct(Config.combs.getStackForType(CombType.EARTHY), 0.19f);
if (AppliedEnergisticsHelper.skystone != null) { if (AppliedEnergisticsHelper.skystone != null) {
AE_SKYSTONE.addSpecialty(new ItemStack(AppliedEnergisticsHelper.skystone), 0.2f); AE_SKYSTONE.addSpecialty(new ItemStack(AppliedEnergisticsHelper.skystone), 0.02f);
} } else {
else { AE_SKYSTONE.setInactive();
AE_SKYSTONE.setInactive(); }
} }
}
} }
File diff suppressed because it is too large. Load diff
+181 -156
View File
@@ -1,23 +1,14 @@
package magicbees.bees; package magicbees.bees;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
import forestry.api.apiculture.hives.HiveManager; import forestry.api.apiculture.hives.HiveManager;
import forestry.api.apiculture.hives.IHiveDescription; import forestry.api.apiculture.hives.IHiveDescription;
import forestry.api.apiculture.hives.IHiveGen; import forestry.api.apiculture.hives.IHiveGen;
import forestry.api.core.EnumHumidity; import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature; import forestry.api.core.EnumTemperature;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import magicbees.block.types.HiveType; import magicbees.block.types.HiveType;
import magicbees.main.Config; import magicbees.main.Config;
import magicbees.main.utils.BlockUtil; import magicbees.main.utils.BlockUtil;
@@ -26,166 +17,200 @@ import magicbees.world.feature.FeatureOreVein;
import magicbees.world.feature.HiveGenNether; import magicbees.world.feature.HiveGenNether;
import magicbees.world.feature.HiveGenOblivion; import magicbees.world.feature.HiveGenOblivion;
import magicbees.world.feature.HiveGenUnderground; import magicbees.world.feature.HiveGenUnderground;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
public enum HiveDescription implements IHiveDescription { public enum HiveDescription implements IHiveDescription {
CURIOUS(HiveType.CURIOUS, 3.0f, HiveManager.genHelper.tree(), false, CURIOUS(
BiomeDictionary.Type.FOREST, BiomeDictionary.Type.PLAINS, BiomeDictionary.Type.HILLS), HiveType.CURIOUS,
UNUSUAL(HiveType.UNUSUAL, 1.0f, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass), false, 3.0f,
BiomeDictionary.Type.PLAINS, BiomeDictionary.Type.MOUNTAIN, BiomeDictionary.Type.HILLS, BiomeDictionary.Type.RIVER), HiveManager.genHelper.tree(),
RESONANT(HiveType.RESONANT, 0.9f, HiveManager.genHelper.ground(Blocks.sand, Blocks.sandstone), false, false,
BiomeDictionary.Type.SANDY, BiomeDictionary.Type.MESA, BiomeDictionary.Type.HOT, BiomeDictionary.Type.MAGICAL), BiomeDictionary.Type.FOREST,
DEEP(HiveType.DEEP, 5.0f, new HiveGenUnderground(10, 15, 5), true, BiomeDictionary.Type.PLAINS,
BiomeDictionary.Type.HILLS, BiomeDictionary.Type.MOUNTAIN, BiomeDictionary.Type.MAGICAL) { BiomeDictionary.Type.HILLS),
@Override UNUSUAL(
public void postGen(World world, int x, int y, int z) { HiveType.UNUSUAL,
super.postGen(world, x, y, z); 1.0f,
Random random = world.rand; HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass),
FeatureOreVein.redstoneGen.generateVein(world, random, x + 1, y, z, 5); false,
FeatureOreVein.redstoneGen.generateVein(world, random, x - 1, y, z, 5); BiomeDictionary.Type.PLAINS,
FeatureOreVein.redstoneGen.generateVein(world, random, x, y + 1, z, 5); BiomeDictionary.Type.MOUNTAIN,
FeatureOreVein.redstoneGen.generateVein(world, random, x, y - 1, z, 5); BiomeDictionary.Type.HILLS,
FeatureOreVein.redstoneGen.generateVein(world, random, x, y, z + 1, 5); BiomeDictionary.Type.RIVER),
FeatureOreVein.redstoneGen.generateVein(world, random, x, y, z - 1, 5); RESONANT(
} HiveType.RESONANT,
}, 0.9f,
INFERNAL(HiveType.INFERNAL, 50.0f, new HiveGenNether(0, 175, 6), true, HiveManager.genHelper.ground(Blocks.sand, Blocks.sandstone),
BiomeDictionary.Type.NETHER) { false,
@Override BiomeDictionary.Type.SANDY,
public void postGen(World world, int x, int y, int z) { BiomeDictionary.Type.MESA,
super.postGen(world, x, y, z); BiomeDictionary.Type.HOT,
Random random = world.rand; BiomeDictionary.Type.MAGICAL),
FeatureOreVein.netherQuartzGen.generateVein(world, random, x + 1, y, z, 4); DEEP(
FeatureOreVein.netherQuartzGen.generateVein(world, random, x - 1, y, z, 4); HiveType.DEEP,
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y + 1, z, 4); 5.0f,
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y - 1, z, 4); new HiveGenUnderground(10, 15, 5),
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y, z + 1, 4); true,
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y, z - 1, 4); BiomeDictionary.Type.HILLS,
} BiomeDictionary.Type.MOUNTAIN,
}, BiomeDictionary.Type.MAGICAL) {
INFERNAL_OVERWORLD(HiveType.INFERNAL, 0.95f, new HiveGenUnderground(5, 13, 6), true, @Override
BiomeDictionary.Type.MAGICAL, BiomeDictionary.Type.HOT) { public void postGen(World world, int x, int y, int z) {
@Override super.postGen(world, x, y, z);
public void postGen(World world, int x, int y, int z) { Random random = world.rand;
super.postGen(world, x, y, z); FeatureOreVein.redstoneGen.generateVein(world, random, x + 1, y, z, 5);
Random random = world.rand; FeatureOreVein.redstoneGen.generateVein(world, random, x - 1, y, z, 5);
FeatureOreVein.glowstoneGen.generateVein(world, random, x + 1, y, z, world.rand.nextInt(4) + 1); FeatureOreVein.redstoneGen.generateVein(world, random, x, y + 1, z, 5);
FeatureOreVein.glowstoneGen.generateVein(world, random, x - 1, y, z, world.rand.nextInt(4) + 1); FeatureOreVein.redstoneGen.generateVein(world, random, x, y - 1, z, 5);
FeatureOreVein.redstoneGen.generateVein(world, random, x, y, z + 1, 5);
FeatureOreVein.redstoneGen.generateVein(world, random, x, y, z - 1, 5);
}
},
INFERNAL(HiveType.INFERNAL, 50.0f, new HiveGenNether(0, 175, 6), true, BiomeDictionary.Type.NETHER) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
Random random = world.rand;
FeatureOreVein.netherQuartzGen.generateVein(world, random, x + 1, y, z, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x - 1, y, z, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y + 1, z, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y - 1, z, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y, z + 1, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y, z - 1, 4);
}
},
INFERNAL_OVERWORLD(
HiveType.INFERNAL,
0.95f,
new HiveGenUnderground(5, 13, 6),
true,
BiomeDictionary.Type.MAGICAL,
BiomeDictionary.Type.HOT) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
Random random = world.rand;
FeatureOreVein.glowstoneGen.generateVein(world, random, x + 1, y, z, world.rand.nextInt(4) + 1);
FeatureOreVein.glowstoneGen.generateVein(world, random, x - 1, y, z, world.rand.nextInt(4) + 1);
if (BlockUtil.canBlockReplaceAt(world, x, y + 1, z, Blocks.stone)) { if (BlockUtil.canBlockReplaceAt(world, x, y + 1, z, Blocks.stone)) {
world.setBlock(x, y + 1, z, Blocks.glowstone, 0, 3); world.setBlock(x, y + 1, z, Blocks.glowstone, 0, 3);
} }
if (BlockUtil.canBlockReplaceAt(world, x, y - 1, z, Blocks.stone)) { if (BlockUtil.canBlockReplaceAt(world, x, y - 1, z, Blocks.stone)) {
world.setBlock(x, y - 1, z, Blocks.glowstone, 0, 3); world.setBlock(x, y - 1, z, Blocks.glowstone, 0, 3);
} }
FeatureOreVein.glowstoneGen.generateVein(world, random, x, y, z + 1, world.rand.nextInt(4) + 1); FeatureOreVein.glowstoneGen.generateVein(world, random, x, y, z + 1, world.rand.nextInt(4) + 1);
FeatureOreVein.glowstoneGen.generateVein(world, random, x, y, z - 1, world.rand.nextInt(4) + 1); FeatureOreVein.glowstoneGen.generateVein(world, random, x, y, z - 1, world.rand.nextInt(4) + 1);
} }
}, },
OBLIVION(HiveType.OBLIVION, 20.0f, new HiveGenOblivion(), true, OBLIVION(HiveType.OBLIVION, 20.0f, new HiveGenOblivion(), true, BiomeDictionary.Type.END) {
BiomeDictionary.Type.END) { @Override
@Override public void postGen(World world, int x, int y, int z) {
public void postGen(World world, int x, int y, int z) { super.postGen(world, x, y, z);
super.postGen(world, x, y, z); int obsidianSpikeHeight = world.rand.nextInt(8) + 3;
int obsidianSpikeHeight = world.rand.nextInt(8) + 3;
for (int i = 1; i < obsidianSpikeHeight && y - i > 0; ++i) { for (int i = 1; i < obsidianSpikeHeight && y - i > 0; ++i) {
world.setBlock(x, y - i, z, Blocks.obsidian, 0, 2); world.setBlock(x, y - i, z, Blocks.obsidian, 0, 2);
} }
} }
}, },
OBLIVION_OVERWORLD(HiveType.OBLIVION, 0.87f, new HiveGenUnderground(5, 5, 5), true, OBLIVION_OVERWORLD(
BiomeDictionary.Type.MAGICAL, BiomeDictionary.Type.COLD) { HiveType.OBLIVION,
@Override 0.87f,
public void postGen(World world, int x, int y, int z) { new HiveGenUnderground(5, 5, 5),
super.postGen(world, x, y, z); true,
Random random = world.rand; BiomeDictionary.Type.MAGICAL,
BiomeDictionary.Type.COLD) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
Random random = world.rand;
FeatureOreVein.endStoneGen.generateVein(world, random, x + 1, y, z, world.rand.nextInt(6) + 1); FeatureOreVein.endStoneGen.generateVein(world, random, x + 1, y, z, world.rand.nextInt(6) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x - 1, y, z, world.rand.nextInt(6) + 1); FeatureOreVein.endStoneGen.generateVein(world, random, x - 1, y, z, world.rand.nextInt(6) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x, y + 1, z, world.rand.nextInt(3) + 1); FeatureOreVein.endStoneGen.generateVein(world, random, x, y + 1, z, world.rand.nextInt(3) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x, y - 1, z, world.rand.nextInt(3) + 1); FeatureOreVein.endStoneGen.generateVein(world, random, x, y - 1, z, world.rand.nextInt(3) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x, y, z + 1, world.rand.nextInt(6) + 1); FeatureOreVein.endStoneGen.generateVein(world, random, x, y, z + 1, world.rand.nextInt(6) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x, y, z - 1, world.rand.nextInt(6) + 1); FeatureOreVein.endStoneGen.generateVein(world, random, x, y, z - 1, world.rand.nextInt(6) + 1);
} }
}; };
private static boolean logSpawns = Config.logHiveSpawns; private static boolean logSpawns = Config.logHiveSpawns;
private final HiveType hiveType; private final HiveType hiveType;
private final float genChance; private final float genChance;
private final List<BiomeDictionary.Type> biomes = new ArrayList<BiomeDictionary.Type>(); private final List<BiomeDictionary.Type> biomes = new ArrayList<BiomeDictionary.Type>();
private final IHiveGen hiveGen; private final IHiveGen hiveGen;
private final boolean spawnsIgnoreClimate; private final boolean spawnsIgnoreClimate;
private HiveDescription(HiveType type, float chance, IHiveGen genType, boolean ignoreClimate, BiomeDictionary.Type ... goodBiomeTypes) { private HiveDescription(
hiveType = type; HiveType type,
genChance = chance; float chance,
hiveGen = genType; IHiveGen genType,
spawnsIgnoreClimate = ignoreClimate; boolean ignoreClimate,
for (BiomeDictionary.Type biomeType : goodBiomeTypes) { BiomeDictionary.Type... goodBiomeTypes) {
biomes.add(biomeType); hiveType = type;
} genChance = chance;
} hiveGen = genType;
spawnsIgnoreClimate = ignoreClimate;
for (BiomeDictionary.Type biomeType : goodBiomeTypes) {
biomes.add(biomeType);
}
}
@Override @Override
public IHiveGen getHiveGen() public IHiveGen getHiveGen() {
{ return hiveGen;
return hiveGen; }
}
@Override @Override
public Block getBlock() public Block getBlock() {
{ return Config.hive;
return Config.hive; }
}
@Override @Override
public int getMeta() public int getMeta() {
{ return hiveType.ordinal();
return hiveType.ordinal(); }
}
@Override @Override
public boolean isGoodBiome(BiomeGenBase biome) public boolean isGoodBiome(BiomeGenBase biome) {
{ BiomeDictionary.Type[] types = BiomeDictionary.getTypesForBiome(biome);
BiomeDictionary.Type[] types = BiomeDictionary.getTypesForBiome(biome); for (BiomeDictionary.Type type : types) {
for (BiomeDictionary.Type type : types) if (biomes.contains(type)) {
{ return true;
if (biomes.contains(type)) }
{ }
return true;
}
}
return false; return false;
} }
@Override @Override
public boolean isGoodHumidity(EnumHumidity humidity) public boolean isGoodHumidity(EnumHumidity humidity) {
{ return spawnsIgnoreClimate || hiveType.getOccupant().canWorkInHumidity(humidity);
return spawnsIgnoreClimate || hiveType.getOccupant().canWorkInHumidity(humidity); }
}
@Override @Override
public boolean isGoodTemperature(EnumTemperature temperature) public boolean isGoodTemperature(EnumTemperature temperature) {
{ return spawnsIgnoreClimate || hiveType.getOccupant().canWorkInTemperature(temperature);
return spawnsIgnoreClimate || hiveType.getOccupant().canWorkInTemperature(temperature); }
}
@Override @Override
public float getGenChance() public float getGenChance() {
{ return genChance;
return genChance; }
}
@Override @Override
public void postGen(World world, int x, int y, int z) public void postGen(World world, int x, int y, int z) {
{ if (logSpawns) {
if (logSpawns) LogHelper.info("Spawned " + this.toString().toLowerCase(Locale.ENGLISH) + " hive at: X " + x + ", Y: " + y
{ + ", Z: " + z);
LogHelper.info("Spawned " + this.toString().toLowerCase(Locale.ENGLISH) + " hive at: X " + x + ", Y: " + y + ", Z: " + z); }
} }
}
} }
+47 -58
View File
@@ -1,77 +1,66 @@
package magicbees.bees; package magicbees.bees;
import java.util.ArrayList;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import forestry.api.apiculture.EnumBeeType; import forestry.api.apiculture.EnumBeeType;
import forestry.api.apiculture.IBee; import forestry.api.apiculture.IBee;
import forestry.api.apiculture.IHiveDrop; import forestry.api.apiculture.IHiveDrop;
import forestry.api.genetics.IAllele; import forestry.api.genetics.IAllele;
import java.util.ArrayList;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class HiveDrop implements IHiveDrop public class HiveDrop implements IHiveDrop {
{ private IAllele[] template;
private IAllele[] template; private int chance;
private int chance; private ItemStack[] bonus;
private ItemStack[] bonus; private float ignoblePercent = 0f;
private float ignoblePercent = 0f;
public HiveDrop(IAllele[] beeTemplate, ItemStack[] bonusDrops, int dropChance) public HiveDrop(IAllele[] beeTemplate, ItemStack[] bonusDrops, int dropChance) {
{ this.template = beeTemplate;
this.template = beeTemplate; this.bonus = bonusDrops;
this.bonus = bonusDrops; this.chance = dropChance;
this.chance = dropChance; }
}
public HiveDrop setIgnoblePercentage(float f) public HiveDrop setIgnoblePercentage(float f) {
{ this.ignoblePercent = f;
this.ignoblePercent = f;
return this; return this;
} }
private IBee getBee(World w) private IBee getBee(World w) {
{ IBee bee = BeeManager.beeRoot.getBee(w, BeeManager.beeRoot.templateAsGenome(this.template));
IBee bee = BeeManager.beeRoot.getBee(w, BeeManager.beeRoot.templateAsGenome(this.template)); if (w.rand.nextFloat() < this.ignoblePercent) {
if (w.rand.nextFloat() < this.ignoblePercent) bee.setIsNatural(false);
{ }
bee.setIsNatural(false);
}
return bee; return bee;
} }
@Override @Override
public ItemStack getPrincess(World world, int x, int y, int z, int fortune) public ItemStack getPrincess(World world, int x, int y, int z, int fortune) {
{ return BeeManager.beeRoot.getMemberStack(getBee(world), EnumBeeType.PRINCESS.ordinal());
return BeeManager.beeRoot.getMemberStack(getBee(world), EnumBeeType.PRINCESS.ordinal()); }
}
@Override @Override
public Collection<ItemStack> getDrones(World world, int x, int y, int z, int fortune) public Collection<ItemStack> getDrones(World world, int x, int y, int z, int fortune) {
{ ArrayList<ItemStack> value = new ArrayList<ItemStack>(1);
ArrayList<ItemStack> value = new ArrayList<ItemStack>(1); value.add(BeeManager.beeRoot.getMemberStack(getBee(world), EnumBeeType.DRONE.ordinal()));
value.add(BeeManager.beeRoot.getMemberStack(getBee(world), EnumBeeType.DRONE.ordinal())); return value;
return value; }
}
@Override @Override
public Collection<ItemStack> getAdditional(World world, int x, int y, int z, int fortune) public Collection<ItemStack> getAdditional(World world, int x, int y, int z, int fortune) {
{ ArrayList<ItemStack> value = new ArrayList<ItemStack>(bonus.length);
ArrayList<ItemStack> value = new ArrayList<ItemStack>(bonus.length);
for (int i = 0; i < bonus.length; ++i) for (int i = 0; i < bonus.length; ++i) {
{ value.add(bonus[i].copy());
value.add(bonus[i].copy()); }
}
return value; return value;
} }
@Override @Override
public int getChance(World world, int x, int y, int z) public int getChance(World world, int x, int y, int z) {
{ return this.chance;
return this.chance; }
}
} }
@@ -1,48 +1,59 @@
package magicbees.bees; package magicbees.bees;
import net.minecraft.world.World; import forestry.api.core.IClimateProvider;
import forestry.api.genetics.IAllele; import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome; import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition; import forestry.api.genetics.IMutationCondition;
import magicbees.main.utils.LocalizationManager; import magicbees.main.utils.LocalizationManager;
import magicbees.main.utils.MoonPhase; import magicbees.main.utils.MoonPhase;
import net.minecraft.world.World;
// There is a bonus to this mutation during moon phases... // There is a bonus to this mutation during moon phases...
public class MoonPhaseMutationBonus implements IMutationCondition { public class MoonPhaseMutationBonus implements IMutationCondition {
private final MoonPhase moonPhaseStart; private final MoonPhase moonPhaseStart;
private final MoonPhase moonPhaseEnd; private final MoonPhase moonPhaseEnd;
private final float mutationBonus; private final float mutationBonus;
public MoonPhaseMutationBonus(MoonPhase phase, float bonus) { public MoonPhaseMutationBonus(MoonPhase phase, float bonus) {
this.moonPhaseStart = phase; this.moonPhaseStart = phase;
this.moonPhaseEnd = phase; this.moonPhaseEnd = phase;
this.mutationBonus = bonus; this.mutationBonus = bonus;
} }
public MoonPhaseMutationBonus(MoonPhase start, MoonPhase end, float bonus) { public MoonPhaseMutationBonus(MoonPhase start, MoonPhase end, float bonus) {
this.moonPhaseStart = start; this.moonPhaseStart = start;
this.moonPhaseEnd = end; this.moonPhaseEnd = end;
this.mutationBonus = bonus; this.mutationBonus = bonus;
} }
@Override @Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) { public float getChance(
if (MoonPhase.getMoonPhase(world).isBetween(this.moonPhaseStart, this.moonPhaseEnd)) { World world,
return this.mutationBonus; int x,
} int y,
return 1; int z,
} IAllele allele0,
IAllele allele1,
IGenome genome0,
IGenome genome1,
IClimateProvider climate) {
if (MoonPhase.getMoonPhase(world).isBetween(this.moonPhaseStart, this.moonPhaseEnd)) {
return this.mutationBonus;
}
return 1;
}
@Override @Override
public String getDescription() { public String getDescription() {
if (this.moonPhaseStart != this.moonPhaseEnd) { if (this.moonPhaseStart != this.moonPhaseEnd) {
return String.format(LocalizationManager.getLocalizedString("research.bonusPhase"), return String.format(
moonPhaseStart.getLocalizedNameAlt(), moonPhaseEnd.getLocalizedNameAlt()); LocalizationManager.getLocalizedString("research.bonusPhase"),
} else { moonPhaseStart.getLocalizedNameAlt(),
return String.format(LocalizationManager.getLocalizedString("research.bonusPhaseSingle"), moonPhaseEnd.getLocalizedNameAlt());
moonPhaseStart.getLocalizedName()); } else {
} return String.format(
} LocalizationManager.getLocalizedString("research.bonusPhaseSingle"),
moonPhaseStart.getLocalizedName());
}
}
} }
@@ -1,45 +1,55 @@
package magicbees.bees; package magicbees.bees;
import net.minecraft.world.World; import forestry.api.core.IClimateProvider;
import forestry.api.genetics.IAllele; import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome; import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition; import forestry.api.genetics.IMutationCondition;
import magicbees.main.utils.LocalizationManager; import magicbees.main.utils.LocalizationManager;
import magicbees.main.utils.MoonPhase; import magicbees.main.utils.MoonPhase;
import net.minecraft.world.World;
public class MoonPhaseMutationRestriction implements IMutationCondition { public class MoonPhaseMutationRestriction implements IMutationCondition {
private final MoonPhase moonPhaseStart; private final MoonPhase moonPhaseStart;
private final MoonPhase moonPhaseEnd; private final MoonPhase moonPhaseEnd;
public MoonPhaseMutationRestriction(MoonPhase phase) { public MoonPhaseMutationRestriction(MoonPhase phase) {
this.moonPhaseStart = phase; this.moonPhaseStart = phase;
this.moonPhaseEnd = phase; this.moonPhaseEnd = phase;
} }
public MoonPhaseMutationRestriction(MoonPhase start, MoonPhase end) { public MoonPhaseMutationRestriction(MoonPhase start, MoonPhase end) {
this.moonPhaseStart = start; this.moonPhaseStart = start;
this.moonPhaseEnd = end; this.moonPhaseEnd = end;
} }
@Override @Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) { public float getChance(
if (MoonPhase.getMoonPhase(world).isBetween(this.moonPhaseStart, this.moonPhaseEnd)) { World world,
return 1; int x,
} int y,
return 0; int z,
} IAllele allele0,
IAllele allele1,
IGenome genome0,
IGenome genome1,
IClimateProvider climate) {
if (MoonPhase.getMoonPhase(world).isBetween(this.moonPhaseStart, this.moonPhaseEnd)) {
return 1;
}
return 0;
}
@Override @Override
public String getDescription() { public String getDescription() {
if (moonPhaseStart != moonPhaseEnd) { if (moonPhaseStart != moonPhaseEnd) {
return String.format(LocalizationManager.getLocalizedString("research.requiresPhase"), return String.format(
moonPhaseStart.getLocalizedNameAlt(), moonPhaseEnd.getLocalizedNameAlt()); LocalizationManager.getLocalizedString("research.requiresPhase"),
} moonPhaseStart.getLocalizedNameAlt(),
else { moonPhaseEnd.getLocalizedNameAlt());
return String.format(LocalizationManager.getLocalizedString("research.requiresPhaseSingle"), } else {
moonPhaseStart.getLocalizedName()); return String.format(
} LocalizationManager.getLocalizedString("research.requiresPhaseSingle"),
} moonPhaseStart.getLocalizedName());
}
}
} }
@@ -1,87 +1,90 @@
package magicbees.bees.allele.effect; package magicbees.bees.allele.effect;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData;
import java.util.HashMap; import java.util.HashMap;
import magicbees.bees.AlleleEffect; import magicbees.bees.AlleleEffect;
import magicbees.bees.BeeManager; import magicbees.bees.BeeManager;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData;
public class AlleleEffectCrumbling extends AlleleEffect { public class AlleleEffectCrumbling extends AlleleEffect {
private static HashMap<ItemStack, ItemStack> crumbleMap = new HashMap<ItemStack, ItemStack>(); private static HashMap<ItemStack, ItemStack> crumbleMap = new HashMap<ItemStack, ItemStack>();
public static void addPairToMap(ItemStack source, ItemStack target) { public static void addPairToMap(ItemStack source, ItemStack target) {
boolean add = true; boolean add = true;
for (ItemStack i : crumbleMap.keySet()) { for (ItemStack i : crumbleMap.keySet()) {
if (OreDictionary.itemMatches(i, source, false)) { if (OreDictionary.itemMatches(i, source, false)) {
add = false; add = false;
break; break;
} }
} }
if (add) { if (add) {
crumbleMap.put(source, target); crumbleMap.put(source, target);
} }
} }
public AlleleEffectCrumbling(String id, boolean isDominant) { public AlleleEffectCrumbling(String id, boolean isDominant) {
super(id, isDominant, 600); super(id, isDominant, 600);
addPairToMap(new ItemStack(Blocks.stone), new ItemStack(Blocks.cobblestone)); addPairToMap(new ItemStack(Blocks.stone), new ItemStack(Blocks.cobblestone));
addPairToMap(new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.mossy_cobblestone)); addPairToMap(new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.mossy_cobblestone));
addPairToMap(new ItemStack(Blocks.stonebrick, 1, 0), new ItemStack(Blocks.stonebrick, 1, 2)); addPairToMap(new ItemStack(Blocks.stonebrick, 1, 0), new ItemStack(Blocks.stonebrick, 1, 2));
addPairToMap(new ItemStack(Blocks.stonebrick, 1, 2), new ItemStack(Blocks.stonebrick, 1, 1)); addPairToMap(new ItemStack(Blocks.stonebrick, 1, 2), new ItemStack(Blocks.stonebrick, 1, 1));
addPairToMap(new ItemStack(Blocks.cobblestone_wall), new ItemStack(Blocks.cobblestone_wall, 1, 1)); addPairToMap(new ItemStack(Blocks.cobblestone_wall), new ItemStack(Blocks.cobblestone_wall, 1, 1));
addPairToMap(new ItemStack(Blocks.gravel), new ItemStack(Blocks.sand)); addPairToMap(new ItemStack(Blocks.gravel), new ItemStack(Blocks.sand));
} }
@Override @Override
public IEffectData validateStorage(IEffectData storedData) { public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) { if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0); storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
} }
return storedData; return storedData;
} }
@Override @Override
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) { protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld(); World world = housing.getWorld();
ChunkCoordinates coords = housing.getCoordinates(); ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing); IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
// Get random coords within territory // Get random coords within territory
int xRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]); int xRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]);
int yRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[1]); int yRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[1]);
int zRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[2]); int zRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[2]);
int xCoord = coords.posX + world.rand.nextInt(xRange) - xRange / 2; int xCoord = coords.posX + world.rand.nextInt(xRange) - xRange / 2;
int yCoord = coords.posY + world.rand.nextInt(yRange) - yRange / 2; int yCoord = coords.posY + world.rand.nextInt(yRange) - yRange / 2;
int zCoord = coords.posZ + world.rand.nextInt(zRange) - zRange / 2; int zCoord = coords.posZ + world.rand.nextInt(zRange) - zRange / 2;
Block block = world.getBlock(xCoord, yCoord, zCoord); Block block = world.getBlock(xCoord, yCoord, zCoord);
if (block != null) { if (block != null) {
ItemStack source = new ItemStack(block, 1, world.getBlockMetadata(xCoord, yCoord, zCoord)); ItemStack source = new ItemStack(block, 1, world.getBlockMetadata(xCoord, yCoord, zCoord));
for (ItemStack key : crumbleMap.keySet()) { for (ItemStack key : crumbleMap.keySet()) {
if (OreDictionary.itemMatches(source, key, false)) { if (OreDictionary.itemMatches(source, key, false)) {
ItemStack target = crumbleMap.get(key); ItemStack target = crumbleMap.get(key);
world.setBlock(xCoord, yCoord, zCoord, Block.getBlockFromItem(target.getItem()), target.getItemDamage(), 2); world.setBlock(
xCoord,
yCoord,
zCoord,
Block.getBlockFromItem(target.getItem()),
target.getItemDamage(),
2);
break; break;
} }
} }
} }
storedData.setInteger(0, 0); storedData.setInteger(0, 0);
return storedData;
}
return storedData;
}
} }
@@ -1,41 +1,37 @@
package magicbees.bees.allele.effect; package magicbees.bees.allele.effect;
import java.util.List;
import magicbees.bees.AlleleEffect;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import forestry.api.apiculture.IBeeGenome; import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing; import forestry.api.apiculture.IBeeHousing;
import forestry.api.genetics.IEffectData; import forestry.api.genetics.IEffectData;
import java.util.List;
import magicbees.bees.AlleleEffect;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
public class AlleleEffectCure extends AlleleEffect { public class AlleleEffectCure extends AlleleEffect {
public AlleleEffectCure(String id, boolean isDominant) { public AlleleEffectCure(String id, boolean isDominant) {
super(id, isDominant, 200); super(id, isDominant, 200);
} }
@Override @Override
public IEffectData validateStorage(IEffectData storedData) { public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null) { if (storedData == null) {
storedData = new EffectData(1, 0, 0); storedData = new EffectData(1, 0, 0);
} }
return storedData; return storedData;
} }
@Override @Override
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) { public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
List<EntityPlayer> entityList = this.getEntitiesWithinRange(genome, housing, EntityPlayer.class); List<EntityPlayer> entityList = this.getEntitiesWithinRange(genome, housing, EntityPlayer.class);
for (EntityPlayer player : entityList) { for (EntityPlayer player : entityList) {
player.curePotionEffects(new ItemStack(Items.milk_bucket)); player.curePotionEffects(new ItemStack(Items.milk_bucket));
} }
storedData.setInteger(0, 0); storedData.setInteger(0, 0);
return storedData;
}
return storedData;
}
} }
@@ -1,48 +1,113 @@
package magicbees.bees.allele.effect; package magicbees.bees.allele.effect;
import java.util.List; import static magicbees.main.utils.compat.thaumcraft.NodeHelper.getWeightedRandomAspect;
import static magicbees.main.utils.compat.thaumcraft.NodeHelper.updateNode;
import magicbees.bees.AlleleEffect; import forestry.api.apiculture.IAlleleBeeAcceleratableEffect;
import magicbees.bees.BeeManager;
import magicbees.main.utils.BlockUtil;
import magicbees.main.utils.compat.thaumcraft.NodeHelper;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import forestry.api.apiculture.IBeeGenome; import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing; import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier; import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData; import forestry.api.genetics.IEffectData;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import magicbees.bees.AlleleEffect;
import magicbees.bees.BeeManager;
import magicbees.main.Config;
import magicbees.main.utils.BlockUtil;
import magicbees.main.utils.compat.thaumcraft.NodeHelper;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.nodes.INode;
public class AlleleEffectEmpowering extends AlleleEffect { public class AlleleEffectEmpowering extends AlleleEffect implements IAlleleBeeAcceleratableEffect {
public AlleleEffectEmpowering(String id, boolean isDominant) { public AlleleEffectEmpowering(String id, boolean isDominant) {
super(id, isDominant, 200); super(id, isDominant, 200);
combinable = true; combinable = true;
} }
@Override @Override
public IEffectData validateStorage(IEffectData storedData) { public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) { if (!(storedData instanceof EffectData)) {
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0); storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
} }
return storedData; return storedData;
} }
@Override @Override
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) { protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld(); World world = housing.getWorld();
ChunkCoordinates coords = housing.getCoordinates(); ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing); IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
int range = Math.max((int)Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f)), 1); int range =
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range); Math.max((int) Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f)), 1);
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
if (NodeHelper.growNodeInRange(chunks, world, coords.posX, coords.posY, coords.posZ, range)) { if (NodeHelper.growNodeInRange(chunks, world, coords.posX, coords.posY, coords.posZ, range)) {
storedData.setInteger(0, storedData.getInteger(0) - throttle); storedData.setInteger(0, storedData.getInteger(0) - throttle);
} }
return storedData; return storedData;
} }
@Override
public IEffectData doEffectAccelerated(IBeeGenome genome, IEffectData storedData, IBeeHousing housing, float did) {
storedData.setInteger(0, 0);
World world = housing.getWorld();
ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
int range =
Math.max((int) Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f)), 1);
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
int idid = (int) did;
List<INode> nodes = new ArrayList<>(idid);
Collections.shuffle(chunks);
for (Chunk chunk : chunks) {
List<INode> l = NodeHelper.findNodesInChunkWithinRange(chunk, coords.posX, coords.posY, coords.posZ, range);
nodes.addAll(l);
idid -= l.size();
if (idid <= 0) {
while (idid < 0) {
nodes.remove(0);
idid++;
}
break;
}
}
if (nodes.isEmpty()) return storedData;
did /= (float) nodes.size();
if (did < 1f) did = 1f;
for (INode node : nodes) {
AspectList aspectsBase = node.getAspectsBase();
int randBase = Math.max(aspectsBase.visSize(), 1);
if (world.rand.nextInt(randBase) < 120) {
Aspect aspectToAdd;
int rollAttempts = 0;
do {
aspectToAdd = getWeightedRandomAspect(world.rand);
++rollAttempts;
} while (aspectsBase.getAmount(aspectToAdd) > (Config.thaumcraftNodeMaxSize - 1) && rollAttempts < 20);
if (20 <= rollAttempts) {
continue;
}
short amount = (short) ((int) did + world.rand.nextInt((int) (2f * did)));
aspectsBase.add(aspectToAdd, amount);
node.getAspects().add(aspectToAdd, amount);
updateNode(node, world);
}
}
return storedData;
}
} }
@@ -1,7 +1,10 @@
package magicbees.bees.allele.effect; package magicbees.bees.allele.effect;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData;
import java.util.List; import java.util.List;
import magicbees.bees.AlleleEffect; import magicbees.bees.AlleleEffect;
import magicbees.bees.BeeManager; import magicbees.bees.BeeManager;
import magicbees.main.utils.BlockUtil; import magicbees.main.utils.BlockUtil;
@@ -10,41 +13,37 @@ import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
import thaumcraft.api.nodes.NodeType; import thaumcraft.api.nodes.NodeType;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData;
public class AlleleEffectNodeConversion extends AlleleEffect { public class AlleleEffectNodeConversion extends AlleleEffect {
private NodeType targetType; private NodeType targetType;
public AlleleEffectNodeConversion(String id, NodeType targetNodeType, boolean isDominant, int timeout) { public AlleleEffectNodeConversion(String id, NodeType targetNodeType, boolean isDominant, int timeout) {
super(id, isDominant, timeout); super(id, isDominant, timeout);
targetType = targetNodeType; targetType = targetNodeType;
} }
@Override @Override
public IEffectData validateStorage(IEffectData storedData) { public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) { if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0); storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
} }
return storedData; return storedData;
} }
@Override @Override
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) { protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld(); World world = housing.getWorld();
ChunkCoordinates coords = housing.getCoordinates(); ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing); IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
int range = (int)Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f)); int range = (int) Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f));
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range); List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
if (NodeHelper.convertNodeInRangeToType(chunks, world, coords.posX, coords.posY, coords.posZ, range, targetType)) { if (NodeHelper.convertNodeInRangeToType(
storedData.setInteger(0, storedData.getInteger(0) - throttle); chunks, world, coords.posX, coords.posY, coords.posZ, range, targetType)) {
} storedData.setInteger(0, storedData.getInteger(0) - throttle);
}
return storedData;
}
return storedData;
}
} }
@@ -1,46 +1,44 @@
package magicbees.bees.allele.effect; package magicbees.bees.allele.effect;
import java.util.List;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import forestry.api.apiculture.IBeeGenome; import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing; import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier; import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData; import forestry.api.genetics.IEffectData;
import java.util.List;
import magicbees.bees.AlleleEffect; import magicbees.bees.AlleleEffect;
import magicbees.bees.BeeManager; import magicbees.bees.BeeManager;
import magicbees.main.utils.BlockUtil; import magicbees.main.utils.BlockUtil;
import magicbees.main.utils.compat.thaumcraft.NodeHelper; import magicbees.main.utils.compat.thaumcraft.NodeHelper;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
public class AlleleEffectNodeRepair extends AlleleEffect { public class AlleleEffectNodeRepair extends AlleleEffect {
public AlleleEffectNodeRepair(String id, boolean isDominant) { public AlleleEffectNodeRepair(String id, boolean isDominant) {
super(id, isDominant, 2); super(id, isDominant, 2);
} }
@Override @Override
public IEffectData validateStorage(IEffectData storedData) { public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) { if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0); storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
} }
return storedData; return storedData;
} }
@Override @Override
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) { protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld(); World world = housing.getWorld();
ChunkCoordinates coords = housing.getCoordinates(); ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing); IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
int range = (int)Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f)); int range = (int) Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f));
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range); List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
if (NodeHelper.repairNodeInRange(chunks, world, coords.posX, coords.posY, coords.posZ, range)) { if (NodeHelper.repairNodeInRange(chunks, world, coords.posX, coords.posY, coords.posZ, range)) {
storedData.setInteger(0, storedData.getInteger(0) - throttle); storedData.setInteger(0, storedData.getInteger(0) - throttle);
} }
return storedData;
}
return storedData;
}
} }
@@ -7,18 +7,17 @@ import magicbees.bees.AlleleEffect;
public class AlleleEffectPlaceholder extends AlleleEffect { public class AlleleEffectPlaceholder extends AlleleEffect {
public AlleleEffectPlaceholder(String id, boolean isDominant) { public AlleleEffectPlaceholder(String id, boolean isDominant) {
super(id, isDominant, 100000); super(id, isDominant, 100000);
} }
@Override @Override
public IEffectData validateStorage(IEffectData storedData) { public IEffectData validateStorage(IEffectData storedData) {
return storedData; return storedData;
} }
@Override
protected IEffectData doEffectThrottled(IBeeGenome genome,IEffectData storedData, IBeeHousing housing) {
return storedData;
}
@Override
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
return storedData;
}
} }
@@ -1,64 +1,61 @@
package magicbees.bees.allele.effect; package magicbees.bees.allele.effect;
import java.util.List;
import magicbees.bees.AlleleEffect;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import forestry.api.apiculture.BeeManager; import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.IBeeGenome; import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing; import forestry.api.apiculture.IBeeHousing;
import forestry.api.genetics.IEffectData; import forestry.api.genetics.IEffectData;
import java.util.List;
import magicbees.bees.AlleleEffect;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
public class AlleleEffectPotion extends AlleleEffect { public class AlleleEffectPotion extends AlleleEffect {
private int potionId; private int potionId;
private int duration; private int duration;
private boolean isMalicious; private boolean isMalicious;
public AlleleEffectPotion(String name, Potion potionApplied, int effectDuration, boolean isDominant) { public AlleleEffectPotion(String name, Potion potionApplied, int effectDuration, boolean isDominant) {
super(name, isDominant, 200); super(name, isDominant, 200);
this.potionId = potionApplied.id; this.potionId = potionApplied.id;
this.duration = 20 * effectDuration; this.duration = 20 * effectDuration;
this.isMalicious = false; this.isMalicious = false;
} }
public AlleleEffectPotion setMalicious() { public AlleleEffectPotion setMalicious() {
this.isMalicious = true; this.isMalicious = true;
return this; return this;
} }
@Override @Override
public IEffectData validateStorage(IEffectData storedData) { public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null) { if (storedData == null) {
storedData = new EffectData(1, 0, 0); storedData = new EffectData(1, 0, 0);
} }
return storedData; return storedData;
} }
@Override @Override
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) { public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
List<EntityLivingBase> entityList = this.getEntitiesWithinRange(genome, housing, EntityLivingBase.class); List<EntityLivingBase> entityList = this.getEntitiesWithinRange(genome, housing, EntityLivingBase.class);
for (EntityLivingBase e : entityList) { for (EntityLivingBase e : entityList) {
if (this.isMalicious) { if (this.isMalicious) {
int armorPieces = BeeManager.armorApiaristHelper.wearsItems(e, getUID(), true); int armorPieces = BeeManager.armorApiaristHelper.wearsItems(e, getUID(), true);
int finalDuration = this.duration / 4 * (4 - armorPieces); int finalDuration = this.duration / 4 * (4 - armorPieces);
if (finalDuration > 0) { if (finalDuration > 0) {
e.addPotionEffect(new PotionEffect(this.potionId, finalDuration, 0)); e.addPotionEffect(new PotionEffect(this.potionId, finalDuration, 0));
} }
} else { } else {
if (e instanceof EntityPlayer) { if (e instanceof EntityPlayer) {
e.addPotionEffect(new PotionEffect(this.potionId, this.duration, 0)); e.addPotionEffect(new PotionEffect(this.potionId, this.duration, 0));
} }
} }
} }
storedData.setInteger(0, 0); storedData.setInteger(0, 0);
return storedData; return storedData;
} }
} }
@@ -1,47 +1,45 @@
package magicbees.bees.allele.effect; package magicbees.bees.allele.effect;
import java.util.List;
import magicbees.bees.AlleleEffect;
import magicbees.bees.BeeManager;
import magicbees.main.utils.BlockUtil;
import magicbees.main.utils.compat.thaumcraft.NodeHelper;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import forestry.api.apiculture.IBeeGenome; import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing; import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier; import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData; import forestry.api.genetics.IEffectData;
import java.util.List;
import magicbees.bees.AlleleEffect;
import magicbees.bees.BeeManager;
import magicbees.main.utils.BlockUtil;
import magicbees.main.utils.compat.thaumcraft.NodeHelper;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
public class AlleleEffectRecharge extends AlleleEffect { public class AlleleEffectRecharge extends AlleleEffect {
public AlleleEffectRecharge(String id, boolean isDominant) { public AlleleEffectRecharge(String id, boolean isDominant) {
super(id, isDominant, 20); super(id, isDominant, 20);
combinable = true; combinable = true;
} }
@Override @Override
public IEffectData validateStorage(IEffectData storedData) { public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) { if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0); storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
} }
return storedData; return storedData;
} }
@Override @Override
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) { protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld(); World world = housing.getWorld();
ChunkCoordinates coords = housing.getCoordinates(); ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing); IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
int range = (int)Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f)); int range = (int) Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f));
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range); List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
if (NodeHelper.rechargeNodeInRange(chunks, world, coords.posX, coords.posY, coords.posZ, range)) { if (NodeHelper.rechargeNodeInRange(chunks, world, coords.posX, coords.posY, coords.posZ, range)) {
storedData.setInteger(0, storedData.getInteger(0) - throttle); storedData.setInteger(0, storedData.getInteger(0) - throttle);
} }
return storedData; return storedData;
} }
} }
@@ -1,10 +1,12 @@
package magicbees.bees.allele.effect; package magicbees.bees.allele.effect;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData;
import java.util.List; import java.util.List;
import magicbees.bees.AlleleEffect; import magicbees.bees.AlleleEffect;
import magicbees.bees.BeeManager; import magicbees.bees.BeeManager;
import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
@@ -12,175 +14,185 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World; import net.minecraft.world.World;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData;
public class AlleleEffectSpawnMob extends AlleleEffect { public class AlleleEffectSpawnMob extends AlleleEffect {
protected boolean aggosOnPlayer; protected boolean aggosOnPlayer;
protected boolean spawnsWhilePlayerNear; protected boolean spawnsWhilePlayerNear;
protected String alternateMob; protected String alternateMob;
protected String mobName; protected String mobName;
protected String mobSound; protected String mobSound;
protected int chanceToSpawn; protected int chanceToSpawn;
protected int maxMobsInArea; protected int maxMobsInArea;
public AlleleEffectSpawnMob(String id, boolean isDominant, String mobToSpawn) { public AlleleEffectSpawnMob(String id, boolean isDominant, String mobToSpawn) {
this(id, isDominant, mobToSpawn, null); this(id, isDominant, mobToSpawn, null);
} }
public AlleleEffectSpawnMob(String id, boolean isDominant, String mobToSpawn, String mobSoundFx) { public AlleleEffectSpawnMob(String id, boolean isDominant, String mobToSpawn, String mobSoundFx) {
super(id, isDominant, 200); super(id, isDominant, 200);
this.aggosOnPlayer = false; this.aggosOnPlayer = false;
this.mobName = mobToSpawn; this.mobName = mobToSpawn;
this.chanceToSpawn = 100; this.chanceToSpawn = 100;
this.maxMobsInArea = 6; this.maxMobsInArea = 6;
this.mobSound = mobSoundFx; this.mobSound = mobSoundFx;
} }
@Override @Override
public IEffectData validateStorage(IEffectData storedData) { public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) { if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
// Throttle; Ready to spawn // Throttle; Ready to spawn
storedData = new EffectData(1, 1, 0); storedData = new EffectData(1, 1, 0);
} }
return storedData; return storedData;
} }
@Override @Override
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) { public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
// Check if we're ready to spawn the mob. // Check if we're ready to spawn the mob.
boolean didSpawn = false; boolean didSpawn = false;
if (storedData.getBoolean(0)) { if (storedData.getBoolean(0)) {
World w = housing.getWorld(); World w = housing.getWorld();
int roll = w.rand.nextInt(100); int roll = w.rand.nextInt(100);
if (roll <= chanceToSpawn) { if (roll <= chanceToSpawn) {
if (spawnsWhilePlayerNear) { if (spawnsWhilePlayerNear) {
EntityPlayer target = findPlayerTarget(genome, housing); EntityPlayer target = findPlayerTarget(genome, housing);
// Let's spawn a mob. =D // Let's spawn a mob. =D
if (target != null) { if (target != null) {
didSpawn = spawnMob(genome, target, w, housing, false); didSpawn = spawnMob(genome, target, w, housing, false);
} else if (alternateMob != null) { } else if (alternateMob != null) {
didSpawn = spawnMob(genome, null, w, housing, true); didSpawn = spawnMob(genome, null, w, housing, true);
} }
} else { } else {
storedData.setBoolean(0, !this.spawnMob(genome, null, w, housing, true)); storedData.setBoolean(0, !this.spawnMob(genome, null, w, housing, true));
} }
} else { } else {
playMobLiveSound(genome, housing, w); playMobLiveSound(genome, housing, w);
didSpawn = true; didSpawn = true;
} }
if (didSpawn) { if (didSpawn) {
storedData.setBoolean(0, !didSpawn); storedData.setBoolean(0, !didSpawn);
storedData.setInteger(0, storedData.getInteger(0) - throttle); storedData.setInteger(0, storedData.getInteger(0) - throttle);
} }
} } else {
else { storedData.setBoolean(0, true);
storedData.setBoolean(0, true); }
}
return storedData; return storedData;
} }
private void playMobLiveSound(IBeeGenome genome, IBeeHousing housing, World w) { private void playMobLiveSound(IBeeGenome genome, IBeeHousing housing, World w) {
if (mobSound != null && w.rand.nextInt(100) < 35) { if (mobSound != null && w.rand.nextInt(100) < 35) {
ChunkCoordinates coords = housing.getCoordinates(); ChunkCoordinates coords = housing.getCoordinates();
int range = genome.getTerritory()[0]; int range = genome.getTerritory()[0];
double x = coords.posX + w.rand.nextDouble() * (range * 2) - range; double x = coords.posX + w.rand.nextDouble() * (range * 2) - range;
range = genome.getTerritory()[1]; range = genome.getTerritory()[1];
double y = coords.posY + w.rand.nextDouble() * (range * 2) - range; double y = coords.posY + w.rand.nextDouble() * (range * 2) - range;
range = genome.getTerritory()[2]; range = genome.getTerritory()[2];
double z = coords.posZ + w.rand.nextDouble() * (range * 2) - range; double z = coords.posZ + w.rand.nextDouble() * (range * 2) - range;
w.playSoundEffect(x, y, z, this.mobSound, 0.5f, (w.rand.nextFloat() - w.rand.nextFloat()) * 0.2f + 1.0f); w.playSoundEffect(x, y, z, this.mobSound, 0.5f, (w.rand.nextFloat() - w.rand.nextFloat()) * 0.2f + 1.0f);
} }
} }
private EntityPlayer findPlayerTarget(IBeeGenome genome, IBeeHousing housing) { private EntityPlayer findPlayerTarget(IBeeGenome genome, IBeeHousing housing) {
List<EntityPlayer> entities = getEntitiesWithinRange(genome, housing, EntityPlayer.class); List<EntityPlayer> entities = getEntitiesWithinRange(genome, housing, EntityPlayer.class);
for (EntityPlayer e : entities) { for (EntityPlayer e : entities) {
// Check for wearing armor & cancel // Check for wearing armor & cancel
// Full armor suit is treated as "invisible." // Full armor suit is treated as "invisible."
if (forestry.api.apiculture.BeeManager.armorApiaristHelper.wearsItems((EntityLivingBase) e, getUID(), true) < 4) { if (forestry.api.apiculture.BeeManager.armorApiaristHelper.wearsItems((EntityLivingBase) e, getUID(), true)
return e; < 4) {
} return e;
} }
return null; }
} return null;
}
protected boolean spawnMob(IBeeGenome bee, EntityPlayer player, World world, IBeeHousing housing, boolean spawnAlternate) { protected boolean spawnMob(
boolean spawnedFlag = false; IBeeGenome bee, EntityPlayer player, World world, IBeeHousing housing, boolean spawnAlternate) {
boolean spawnedFlag = false;
EntityLiving mob; EntityLiving mob;
if (spawnAlternate && alternateMob != null) { if (spawnAlternate && alternateMob != null) {
mob = (EntityLiving) EntityList.createEntityByName(alternateMob, world); mob = (EntityLiving) EntityList.createEntityByName(alternateMob, world);
} else { } else {
mob = (EntityLiving) EntityList.createEntityByName(mobName, world); mob = (EntityLiving) EntityList.createEntityByName(mobName, world);
} }
if (mob != null) { if (mob != null) {
double pos[] = this.randomMobSpawnCoords(world, bee, housing); double pos[] = this.randomMobSpawnCoords(world, bee, housing);
int entitiesCount = world.getEntitiesWithinAABB(mob.getClass(), int entitiesCount = world.getEntitiesWithinAABB(
AxisAlignedBB.getBoundingBox((int) pos[0], (int) pos[1], (int) pos[2], mob.getClass(),
(int) pos[0] + 1, (int) pos[1] + 1, (int) pos[2] + 1) AxisAlignedBB.getBoundingBox(
.expand(8.0D,4.0D, 8.0D)).size(); (int) pos[0],
(int) pos[1],
(int) pos[2],
(int) pos[0] + 1,
(int) pos[1] + 1,
(int) pos[2] + 1)
.expand(8.0D, 4.0D, 8.0D))
.size();
mob.setPositionAndRotation(pos[0], pos[1], pos[2], world.rand.nextFloat() * 360f, 0f); mob.setPositionAndRotation(pos[0], pos[1], pos[2], world.rand.nextFloat() * 360f, 0f);
if (entitiesCount < maxMobsInArea && mob.getCanSpawnHere()) { if (entitiesCount < maxMobsInArea && mob.getCanSpawnHere()) {
spawnedFlag = world.spawnEntityInWorld(mob); spawnedFlag = world.spawnEntityInWorld(mob);
if (aggosOnPlayer && player != null) { if (aggosOnPlayer && player != null) {
if (forestry.api.apiculture.BeeManager.armorApiaristHelper.wearsItems((EntityLivingBase) player, getUID(), true) < 4) { if (forestry.api.apiculture.BeeManager.armorApiaristHelper.wearsItems(
// Protect fully suited player from initial murder intent. (EntityLivingBase) player, getUID(), true)
mob.setAttackTarget(player); < 4) {
} // Protect fully suited player from initial murder intent.
} mob.setAttackTarget(player);
} }
} }
}
}
return spawnedFlag; return spawnedFlag;
} }
public AlleleEffectSpawnMob setSpawnsOnPlayerNear(String alternateMobToSpawn) { public AlleleEffectSpawnMob setSpawnsOnPlayerNear(String alternateMobToSpawn) {
spawnsWhilePlayerNear = true; spawnsWhilePlayerNear = true;
alternateMob = alternateMobToSpawn; alternateMob = alternateMobToSpawn;
return this; return this;
} }
public AlleleEffectSpawnMob setAggrosPlayerOnSpawn() { public AlleleEffectSpawnMob setAggrosPlayerOnSpawn() {
aggosOnPlayer = true; aggosOnPlayer = true;
return this; return this;
} }
public AlleleEffectSpawnMob setThrottle(int val) { public AlleleEffectSpawnMob setThrottle(int val) {
throttle = val; throttle = val;
return this; return this;
} }
public AlleleEffectSpawnMob setChanceToSpawn(int value) { public AlleleEffectSpawnMob setChanceToSpawn(int value) {
chanceToSpawn = value; chanceToSpawn = value;
return this; return this;
} }
public AlleleEffectSpawnMob setMaxMobsInSpawnZone(int value) { public AlleleEffectSpawnMob setMaxMobsInSpawnZone(int value) {
maxMobsInArea = value; maxMobsInArea = value;
return this; return this;
} }
protected double[] randomMobSpawnCoords(World world, IBeeGenome bee, IBeeHousing housing) { protected double[] randomMobSpawnCoords(World world, IBeeGenome bee, IBeeHousing housing) {
ChunkCoordinates coords = housing.getCoordinates(); ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing); IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
double pos[] = new double[3]; double pos[] = new double[3];
pos[0] = coords.posX + (world.rand.nextDouble() * (bee.getTerritory()[0] * beeModifier.getTerritoryModifier(bee, 1f)) - bee.getTerritory()[0] / 2); pos[0] = coords.posX
pos[1] = coords.posY + world.rand.nextInt(3) - 1; + (world.rand.nextDouble() * (bee.getTerritory()[0] * beeModifier.getTerritoryModifier(bee, 1f))
pos[2] = coords.posZ + (world.rand.nextDouble() * (bee.getTerritory()[2] * beeModifier.getTerritoryModifier(bee, 1f)) - bee.getTerritory()[2] / 2); - bee.getTerritory()[0] / 2);
return pos; pos[1] = coords.posY + world.rand.nextInt(3) - 1;
} pos[2] = coords.posZ
+ (world.rand.nextDouble() * (bee.getTerritory()[2] * beeModifier.getTerritoryModifier(bee, 1f))
- bee.getTerritory()[2] / 2);
return pos;
}
} }
@@ -1,87 +1,90 @@
package magicbees.bees.allele.effect; package magicbees.bees.allele.effect;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData;
import magicbees.bees.AlleleEffect; import magicbees.bees.AlleleEffect;
import magicbees.bees.BeeManager; import magicbees.bees.BeeManager;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLiving;
import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World; import net.minecraft.world.World;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData;
public class AlleleEffectSpawnMobWeighted extends AlleleEffect { public class AlleleEffectSpawnMobWeighted extends AlleleEffect {
private String[] entityNames; private String[] entityNames;
private int[] spawnChance; private int[] spawnChance;
public AlleleEffectSpawnMobWeighted(String id, boolean isDominant, int throttle, String[] mobs, int[] chance) { public AlleleEffectSpawnMobWeighted(String id, boolean isDominant, int throttle, String[] mobs, int[] chance) {
super(id, isDominant, throttle); super(id, isDominant, throttle);
if (mobs.length != chance.length) { if (mobs.length != chance.length) {
throw new IllegalArgumentException("Array lengths must be equal!"); throw new IllegalArgumentException("Array lengths must be equal!");
} }
this.entityNames = mobs; this.entityNames = mobs;
this.spawnChance = chance; this.spawnChance = chance;
} }
@Override @Override
public IEffectData validateStorage(IEffectData storedData) { public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) { if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
storedData = new EffectData(1, 0, 0); storedData = new EffectData(1, 0, 0);
} }
return storedData; return storedData;
} }
@Override @Override
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) { public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
if (this.spawnMob(genome, housing)) { if (this.spawnMob(genome, housing)) {
storedData.setInteger(0, 0); storedData.setInteger(0, 0);
} }
return storedData; return storedData;
} }
protected boolean spawnMob(IBeeGenome genome, IBeeHousing housing) { protected boolean spawnMob(IBeeGenome genome, IBeeHousing housing) {
boolean flag = false; boolean flag = false;
World w = housing.getWorld(); World w = housing.getWorld();
int roll = 0; int roll = 0;
for (int i = 0; i < this.spawnChance.length && !flag; ++i) { for (int i = 0; i < this.spawnChance.length && !flag; ++i) {
roll = 100 - w.rand.nextInt(100) + 1; roll = 100 - w.rand.nextInt(100) + 1;
if (roll < this.spawnChance[i]) { if (roll < this.spawnChance[i]) {
Entity mob = EntityList.createEntityByName(this.entityNames[i], w); Entity mob = EntityList.createEntityByName(this.entityNames[i], w);
if (mob != null) { if (mob != null) {
flag = true; flag = true;
double[] coords = this.randomMobSpawnCoords(w, genome, housing); double[] coords = this.randomMobSpawnCoords(w, genome, housing);
mob.setPositionAndRotation(coords[0], coords[1], coords[2], w.rand.nextFloat() * 360f, 0f); mob.setPositionAndRotation(coords[0], coords[1], coords[2], w.rand.nextFloat() * 360f, 0f);
if (mob instanceof EntityLiving) { if (mob instanceof EntityLiving) {
if (((EntityLiving) mob).getCanSpawnHere()) { if (((EntityLiving) mob).getCanSpawnHere()) {
w.spawnEntityInWorld(mob); w.spawnEntityInWorld(mob);
} }
} else { } else {
w.spawnEntityInWorld(mob); w.spawnEntityInWorld(mob);
} }
} }
} }
} }
return flag; return flag;
} }
protected double[] randomMobSpawnCoords(World world, IBeeGenome bee, IBeeHousing housing) { protected double[] randomMobSpawnCoords(World world, IBeeGenome bee, IBeeHousing housing) {
ChunkCoordinates coords = housing.getCoordinates(); ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing); IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
double pos[] = new double[3];
pos[0] = coords.posX + world.rand.nextDouble() * (bee.getTerritory()[0] * beeModifier.getTerritoryModifier(bee, 1f)) - bee.getTerritory()[0] / 2;
pos[1] = coords.posY + world.rand.nextDouble() * (bee.getTerritory()[1] * beeModifier.getTerritoryModifier(bee, 1f)) - bee.getTerritory()[1] / 2;
pos[2] = coords.posZ + world.rand.nextDouble() * (bee.getTerritory()[2] * beeModifier.getTerritoryModifier(bee, 1f)) - bee.getTerritory()[2] / 2;
return pos;
}
double pos[] = new double[3];
pos[0] = coords.posX
+ world.rand.nextDouble() * (bee.getTerritory()[0] * beeModifier.getTerritoryModifier(bee, 1f))
- bee.getTerritory()[0] / 2;
pos[1] = coords.posY
+ world.rand.nextDouble() * (bee.getTerritory()[1] * beeModifier.getTerritoryModifier(bee, 1f))
- bee.getTerritory()[1] / 2;
pos[2] = coords.posZ
+ world.rand.nextDouble() * (bee.getTerritory()[2] * beeModifier.getTerritoryModifier(bee, 1f))
- bee.getTerritory()[2] / 2;
return pos;
}
} }
@@ -1,7 +1,9 @@
package magicbees.bees.allele.effect; package magicbees.bees.allele.effect;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import magicbees.main.utils.compat.ThaumcraftHelper; import magicbees.main.utils.compat.ThaumcraftHelper;
import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLiving;
@@ -10,68 +12,70 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World; import net.minecraft.world.World;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
public class AlleleEffectSpawnWisp extends AlleleEffectSpawnMob { public class AlleleEffectSpawnWisp extends AlleleEffectSpawnMob {
private byte[] wispTypes = { private byte[] wispTypes = {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47
21, 23, 24, 25, 26, 27, 28, 29, 30, };
31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47
};
public AlleleEffectSpawnWisp(String id, boolean isDominant, String mobToSpawn, String soundToPlay) { public AlleleEffectSpawnWisp(String id, boolean isDominant, String mobToSpawn, String soundToPlay) {
super(id, isDominant, mobToSpawn, soundToPlay); super(id, isDominant, mobToSpawn, soundToPlay);
} }
@Override @Override
protected boolean spawnMob(IBeeGenome bee, EntityPlayer player, World world, IBeeHousing housing, boolean spawnAlternate) { protected boolean spawnMob(
boolean spawnedFlag = false; IBeeGenome bee, EntityPlayer player, World world, IBeeHousing housing, boolean spawnAlternate) {
boolean spawnedFlag = false;
EntityLiving mob; EntityLiving mob;
if (spawnAlternate && this.alternateMob != null) { if (spawnAlternate && this.alternateMob != null) {
mob = (EntityLiving) EntityList.createEntityByName(this.alternateMob, world); mob = (EntityLiving) EntityList.createEntityByName(this.alternateMob, world);
} else { } else {
mob = (EntityLiving) EntityList.createEntityByName(this.mobName, world); mob = (EntityLiving) EntityList.createEntityByName(this.mobName, world);
} }
if (mob != null) { if (mob != null) {
double pos[] = this.randomMobSpawnCoords(world, bee, housing); double pos[] = this.randomMobSpawnCoords(world, bee, housing);
int entitiesCount = world.getEntitiesWithinAABB( int entitiesCount = world.getEntitiesWithinAABB(
mob.getClass(), mob.getClass(),
AxisAlignedBB.getBoundingBox((int) pos[0], (int) pos[1], (int) pos[2], (int) pos[0] + 1, (int) pos[1] + 1, (int) pos[2] + 1).expand(8.0D, AxisAlignedBB.getBoundingBox(
4.0D, 8.0D)).size(); (int) pos[0],
(int) pos[1],
(int) pos[2],
(int) pos[0] + 1,
(int) pos[1] + 1,
(int) pos[2] + 1)
.expand(8.0D, 4.0D, 8.0D))
.size();
mob.setPositionAndRotation(pos[0], pos[1], pos[2], world.rand.nextFloat() * 360f, 0f); mob.setPositionAndRotation(pos[0], pos[1], pos[2], world.rand.nextFloat() * 360f, 0f);
if (entitiesCount < this.maxMobsInArea && mob.getCanSpawnHere()) { if (entitiesCount < this.maxMobsInArea && mob.getCanSpawnHere()) {
// Try some Reflection on TC code. This could be dangerous. // Try some Reflection on TC code. This could be dangerous.
try { try {
Class<?> wispEntity = Class.forName(ThaumcraftHelper.Entity.WISP.getClassName()); Class<?> wispEntity = Class.forName(ThaumcraftHelper.Entity.WISP.getClassName());
Field type = wispEntity.getDeclaredField("type"); Field type = wispEntity.getDeclaredField("type");
type.setByte(mob, wispTypes[world.rand.nextInt(wispTypes.length)]); type.setByte(mob, wispTypes[world.rand.nextInt(wispTypes.length)]);
} catch (Exception e) { /* } catch (Exception e) {
* Last time I had a request to post /*
* error messages, I regretted it. * Last time I had a request to post
*/ * error messages, I regretted it.
} */
}
spawnedFlag = world.spawnEntityInWorld(mob); spawnedFlag = world.spawnEntityInWorld(mob);
if (this.aggosOnPlayer && player != null) { if (this.aggosOnPlayer && player != null) {
if (BeeManager.armorApiaristHelper.wearsItems((EntityLivingBase) player, getUID(), true) < 4) { if (BeeManager.armorApiaristHelper.wearsItems((EntityLivingBase) player, getUID(), true) < 4) {
// Protect fully suited player from initial murder // Protect fully suited player from initial murder
// intent. // intent.
mob.setAttackTarget(player); mob.setAttackTarget(player);
} }
} }
} }
} }
return spawnedFlag; return spawnedFlag;
} }
} }
@@ -1,55 +1,61 @@
package magicbees.bees.allele.effect; package magicbees.bees.allele.effect;
import magicbees.bees.AlleleEffect;
import magicbees.bees.BeeManager;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import forestry.api.apiculture.IBeeGenome; import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing; import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier; import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData; import forestry.api.genetics.IEffectData;
import magicbees.bees.AlleleEffect;
import magicbees.bees.BeeManager;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
public class AlleleEffectTransmuting extends AlleleEffect { public class AlleleEffectTransmuting extends AlleleEffect {
private TransmutationEffectController transmutationController; private TransmutationEffectController transmutationController;
public AlleleEffectTransmuting(String id, boolean isDominant, TransmutationEffectController effectController, int timeoutBeeTicks) { public AlleleEffectTransmuting(
super(id, isDominant, timeoutBeeTicks); String id, boolean isDominant, TransmutationEffectController effectController, int timeoutBeeTicks) {
this.transmutationController = effectController; super(id, isDominant, timeoutBeeTicks);
} this.transmutationController = effectController;
}
@Override @Override
public IEffectData validateStorage(IEffectData storedData) { public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) { if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0); storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
} }
return storedData; return storedData;
} }
@Override @Override
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) { protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld(); World world = housing.getWorld();
ChunkCoordinates coords = housing.getCoordinates(); ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing); IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
// Get random coords within territory // Get random coords within territory
int xRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]); int xRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]);
int yRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[1]); int yRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[1]);
int zRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[2]); int zRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[2]);
int xCoord = coords.posX + world.rand.nextInt(xRange) - xRange / 2; int xCoord = coords.posX + world.rand.nextInt(xRange) - xRange / 2;
int yCoord = coords.posY + world.rand.nextInt(yRange) - yRange / 2; int yCoord = coords.posY + world.rand.nextInt(yRange) - yRange / 2;
int zCoord = coords.posZ + world.rand.nextInt(zRange) - zRange / 2; int zCoord = coords.posZ + world.rand.nextInt(zRange) - zRange / 2;
BiomeGenBase biome = world.getBiomeGenForCoords(xCoord, zCoord); BiomeGenBase biome = world.getBiomeGenForCoords(xCoord, zCoord);
transmutationController.attemptTransmutations(world, biome, transmutationController.attemptTransmutations(
new ItemStack(world.getBlock(xCoord, yCoord, zCoord), 1, world.getBlockMetadata(xCoord, yCoord, zCoord)), xCoord, yCoord, zCoord); world,
biome,
new ItemStack(
world.getBlock(xCoord, yCoord, zCoord), 1, world.getBlockMetadata(xCoord, yCoord, zCoord)),
xCoord,
yCoord,
zCoord);
storedData.setInteger(0, 0); storedData.setInteger(0, 0);
return storedData; return storedData;
} }
} }
@@ -1,89 +1,70 @@
package magicbees.bees.allele.effect; package magicbees.bees.allele.effect;
import net.minecraft.nbt.NBTTagCompound;
import forestry.api.genetics.IEffectData; import forestry.api.genetics.IEffectData;
import net.minecraft.nbt.NBTTagCompound;
public class EffectData implements IEffectData public class EffectData implements IEffectData {
{ private int[] intData;
private int[] intData; private boolean[] boolData;
private boolean[] boolData; private float[] floatData;
private float[] floatData;
public EffectData(int intCount, int boolCount, int floatCount) public EffectData(int intCount, int boolCount, int floatCount) {
{ this.intData = new int[intCount];
this.intData = new int[intCount]; this.boolData = new boolean[boolCount];
this.boolData = new boolean[boolCount]; this.floatData = new float[floatCount];
this.floatData = new float[floatCount]; }
}
@Override @Override
public void readFromNBT(NBTTagCompound nbttagcompound) public void readFromNBT(NBTTagCompound nbttagcompound) {}
{
}
@Override @Override
public void writeToNBT(NBTTagCompound nbttagcompound) public void writeToNBT(NBTTagCompound nbttagcompound) {}
{
}
@Override @Override
public void setInteger(int index, int val) public void setInteger(int index, int val) {
{ if (index >= 0 && index < this.intData.length) {
if (index >= 0 && index < this.intData.length) this.intData[index] = val;
{ }
this.intData[index] = val; }
}
}
@Override @Override
public void setFloat(int index, float val) public void setFloat(int index, float val) {
{ if (index >= 0 && index < this.floatData.length) {
if (index >= 0 && index < this.floatData.length) this.floatData[index] = val;
{ }
this.floatData[index] = val; }
}
}
@Override @Override
public void setBoolean(int index, boolean val) public void setBoolean(int index, boolean val) {
{ if (index >= 0 && index < this.boolData.length) {
if (index >= 0 && index < this.boolData.length) this.boolData[index] = val;
{ }
this.boolData[index] = val; }
}
}
@Override @Override
public int getInteger(int index) public int getInteger(int index) {
{ int val = 0;
int val = 0; if (index >= 0 && index < this.intData.length) {
if (index >= 0 && index < this.intData.length) val = this.intData[index];
{ }
val = this.intData[index]; return val;
} }
return val;
}
@Override @Override
public float getFloat(int index) public float getFloat(int index) {
{ float val = 0f;
float val = 0f; if (index >= 0 && index < this.floatData.length) {
if (index >= 0 && index < this.floatData.length) val = this.floatData[index];
{ }
val = this.floatData[index]; return val;
} }
return val;
}
@Override
public boolean getBoolean(int index)
{
boolean val = false;
if (index >= 0 && index < this.boolData.length)
{
val = this.boolData[index];
}
return val;
}
@Override
public boolean getBoolean(int index) {
boolean val = false;
if (index >= 0 && index < this.boolData.length) {
val = this.boolData[index];
}
return val;
}
} }
@@ -3,7 +3,6 @@ package magicbees.bees.allele.effect;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import magicbees.api.bees.ITransmutationEffectController; import magicbees.api.bees.ITransmutationEffectController;
import magicbees.api.bees.ITransmutationEffectLogic; import magicbees.api.bees.ITransmutationEffectLogic;
import magicbees.main.utils.LogHelper; import magicbees.main.utils.LogHelper;
@@ -12,35 +11,35 @@ import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
public class TransmutationEffectController implements ITransmutationEffectController { public class TransmutationEffectController implements ITransmutationEffectController {
private List<ITransmutationEffectLogic> logicObjects; private List<ITransmutationEffectLogic> logicObjects;
public TransmutationEffectController(ITransmutationEffectLogic... effectLogic) { public TransmutationEffectController(ITransmutationEffectLogic... effectLogic) {
logicObjects = new ArrayList<ITransmutationEffectLogic>(); logicObjects = new ArrayList<ITransmutationEffectLogic>();
for (ITransmutationEffectLogic logic : effectLogic) { for (ITransmutationEffectLogic logic : effectLogic) {
logicObjects.add(logic); logicObjects.add(logic);
} }
} }
public void attemptTransmutations(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) { public void attemptTransmutations(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
Collections.shuffle(logicObjects); Collections.shuffle(logicObjects);
for (ITransmutationEffectLogic logic : logicObjects) { for (ITransmutationEffectLogic logic : logicObjects) {
try { try {
if (logic.tryTransmutation(world, biome, sourceBlock, x, y, z)) { if (logic.tryTransmutation(world, biome, sourceBlock, x, y, z)) {
break; break;
} }
} catch (Exception e) { } catch (Exception e) {
LogHelper.warn(String.format("Magic Bees encountered an issue with an ITransmutationEffectLogic provider %s. Debug information follows.", LogHelper.warn(String.format(
logic.getClass().getName())); "Magic Bees encountered an issue with an ITransmutationEffectLogic provider %s. Debug information follows.",
LogHelper.info(e.getMessage()); logic.getClass().getName()));
} LogHelper.info(e.getMessage());
} }
} }
}
@Override
public void addEffectLogic(ITransmutationEffectLogic logic) {
if (logic != null && !logicObjects.contains(logic)) {
logicObjects.add(logic);
}
}
@Override
public void addEffectLogic(ITransmutationEffectLogic logic) {
if (logic != null && !logicObjects.contains(logic)) {
logicObjects.add(logic);
}
}
} }
@@ -9,23 +9,21 @@ import net.minecraftforge.oredict.OreDictionary;
public class TransmutationEffectLBotaniaLiving implements ITransmutationEffectLogic { public class TransmutationEffectLBotaniaLiving implements ITransmutationEffectLogic {
@Override @Override
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) { public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
int[] oreIDs = OreDictionary.getOreIDs(sourceBlock); int[] oreIDs = OreDictionary.getOreIDs(sourceBlock);
for (int oreId : oreIDs) { for (int oreId : oreIDs) {
if (oreId == OreDictionary.getOreID("logWood")) { if (oreId == OreDictionary.getOreID("logWood")) {
world.setBlock(x, y, z, BotaniaHelper.blockLivingWood); world.setBlock(x, y, z, BotaniaHelper.blockLivingWood);
return true; return true;
} } else if (oreId == OreDictionary.getOreID("stone")) {
else if (oreId == OreDictionary.getOreID("stone")) { world.setBlock(x, y, z, BotaniaHelper.blockLivingRock);
world.setBlock(x, y, z, BotaniaHelper.blockLivingRock); return true;
return true; } else if (oreId == OreDictionary.getOreID("livingwood")) {
} world.setBlock(x, y, z, BotaniaHelper.blockDreamWood);
else if (oreId == OreDictionary.getOreID("livingwood")) { return true;
world.setBlock(x, y, z, BotaniaHelper.blockDreamWood); }
return true; }
} return false;
} }
return false;
}
} }
@@ -1,8 +1,7 @@
package magicbees.bees.allele.effect; package magicbees.bees.allele.effect;
import java.util.Locale;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import java.util.Locale;
import magicbees.api.bees.ITransmutationEffectLogic; import magicbees.api.bees.ITransmutationEffectLogic;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
@@ -13,37 +12,40 @@ import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
public class TransmutationEffectRailcraft implements ITransmutationEffectLogic { public class TransmutationEffectRailcraft implements ITransmutationEffectLogic {
@Override @Override
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) { public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
boolean flag = false; boolean flag = false;
if (OreDictionary.itemMatches(new ItemStack(Blocks.stone), sourceBlock, false) if (OreDictionary.itemMatches(new ItemStack(Blocks.stone), sourceBlock, false)
|| OreDictionary.itemMatches(new ItemStack(Blocks.cobblestone), sourceBlock, false)) { || OreDictionary.itemMatches(new ItemStack(Blocks.cobblestone), sourceBlock, false)) {
flag = trySpawnQuarriedStone(world, biome, sourceBlock, x, y, z) || trySpawnAbyssalStone(world, biome, sourceBlock, x, y, z); flag = trySpawnQuarriedStone(world, biome, sourceBlock, x, y, z)
} || trySpawnAbyssalStone(world, biome, sourceBlock, x, y, z);
return flag; }
} return flag;
}
private boolean trySpawnQuarriedStone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) { private boolean trySpawnQuarriedStone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
boolean flag = false; boolean flag = false;
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FOREST) && !BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SNOWY)) { if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FOREST)
ItemStack item = GameRegistry.findItemStack("Railcraft", "cube.stone.quarried", 1); && !BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SNOWY)) {
if (item != null) { ItemStack item = GameRegistry.findItemStack("Railcraft", "cube.stone.quarried", 1);
world.setBlock(x, y, z, Block.getBlockFromItem(item.getItem()), item.getItemDamage(), 2); if (item != null) {
flag = true; world.setBlock(x, y, z, Block.getBlockFromItem(item.getItem()), item.getItemDamage(), 2);
} flag = true;
} }
return flag; }
} return flag;
}
private boolean trySpawnAbyssalStone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) { private boolean trySpawnAbyssalStone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
boolean flag = false; boolean flag = false;
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.WATER) && !biome.biomeName.toLowerCase(Locale.ENGLISH).contains("river")) { if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.WATER)
ItemStack item = GameRegistry.findItemStack("Railcraft", "cube.stone.abyssal", 1); && !biome.biomeName.toLowerCase(Locale.ENGLISH).contains("river")) {
if (item != null) { ItemStack item = GameRegistry.findItemStack("Railcraft", "cube.stone.abyssal", 1);
world.setBlock(x, y, z, Block.getBlockFromItem(item.getItem()), item.getItemDamage(), 2); if (item != null) {
flag = true; world.setBlock(x, y, z, Block.getBlockFromItem(item.getItem()), item.getItemDamage(), 2);
} flag = true;
} }
return flag; }
} return flag;
}
} }
@@ -9,17 +9,18 @@ import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
public class TransmutationEffectVanilla implements ITransmutationEffectLogic { public class TransmutationEffectVanilla implements ITransmutationEffectLogic {
@Override @Override
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) { public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
return trySpawnSandstone(world, biome, sourceBlock, x, y, z); return trySpawnSandstone(world, biome, sourceBlock, x, y, z);
} }
private boolean trySpawnSandstone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) { private boolean trySpawnSandstone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
boolean flag = false; boolean flag = false;
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SANDY) && OreDictionary.itemMatches(new ItemStack(Blocks.sand), sourceBlock, false)) { if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SANDY)
world.setBlock(x, y, z, Blocks.sandstone); && OreDictionary.itemMatches(new ItemStack(Blocks.sand), sourceBlock, false)) {
flag = true; world.setBlock(x, y, z, Blocks.sandstone);
} flag = true;
return flag; }
} return flag;
}
} }
@@ -1,31 +1,29 @@
package magicbees.bees.allele.flowerProvider; package magicbees.bees.allele.flowerProvider;
import java.util.Set;
import net.minecraft.block.Block;
import forestry.api.apiculture.FlowerManager; import forestry.api.apiculture.FlowerManager;
import forestry.api.genetics.IFlower; import forestry.api.genetics.IFlower;
import forestry.api.genetics.IFlowerGrowthRule; import forestry.api.genetics.IFlowerGrowthRule;
import forestry.api.genetics.IFlowerProvider; import forestry.api.genetics.IFlowerProvider;
import java.util.Set;
import net.minecraft.block.Block;
public abstract class FlowerProvider implements IFlowerProvider { public abstract class FlowerProvider implements IFlowerProvider {
@Override @Override
@Deprecated @Deprecated
public Set<IFlower> getFlowers() { public Set<IFlower> getFlowers() {
return FlowerManager.flowerRegistry.getAcceptableFlowers(getFlowerType()); return FlowerManager.flowerRegistry.getAcceptableFlowers(getFlowerType());
} }
protected void registerPlantableFlower(Block block, int meta, int weight) { protected void registerPlantableFlower(Block block, int meta, int weight) {
FlowerManager.flowerRegistry.registerPlantableFlower(block, meta, weight, getFlowerType()); FlowerManager.flowerRegistry.registerPlantableFlower(block, meta, weight, getFlowerType());
} }
protected void registerAcceptableFlower(Block block, int meta) { protected void registerAcceptableFlower(Block block, int meta) {
FlowerManager.flowerRegistry.registerAcceptableFlower(block, meta, getFlowerType()); FlowerManager.flowerRegistry.registerAcceptableFlower(block, meta, getFlowerType());
} }
protected void registerGrowthRule(IFlowerGrowthRule growthRule) { protected void registerGrowthRule(IFlowerGrowthRule growthRule) {
FlowerManager.flowerRegistry.registerGrowthRule(growthRule, getFlowerType()); FlowerManager.flowerRegistry.registerGrowthRule(growthRule, getFlowerType());
} }
} }
@@ -1,5 +1,10 @@
package magicbees.bees.allele.flowerProvider; package magicbees.bees.allele.flowerProvider;
import forestry.api.genetics.IFlowerGrowthHelper;
import forestry.api.genetics.IFlowerGrowthRule;
import forestry.api.genetics.IFlowerRegistry;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
import magicbees.main.utils.LocalizationManager; import magicbees.main.utils.LocalizationManager;
import magicbees.main.utils.compat.ArsMagicaHelper; import magicbees.main.utils.compat.ArsMagicaHelper;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@@ -7,87 +12,82 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import forestry.api.genetics.IFlowerGrowthHelper;
import forestry.api.genetics.IFlowerGrowthRule;
import forestry.api.genetics.IFlowerRegistry;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
public class FlowerProviderArsMagicaFlower extends FlowerProvider implements IFlowerGrowthRule { public class FlowerProviderArsMagicaFlower extends FlowerProvider implements IFlowerGrowthRule {
public FlowerProviderArsMagicaFlower() { public FlowerProviderArsMagicaFlower() {
registerPlantableFlower(ArsMagicaHelper.blackOrchid, 0, 1); registerPlantableFlower(ArsMagicaHelper.blackOrchid, 0, 1);
registerPlantableFlower(ArsMagicaHelper.desertNova, 0, 1); registerPlantableFlower(ArsMagicaHelper.desertNova, 0, 1);
registerPlantableFlower(ArsMagicaHelper.aum, 0, 1); registerPlantableFlower(ArsMagicaHelper.aum, 0, 1);
registerPlantableFlower(ArsMagicaHelper.wakebloom, 0, 1); registerPlantableFlower(ArsMagicaHelper.wakebloom, 0, 1);
registerPlantableFlower(ArsMagicaHelper.tarmaRoot, 0, 1); registerPlantableFlower(ArsMagicaHelper.tarmaRoot, 0, 1);
registerGrowthRule(this); registerGrowthRule(this);
} }
@Override @Override
public String getFlowerType() { public String getFlowerType() {
return "flowersArsMagica"; return "flowersArsMagica";
} }
@Override @Override
public String getDescription() { public String getDescription() {
return LocalizationManager.getLocalizedString("flowerProvider.arsmagica"); return LocalizationManager.getLocalizedString("flowerProvider.arsmagica");
} }
@Override @Override
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products) { public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products) {
return products; return products;
} }
@Override @Override
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) { public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
return pollinatable.getPlantType().size() > 1; return pollinatable.getPlantType().size() > 1;
} }
@Override @Override
@Deprecated @Deprecated
public boolean growFlower(World world, IIndividual genome, int x, int y, int z) { public boolean growFlower(World world, IIndividual genome, int x, int y, int z) {
return growFlower(world, x, y, z); return growFlower(world, x, y, z);
} }
@Override @Override
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) { public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
return growFlower(world, x, y, z); return growFlower(world, x, y, z);
} }
@Override @Override
@Deprecated @Deprecated
public boolean growFlower(IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) { public boolean growFlower(
return growFlower(world, x, y, z); IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) {
} return growFlower(world, x, y, z);
}
private boolean growFlower(World world, int x, int y, int z) { private boolean growFlower(World world, int x, int y, int z) {
boolean flag = false; boolean flag = false;
Block blockDown = world.getBlock(x, y - 1, z); Block blockDown = world.getBlock(x, y - 1, z);
if (world.getBlock(x, y, z).isAir(world, x, y, z)) { if (world.getBlock(x, y, z).isAir(world, x, y, z)) {
if (blockDown == Blocks.dirt || blockDown == Blocks.grass) { if (blockDown == Blocks.dirt || blockDown == Blocks.grass) {
int dart = world.rand.nextInt(100); int dart = world.rand.nextInt(100);
Block block; Block block;
if (dart > 60) { if (dart > 60) {
block = ArsMagicaHelper.blackOrchid; block = ArsMagicaHelper.blackOrchid;
} else if (dart > 30) { } else if (dart > 30) {
block = ArsMagicaHelper.aum; block = ArsMagicaHelper.aum;
} else { } else {
block = ArsMagicaHelper.tarmaRoot; block = ArsMagicaHelper.tarmaRoot;
} }
world.setBlock(x, y, z, block); world.setBlock(x, y, z, block);
flag = true; flag = true;
} else if (blockDown == Blocks.sand) { } else if (blockDown == Blocks.sand) {
world.setBlock(x, y, z, ArsMagicaHelper.desertNova); world.setBlock(x, y, z, ArsMagicaHelper.desertNova);
flag = true; flag = true;
} else if (blockDown == Blocks.stone) { } else if (blockDown == Blocks.stone) {
world.setBlock(x, y, z, ArsMagicaHelper.tarmaRoot); world.setBlock(x, y, z, ArsMagicaHelper.tarmaRoot);
flag = true; flag = true;
} else if (blockDown == Blocks.water || blockDown == Blocks.water) { } else if (blockDown == Blocks.water || blockDown == Blocks.water) {
world.setBlock(x, y, z, ArsMagicaHelper.wakebloom); world.setBlock(x, y, z, ArsMagicaHelper.wakebloom);
flag = true; flag = true;
} }
} }
return flag; return flag;
} }
} }
@@ -1,66 +1,65 @@
package magicbees.bees.allele.flowerProvider; package magicbees.bees.allele.flowerProvider;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
import magicbees.main.utils.LocalizationManager; import magicbees.main.utils.LocalizationManager;
import magicbees.main.utils.compat.ThaumcraftHelper; import magicbees.main.utils.compat.ThaumcraftHelper;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
public class FlowerProviderAuraNode extends FlowerProvider { public class FlowerProviderAuraNode extends FlowerProvider {
public FlowerProviderAuraNode() { public FlowerProviderAuraNode() {
registerAcceptableFlower(ThaumcraftHelper.airy, ThaumcraftHelper.AiryBlockType.NODE.ordinal()); registerAcceptableFlower(ThaumcraftHelper.airy, ThaumcraftHelper.AiryBlockType.NODE.ordinal());
registerAcceptableFlower(ThaumcraftHelper.airy, ThaumcraftHelper.AiryBlockType.ENERGIZED_NODE.ordinal()); registerAcceptableFlower(ThaumcraftHelper.airy, ThaumcraftHelper.AiryBlockType.ENERGIZED_NODE.ordinal());
} }
@Override @Override
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) { public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
return pollinatable.getPlantType().size() > 0; return pollinatable.getPlantType().size() > 0;
} }
@Override @Override
@Deprecated @Deprecated
public boolean growFlower(World world, IIndividual genome, int x, int y, int z) { public boolean growFlower(World world, IIndividual genome, int x, int y, int z) {
return true; return true;
} }
@Override @Override
public String getFlowerType() { public String getFlowerType() {
return "flowersThaumcraftAuraNode"; return "flowersThaumcraftAuraNode";
} }
@Override @Override
public String getDescription() { public String getDescription() {
return LocalizationManager.getLocalizedString("flowerProvider.node"); return LocalizationManager.getLocalizedString("flowerProvider.node");
} }
@Override @Override
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products) { public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products) {
return products; return products;
} }
protected ItemStack[] addItemToProducts(ItemStack[] products, ItemStack itemStack) { protected ItemStack[] addItemToProducts(ItemStack[] products, ItemStack itemStack) {
for (ItemStack stack : products) { for (ItemStack stack : products) {
if (stack.getItem() == itemStack.getItem() && stack.getItemDamage() == itemStack.getItemDamage()) { if (stack.getItem() == itemStack.getItem() && stack.getItemDamage() == itemStack.getItemDamage()) {
if (stack.stackSize < stack.getItem().getItemStackLimit(stack)) { if (stack.stackSize < stack.getItem().getItemStackLimit(stack)) {
stack.stackSize += itemStack.stackSize; stack.stackSize += itemStack.stackSize;
itemStack.stackSize = Math.max(stack.stackSize - stack.getItem().getItemStackLimit(stack), 0); itemStack.stackSize =
} Math.max(stack.stackSize - stack.getItem().getItemStackLimit(stack), 0);
} }
} }
}
if (itemStack.stackSize > 0) { if (itemStack.stackSize > 0) {
ItemStack[] newProducts = new ItemStack[products.length + 1]; ItemStack[] newProducts = new ItemStack[products.length + 1];
for (int i = 0; i < products.length; ++i) { for (int i = 0; i < products.length; ++i) {
newProducts[i] = products[i]; newProducts[i] = products[i];
} }
newProducts[products.length] = itemStack; newProducts[products.length] = itemStack;
products = newProducts; products = newProducts;
} }
return products;
}
return products;
}
} }
@@ -1,46 +1,45 @@
package magicbees.bees.allele.flowerProvider; package magicbees.bees.allele.flowerProvider;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
import java.util.EnumSet; import java.util.EnumSet;
import magicbees.main.utils.LocalizationManager; import magicbees.main.utils.LocalizationManager;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType; import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
public class FlowerProviderBookshelf extends FlowerProvider { public class FlowerProviderBookshelf extends FlowerProvider {
public FlowerProviderBookshelf() { public FlowerProviderBookshelf() {
registerAcceptableFlower(Blocks.bookshelf, OreDictionary.WILDCARD_VALUE); registerAcceptableFlower(Blocks.bookshelf, OreDictionary.WILDCARD_VALUE);
} }
@Override @Override
@Deprecated @Deprecated
public boolean growFlower(World world, IIndividual genome, int x, int i, int j) { public boolean growFlower(World world, IIndividual genome, int x, int i, int j) {
return true; return true;
} }
@Override @Override
public String getFlowerType() { public String getFlowerType() {
return "flowersBookshelf"; return "flowersBookshelf";
} }
@Override @Override
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int i, int j, ItemStack products[]) { public ItemStack[] affectProducts(World world, IIndividual genome, int x, int i, int j, ItemStack products[]) {
return products; return products;
} }
@Override @Override
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) { public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
EnumSet<EnumPlantType> types = pollinatable.getPlantType(); EnumSet<EnumPlantType> types = pollinatable.getPlantType();
return types.size() > 0 && !types.contains(EnumPlantType.Nether) && !types.contains(EnumPlantType.Water); return types.size() > 0 && !types.contains(EnumPlantType.Nether) && !types.contains(EnumPlantType.Water);
} }
@Override @Override
public String getDescription() { public String getDescription() {
return LocalizationManager.getLocalizedString("flowerProvider.book"); return LocalizationManager.getLocalizedString("flowerProvider.book");
} }
} }
@@ -1,66 +1,66 @@
package magicbees.bees.allele.flowerProvider; package magicbees.bees.allele.flowerProvider;
import magicbees.main.utils.LocalizationManager;
import magicbees.main.utils.compat.BotaniaHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import forestry.api.genetics.IFlowerGrowthHelper; import forestry.api.genetics.IFlowerGrowthHelper;
import forestry.api.genetics.IFlowerGrowthRule; import forestry.api.genetics.IFlowerGrowthRule;
import forestry.api.genetics.IFlowerRegistry; import forestry.api.genetics.IFlowerRegistry;
import forestry.api.genetics.IIndividual; import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable; import forestry.api.genetics.IPollinatable;
import magicbees.main.utils.LocalizationManager;
import magicbees.main.utils.compat.BotaniaHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
public class FlowerProviderBotania extends FlowerProvider implements IFlowerGrowthRule { public class FlowerProviderBotania extends FlowerProvider implements IFlowerGrowthRule {
public FlowerProviderBotania() { public FlowerProviderBotania() {
registerPlantableFlower(BotaniaHelper.blockMysticalFlower, OreDictionary.WILDCARD_VALUE, 1); registerPlantableFlower(BotaniaHelper.blockMysticalFlower, OreDictionary.WILDCARD_VALUE, 1);
registerGrowthRule(this); registerGrowthRule(this);
} }
@Override @Override
@Deprecated @Deprecated
public boolean growFlower(World world, IIndividual individual, int x, int y, int z) { public boolean growFlower(World world, IIndividual individual, int x, int y, int z) {
return growFlower(world, x, y, z); return growFlower(world, x, y, z);
} }
@Override @Override
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) { public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
return growFlower(world, x, y, z); return growFlower(world, x, y, z);
} }
@Override @Override
@Deprecated @Deprecated
public boolean growFlower(IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) { public boolean growFlower(
return growFlower(world, x, y, z); IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) {
} return growFlower(world, x, y, z);
}
private boolean growFlower(World world, int x, int y, int z) { private boolean growFlower(World world, int x, int y, int z) {
if (world.isAirBlock(x, y, z) && BotaniaHelper.blockMysticalFlower.canPlaceBlockAt(world, x, y, z)) { if (world.isAirBlock(x, y, z) && BotaniaHelper.blockMysticalFlower.canPlaceBlockAt(world, x, y, z)) {
world.setBlock(x, y, z, BotaniaHelper.blockMysticalFlower); world.setBlock(x, y, z, BotaniaHelper.blockMysticalFlower);
world.setBlockMetadataWithNotify(x, y, z, world.rand.nextInt(16), 2); world.setBlockMetadataWithNotify(x, y, z, world.rand.nextInt(16), 2);
} }
return false; return false;
} }
@Override @Override
public ItemStack[] affectProducts(World world, IIndividual individual, int x, int y, int z, ItemStack[] products) { public ItemStack[] affectProducts(World world, IIndividual individual, int x, int y, int z, ItemStack[] products) {
return products; return products;
} }
@Override @Override
public String getDescription() { public String getDescription() {
return LocalizationManager.getLocalizedString("flowerProvider.botania"); return LocalizationManager.getLocalizedString("flowerProvider.botania");
} }
@Override @Override
public String getFlowerType() { public String getFlowerType() {
return "flowersBotania"; return "flowersBotania";
} }
@Override @Override
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) { public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
return pollinatable.getPlantType().size() > 0; return pollinatable.getPlantType().size() > 0;
} }
} }
@@ -1,5 +1,10 @@
package magicbees.bees.allele.flowerProvider; package magicbees.bees.allele.flowerProvider;
import forestry.api.genetics.IFlowerGrowthHelper;
import forestry.api.genetics.IFlowerGrowthRule;
import forestry.api.genetics.IFlowerRegistry;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
import magicbees.main.utils.LocalizationManager; import magicbees.main.utils.LocalizationManager;
import magicbees.main.utils.compat.ThaumcraftHelper; import magicbees.main.utils.compat.ThaumcraftHelper;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@@ -7,69 +12,64 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import forestry.api.genetics.IFlowerGrowthHelper;
import forestry.api.genetics.IFlowerGrowthRule;
import forestry.api.genetics.IFlowerRegistry;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
public class FlowerProviderThaumcraftFlower extends FlowerProvider implements IFlowerGrowthRule { public class FlowerProviderThaumcraftFlower extends FlowerProvider implements IFlowerGrowthRule {
public FlowerProviderThaumcraftFlower() { public FlowerProviderThaumcraftFlower() {
registerPlantableFlower(ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.SHIMMERLEAF.ordinal(), 1); registerPlantableFlower(ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.SHIMMERLEAF.ordinal(), 1);
registerPlantableFlower(ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.CINDERPEARL.ordinal(), 1); registerPlantableFlower(ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.CINDERPEARL.ordinal(), 1);
registerGrowthRule(this); registerGrowthRule(this);
} }
@Override @Override
public String getFlowerType() { public String getFlowerType() {
return "flowersThaumcraft"; return "flowersThaumcraft";
} }
@Override @Override
public String getDescription() { public String getDescription() {
return LocalizationManager.getLocalizedString("flowerProvider.magic"); return LocalizationManager.getLocalizedString("flowerProvider.magic");
} }
@Override @Override
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products) { public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products) {
return products; return products;
} }
@Override @Override
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) { public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
return 0 < pollinatable.getPlantType().size(); return 0 < pollinatable.getPlantType().size();
} }
@Override @Override
@Deprecated @Deprecated
public boolean growFlower(World world, IIndividual genome, int x, int y, int z) { public boolean growFlower(World world, IIndividual genome, int x, int y, int z) {
return growFlower(world, x, y, z); return growFlower(world, x, y, z);
} }
@Override @Override
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) { public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
return growFlower(world, x, y, z); return growFlower(world, x, y, z);
} }
@Override @Override
@Deprecated @Deprecated
public boolean growFlower(IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) { public boolean growFlower(
return growFlower(world, x, y, z); IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) {
} return growFlower(world, x, y, z);
}
private boolean growFlower(World world, int x, int y, int z) { private boolean growFlower(World world, int x, int y, int z) {
boolean flag = false; boolean flag = false;
Block blockDown = world.getBlock(x, y - 1, z); Block blockDown = world.getBlock(x, y - 1, z);
if (world.getBlock(x, y, z).isAir(world, x, y, z)) { if (world.getBlock(x, y, z).isAir(world, x, y, z)) {
if (blockDown == Blocks.dirt || blockDown == Blocks.grass) { if (blockDown == Blocks.dirt || blockDown == Blocks.grass) {
world.setBlock(x, y, z, ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.SHIMMERLEAF.ordinal(), 2); world.setBlock(x, y, z, ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.SHIMMERLEAF.ordinal(), 2);
flag = true; flag = true;
} else if (blockDown == Blocks.sand) { } else if (blockDown == Blocks.sand) {
world.setBlock(x, y, z, ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.CINDERPEARL.ordinal(), 2); world.setBlock(x, y, z, ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.CINDERPEARL.ordinal(), 2);
flag = true; flag = true;
} }
} }
return flag; return flag;
} }
} }
@@ -18,96 +18,84 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockEffectJar extends BlockContainer public class BlockEffectJar extends BlockContainer {
{ public BlockEffectJar() {
public BlockEffectJar() super(Material.glass);
{ this.setCreativeTab(TabMagicBees.tabMagicBees);
super(Material.glass); this.setBlockName("effectJar");
this.setCreativeTab(TabMagicBees.tabMagicBees); this.setBlockBounds(0.25f, 0f, 0.25f, 0.75f, 0.81f, 0.74f);
this.setBlockName("effectJar"); this.setHardness(0.1f);
this.setBlockBounds(0.25f, 0f, 0.25f, 0.75f, 0.81f, 0.74f); this.setResistance(1.5f);
this.setHardness(0.1f); }
this.setResistance(1.5f);
}
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) public boolean onBlockActivated(
{ World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
boolean activate = false; boolean activate = false;
if (!player.isSneaking()) if (!player.isSneaking()) {
{ player.openGui(MagicBees.object, UIScreens.EFFECT_JAR.ordinal(), world, x, y, z);
player.openGui(MagicBees.object, UIScreens.EFFECT_JAR.ordinal(), world, x, y, z); activate = true;
activate = true; }
}
return activate; return activate;
} }
@Override @Override
public TileEntity createNewTileEntity(World w, int metadata) public TileEntity createNewTileEntity(World w, int metadata) {
{ return new TileEntityEffectJar();
return new TileEntityEffectJar(); }
}
@Override @Override
public boolean isOpaqueCube() public boolean isOpaqueCube() {
{ return false;
return false; }
}
@Override @Override
public boolean renderAsNormalBlock() public boolean renderAsNormalBlock() {
{ return false;
return false; }
}
@Override @Override
public int getRenderType() public int getRenderType() {
{ return CommonProxy.RenderIdEffectJar;
return CommonProxy.RenderIdEffectJar; }
}
@Override @Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
{ this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, meta); super.breakBlock(world, x, y, z, block, meta);
this.dropInventory(world, x, y, z); }
}
private void dropInventory(World world, int x, int y, int z) private void dropInventory(World world, int x, int y, int z) {
{ TileEntity e = world.getTileEntity(x, y, z);
TileEntity e = world.getTileEntity(x, y, z);
if (e != null && e instanceof TileEntityEffectJar) if (e != null && e instanceof TileEntityEffectJar) {
{ TileEntityEffectJar jar = (TileEntityEffectJar) e;
TileEntityEffectJar jar = (TileEntityEffectJar)e;
// 0 is the only droppable stack. // 0 is the only droppable stack.
ItemStack stack = jar.getStackInSlot(0); ItemStack stack = jar.getStackInSlot(0);
if (stack != null && stack.stackSize > 0) if (stack != null && stack.stackSize > 0) {
{ float pX = world.rand.nextFloat() * 0.8f + 0.1f;
float pX = world.rand.nextFloat() * 0.8f + 0.1f; float pY = world.rand.nextFloat() * 0.8f + 0.1f;
float pY = world.rand.nextFloat() * 0.8f + 0.1f; float pZ = world.rand.nextFloat() * 0.8f + 0.1f;
float pZ = world.rand.nextFloat() * 0.8f + 0.1f;
EntityItem entityItem = new EntityItem(world, x + pX, y + pY, z + pZ, stack.copy()); EntityItem entityItem = new EntityItem(world, x + pX, y + pY, z + pZ, stack.copy());
entityItem.motionX = world.rand.nextGaussian() * 0.05f; entityItem.motionX = world.rand.nextGaussian() * 0.05f;
entityItem.motionY = world.rand.nextGaussian() * 0.05f + 0.2f; entityItem.motionY = world.rand.nextGaussian() * 0.05f + 0.2f;
entityItem.motionZ = world.rand.nextGaussian() * 0.05f; entityItem.motionZ = world.rand.nextGaussian() * 0.05f;
world.spawnEntityInWorld(entityItem); world.spawnEntityInWorld(entityItem);
stack.stackSize = 0; stack.stackSize = 0;
} }
} }
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister par1IconRegister) public void registerBlockIcons(IIconRegister par1IconRegister) {
{ this.blockIcon = Blocks.glass.getIcon(0, 0);
this.blockIcon = Blocks.glass.getIcon(0, 0); }
}
} }
@@ -1,7 +1,8 @@
package magicbees.block; package magicbees.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Random; import java.util.Random;
import magicbees.main.CommonProxy; import magicbees.main.CommonProxy;
import magicbees.main.utils.TabMagicBees; import magicbees.main.utils.TabMagicBees;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@@ -12,64 +13,62 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockEnchantedEarth extends Block { public class BlockEnchantedEarth extends Block {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon top; private IIcon top;
public BlockEnchantedEarth() { public BlockEnchantedEarth() {
super(Material.ground); super(Material.ground);
setCreativeTab(TabMagicBees.tabMagicBees); setCreativeTab(TabMagicBees.tabMagicBees);
setBlockName("enchantedEarth"); setBlockName("enchantedEarth");
setBlockTextureName(CommonProxy.DOMAIN + ":enchantedEarth"); setBlockTextureName(CommonProxy.DOMAIN + ":enchantedEarth");
setTickRandomly(true); setTickRandomly(true);
setStepSound(soundTypeGravel); setStepSound(soundTypeGravel);
} }
@Override @Override
public void updateTick(World world, int x, int y, int z, Random random) { public void updateTick(World world, int x, int y, int z, Random random) {
for (int height = y + 1; height <= 256; ++height) { for (int height = y + 1; height <= 256; ++height) {
Block b = world.getBlock(x, height, z); Block b = world.getBlock(x, height, z);
if (b == this) { if (b == this) {
continue; continue;
} } else {
else { if (b.getTickRandomly()) {
if (b.getTickRandomly()) { world.scheduleBlockUpdate(x, height, z, b, 0);
world.scheduleBlockUpdate(x, height, z, b, 0); }
} break;
break; }
} }
} if (y < 256 && random.nextInt(2) == 0) {
if (y < 256 && random.nextInt(2) == 0) { int newX = x + (random.nextInt(3) - 1);
int newX = x + (random.nextInt(3) - 1); int newZ = z + (random.nextInt(3) - 1);
int newZ = z + (random.nextInt(3) - 1); int newY = y + 1;
int newY = y + 1; Block b = world.getBlock(newX, newY, newZ);
Block b = world.getBlock(newX, newY, newZ); if (b.getTickRandomly()) {
if (b.getTickRandomly()) { world.scheduleBlockUpdate(newX, newY, newZ, b, random.nextInt(5) + 1);
world.scheduleBlockUpdate(newX, newY, newZ, b, random.nextInt(5) + 1); }
} }
} }
}
@Override @Override
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) { public boolean canSustainPlant(
return true; IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
} return true;
}
@Override @Override
public IIcon getIcon(int side, int meta) { public IIcon getIcon(int side, int meta) {
if (side == 1) { if (side == 1) {
return top; return top;
} }
return super.getIcon(side, meta); return super.getIcon(side, meta);
} }
@Override @Override
public void registerBlockIcons(IIconRegister iconRegister) { public void registerBlockIcons(IIconRegister iconRegister) {
top = iconRegister.registerIcon(textureName + "_top"); top = iconRegister.registerIcon(textureName + "_top");
super.registerBlockIcons(iconRegister); super.registerBlockIcons(iconRegister);
} }
} }
+67 -84
View File
@@ -1,10 +1,10 @@
package magicbees.block; package magicbees.block;
import java.util.ArrayList;
import java.util.List;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.core.Tabs;
import java.util.ArrayList;
import java.util.List;
import magicbees.block.types.HiveType; import magicbees.block.types.HiveType;
import magicbees.main.Config; import magicbees.main.Config;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@@ -17,97 +17,80 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import forestry.api.core.Tabs;
public class BlockHive extends Block public class BlockHive extends Block {
{ public BlockHive() {
public BlockHive() super(new MaterialHive());
{ this.setLightLevel(0.8f);
super(new MaterialHive()); setHardness(1f);
this.setLightLevel(0.8f); setCreativeTab(Tabs.tabApiculture);
setHardness(1f); setBlockName("hive");
setCreativeTab(Tabs.tabApiculture); }
setBlockName("hive");
}
@Override @Override
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
{ return false;
return false; }
}
@Override @Override
public int damageDropped(int meta) public int damageDropped(int meta) {
{ return meta;
return meta; }
}
@Override @Override
public int getLightValue(IBlockAccess world, int x, int y, int z) public int getLightValue(IBlockAccess world, int x, int y, int z) {
{ int meta = world.getBlockMetadata(x, y, z);
int meta = world.getBlockMetadata(x, y, z); if (meta < 0 || meta > HiveType.values().length) {
if (meta < 0 || meta > HiveType.values().length) meta = 0;
{ }
meta = 0; return HiveType.getHiveFromMeta(meta).getLightValue();
} }
return HiveType.getHiveFromMeta(meta).getLightValue();
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({"rawtypes", "unchecked"})
@Override @Override
public void getSubBlocks(Item item, CreativeTabs tab, List itemsList) public void getSubBlocks(Item item, CreativeTabs tab, List itemsList) {
{ // Java bitches about raw types & types not being checked. Sorry, but the API sucks.
// Java bitches about raw types & types not being checked. Sorry, but the API sucks. for (HiveType type : HiveType.values()) {
for (HiveType type : HiveType.values()) if (type.show || Config.forestryDebugEnabled) {
{ itemsList.add(new ItemStack(this, 1, type.ordinal()));
if (type.show || Config.forestryDebugEnabled) }
{ }
itemsList.add(new ItemStack(this, 1, type.ordinal())); }
}
}
}
@Override @Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
{ return HiveType.getHiveFromMeta(metadata).getDrops(world, x, y, z, fortune);
return HiveType.getHiveFromMeta(metadata).getDrops(world, x, y, z, fortune); }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register) public void registerBlockIcons(IIconRegister register) {
{ HiveType.registerIcons(register);
HiveType.registerIcons(register); }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) public IIcon getIcon(int side, int meta) {
{ if (meta < 0 || meta > HiveType.values().length) {
if (meta < 0 || meta > HiveType.values().length) meta = 0;
{ }
meta = 0; return HiveType.getHiveFromMeta(meta).getIconForSide(side);
} }
return HiveType.getHiveFromMeta(meta).getIconForSide(side);
}
@Override @Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
{ Block block = world.getBlock(x, y, z);
Block block = world.getBlock(x, y, z);
if (block.isAir(world, x, y, z)) if (block.isAir(world, x, y, z)) {
{ return null;
return null; }
}
Item item = Item.getItemFromBlock(block); Item item = Item.getItemFromBlock(block);
if (item == null) if (item == null) {
{ return null;
return null; }
}
return new ItemStack(item, 1, getDamageValue(world, x, y, z) & 7); return new ItemStack(item, 1, getDamageValue(world, x, y, z) & 7);
} }
} }
@@ -1,5 +1,7 @@
package magicbees.block; package magicbees.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import magicbees.client.gui.UIScreens; import magicbees.client.gui.UIScreens;
import magicbees.main.CommonProxy; import magicbees.main.CommonProxy;
import magicbees.main.MagicBees; import magicbees.main.MagicBees;
@@ -16,16 +18,12 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockMagicApiary extends BlockContainer public class BlockMagicApiary extends BlockContainer {
{
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon[] icons; private IIcon[] icons;
public BlockMagicApiary() public BlockMagicApiary() {
{
super(Material.wood); super(Material.wood);
this.setCreativeTab(TabMagicBees.tabMagicBees); this.setCreativeTab(TabMagicBees.tabMagicBees);
this.setBlockName("magicApiary"); this.setBlockName("magicApiary");
@@ -35,12 +33,11 @@ public class BlockMagicApiary extends BlockContainer
} }
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9 ) public boolean onBlockActivated(
{ World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
boolean activate = false; boolean activate = false;
if (!player.isSneaking()) if (!player.isSneaking()) {
{
player.openGui(MagicBees.object, UIScreens.THAUMIC_APIARY.ordinal(), world, x, y, z); player.openGui(MagicBees.object, UIScreens.THAUMIC_APIARY.ordinal(), world, x, y, z);
activate = true; activate = true;
} }
@@ -50,23 +47,22 @@ public class BlockMagicApiary extends BlockContainer
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta){ public IIcon getIcon(int side, int meta) {
if (side == 0){ if (side == 0) {
return icons[0]; return icons[0];
}else if (side == 1){ } else if (side == 1) {
return icons[1]; return icons[1];
}else if (side == 2 || side == 3){ } else if (side == 2 || side == 3) {
return icons[2]; return icons[2];
}else{ } else {
return icons[3]; return icons[3];
} }
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register) public void registerBlockIcons(IIconRegister register) {
{
icons = new IIcon[4]; icons = new IIcon[4];
icons[0] = register.registerIcon(CommonProxy.DOMAIN + ":thaumicapiary.0"); icons[0] = register.registerIcon(CommonProxy.DOMAIN + ":thaumicapiary.0");
@@ -81,15 +77,15 @@ public class BlockMagicApiary extends BlockContainer
} }
@Override @Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta){ public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
TileEntity te = world.getTileEntity(x, y, z); TileEntity te = world.getTileEntity(x, y, z);
if (te != null && te instanceof IInventory){ if (te != null && te instanceof IInventory) {
IInventory inventory = (IInventory)te; IInventory inventory = (IInventory) te;
for (int i = 0; i < inventory.getSizeInventory(); i++){ for (int i = 0; i < inventory.getSizeInventory(); i++) {
ItemStack itemStack = inventory.getStackInSlotOnClosing(i); ItemStack itemStack = inventory.getStackInSlotOnClosing(i);
if (itemStack != null){ if (itemStack != null) {
float spawnX = x + world.rand.nextFloat(); float spawnX = x + world.rand.nextFloat();
float spawnY = y + world.rand.nextFloat(); float spawnY = y + world.rand.nextFloat();
float spawnZ = z + world.rand.nextFloat(); float spawnZ = z + world.rand.nextFloat();
@@ -1,5 +1,7 @@
package magicbees.block; package magicbees.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import magicbees.main.CommonProxy; import magicbees.main.CommonProxy;
import magicbees.main.utils.TabMagicBees; import magicbees.main.utils.TabMagicBees;
import magicbees.tileentity.TileEntityManaAuraProvider; import magicbees.tileentity.TileEntityManaAuraProvider;
@@ -10,39 +12,35 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockManaAuraProvider extends Block implements ITileEntityProvider { public class BlockManaAuraProvider extends Block implements ITileEntityProvider {
@SideOnly(Side.CLIENT)
private IIcon topIcon;
public BlockManaAuraProvider() {
super(Material.rock);
this.setCreativeTab(TabMagicBees.tabMagicBees);
this.setBlockName("manaAuraProvider");
this.setHardness(2f);
this.setResistance(3f);
this.setHarvestLevel("pickaxe", 0);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityManaAuraProvider();
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.blockIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":manaApiaryBooster0");
this.topIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":manaApiaryBooster1");
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) private IIcon topIcon;
{
return (side == 0 || side == 1) ? this.topIcon : this.blockIcon; public BlockManaAuraProvider() {
super(Material.rock);
this.setCreativeTab(TabMagicBees.tabMagicBees);
this.setBlockName("manaAuraProvider");
this.setHardness(2f);
this.setResistance(3f);
this.setHarvestLevel("pickaxe", 0);
} }
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityManaAuraProvider();
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.blockIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":manaApiaryBooster0");
this.topIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":manaApiaryBooster1");
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
return (side == 0 || side == 1) ? this.topIcon : this.blockIcon;
}
} }
@@ -1,5 +1,7 @@
package magicbees.block; package magicbees.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import magicbees.main.CommonProxy; import magicbees.main.CommonProxy;
import magicbees.main.utils.TabMagicBees; import magicbees.main.utils.TabMagicBees;
import magicbees.tileentity.TileEntityVisAuraProvider; import magicbees.tileentity.TileEntityVisAuraProvider;
@@ -9,41 +11,36 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockVisAuraProvider extends BlockContainer { public class BlockVisAuraProvider extends BlockContainer {
public BlockVisAuraProvider() { public BlockVisAuraProvider() {
super(Material.glass); super(Material.glass);
this.setCreativeTab(TabMagicBees.tabMagicBees); this.setCreativeTab(TabMagicBees.tabMagicBees);
this.setBlockName("visAuraProvider"); this.setBlockName("visAuraProvider");
this.setHardness(0.5f); this.setHardness(0.5f);
this.setResistance(1.5f); this.setResistance(1.5f);
this.setLightLevel(8); this.setLightLevel(8);
} }
@Override @Override
public boolean isOpaqueCube() public boolean isOpaqueCube() {
{ return false;
return false; }
}
@Override @Override
public TileEntity createNewTileEntity(World world, int metadata) { public TileEntity createNewTileEntity(World world, int metadata) {
return new TileEntityVisAuraProvider(); return new TileEntityVisAuraProvider();
} }
@Override @Override
public int getRenderType() public int getRenderType() {
{ return CommonProxy.RenderIdVisAuraProvider;
return CommonProxy.RenderIdVisAuraProvider; }
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.blockIcon = Blocks.planks.getIcon(0, 5);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.blockIcon = Blocks.planks.getIcon(0, 5);
}
} }
@@ -3,14 +3,11 @@ package magicbees.block;
import net.minecraft.block.material.MapColor; import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
public class MaterialHive extends Material public class MaterialHive extends Material {
{
public MaterialHive()
{
super(MapColor.stoneColor);
this.setImmovableMobility();
this.setRequiresTool();
}
public MaterialHive() {
super(MapColor.stoneColor);
this.setImmovableMobility();
this.setRequiresTool();
}
} }
+123 -141
View File
@@ -1,7 +1,10 @@
package magicbees.block.types; package magicbees.block.types;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.apiculture.IHiveDrop;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import magicbees.bees.BeeGenomeManager; import magicbees.bees.BeeGenomeManager;
import magicbees.bees.BeeSpecies; import magicbees.bees.BeeSpecies;
import magicbees.bees.HiveDrop; import magicbees.bees.HiveDrop;
@@ -14,175 +17,154 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.apiculture.IHiveDrop;
public enum HiveType public enum HiveType {
{ CURIOUS("curious", BeeSpecies.MYSTICAL, 12, true),
CURIOUS("curious", BeeSpecies.MYSTICAL, 12, true), UNUSUAL("unusual", BeeSpecies.UNUSUAL, 12, true),
UNUSUAL("unusual", BeeSpecies.UNUSUAL, 12, true), RESONANT("resonant", BeeSpecies.SORCEROUS, 12, true),
RESONANT("resonant", BeeSpecies.SORCEROUS, 12, true), DEEP("deep", BeeSpecies.ATTUNED, 4, false),
DEEP("deep", BeeSpecies.ATTUNED, 4, false), INFERNAL("infernal", BeeSpecies.INFERNAL, 15, false),
INFERNAL("infernal", BeeSpecies.INFERNAL, 15, false), OBLIVION("oblivion", BeeSpecies.OBLIVION, 7, false),
OBLIVION("oblivion", BeeSpecies.OBLIVION, 7, false), ;
;
private static String[] nameList; private static String[] nameList;
private String name; private String name;
private BeeSpecies occupant; private BeeSpecies occupant;
public boolean show; public boolean show;
private int lightLevel; private int lightLevel;
private ArrayList<IHiveDrop> drops; private ArrayList<IHiveDrop> drops;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon[] icons; private IIcon[] icons;
public static HiveType getHiveFromMeta(int meta) public static HiveType getHiveFromMeta(int meta) {
{ HiveType type = CURIOUS;
HiveType type = CURIOUS;
if (meta > 0 && meta < HiveType.values().length) if (meta > 0 && meta < HiveType.values().length) {
{ type = HiveType.values()[meta];
type = HiveType.values()[meta]; }
}
return type; return type;
} }
public static void initHiveData() public static void initHiveData() {
{ ItemStack[] combs = new ItemStack[] {Config.combs.getStackForType(CombType.MUNDANE)};
ItemStack[] combs = new ItemStack[] { Config.combs.getStackForType(CombType.MUNDANE) }; HiveDrop valiantDrop = new HiveDrop(
HiveDrop valiantDrop = new HiveDrop(BeeGenomeManager.addRainResist(ForestryHelper.getTemplateForestryForSpecies("Valiant")), combs, 5); BeeGenomeManager.addRainResist(ForestryHelper.getTemplateForestryForSpecies("Valiant")), combs, 5);
CURIOUS.drops.add(new HiveDrop(BeeSpecies.MYSTICAL.getGenome(), combs, 80).setIgnoblePercentage(0.7f)); CURIOUS.drops.add(new HiveDrop(BeeSpecies.MYSTICAL.getGenome(), combs, 80).setIgnoblePercentage(0.7f));
CURIOUS.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.MYSTICAL.getGenome()), combs, 15)); CURIOUS.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.MYSTICAL.getGenome()), combs, 15));
CURIOUS.drops.add(valiantDrop); CURIOUS.drops.add(valiantDrop);
UNUSUAL.drops.add(new HiveDrop(BeeSpecies.UNUSUAL.getGenome(), combs, 80).setIgnoblePercentage(0.7f)); UNUSUAL.drops.add(new HiveDrop(BeeSpecies.UNUSUAL.getGenome(), combs, 80).setIgnoblePercentage(0.7f));
UNUSUAL.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.UNUSUAL.getGenome()), combs, 15)); UNUSUAL.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.UNUSUAL.getGenome()), combs, 15));
UNUSUAL.drops.add(valiantDrop); UNUSUAL.drops.add(valiantDrop);
RESONANT.drops.add(new HiveDrop(BeeSpecies.SORCEROUS.getGenome(), combs, 80).setIgnoblePercentage(0.7f)); RESONANT.drops.add(new HiveDrop(BeeSpecies.SORCEROUS.getGenome(), combs, 80).setIgnoblePercentage(0.7f));
RESONANT.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.SORCEROUS.getGenome()), combs, 20)); RESONANT.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.SORCEROUS.getGenome()), combs, 20));
RESONANT.drops.add(valiantDrop); RESONANT.drops.add(valiantDrop);
DEEP.drops.add(new HiveDrop(BeeSpecies.ATTUNED.getGenome(), combs, 80).setIgnoblePercentage(0.65f)); DEEP.drops.add(new HiveDrop(BeeSpecies.ATTUNED.getGenome(), combs, 80).setIgnoblePercentage(0.65f));
DEEP.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.ATTUNED.getGenome()), combs, 20)); DEEP.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.ATTUNED.getGenome()), combs, 20));
DEEP.drops.add(valiantDrop); DEEP.drops.add(valiantDrop);
combs = new ItemStack[] { Config.combs.getStackForType(CombType.MOLTEN), new ItemStack(Items.glowstone_dust, 6) }; combs = new ItemStack[] {Config.combs.getStackForType(CombType.MOLTEN), new ItemStack(Items.glowstone_dust, 6)};
INFERNAL.drops.add(new HiveDrop(BeeSpecies.INFERNAL.getGenome(), combs, 80).setIgnoblePercentage(0.5f)); INFERNAL.drops.add(new HiveDrop(BeeSpecies.INFERNAL.getGenome(), combs, 80).setIgnoblePercentage(0.5f));
INFERNAL.drops.add(new HiveDrop(ForestryHelper.getTemplateForestryForSpecies("Steadfast"), combs, 3)); INFERNAL.drops.add(new HiveDrop(ForestryHelper.getTemplateForestryForSpecies("Steadfast"), combs, 3));
combs = new ItemStack[] { Config.combs.getStackForType(CombType.FORGOTTEN), new ItemStack(Items.ender_pearl, 1) }; combs = new ItemStack[] {Config.combs.getStackForType(CombType.FORGOTTEN), new ItemStack(Items.ender_pearl, 1)};
OBLIVION.drops.add(new HiveDrop(BeeSpecies.OBLIVION.getGenome(), combs, 80)); OBLIVION.drops.add(new HiveDrop(BeeSpecies.OBLIVION.getGenome(), combs, 80));
OBLIVION.drops.add(new HiveDrop(ForestryHelper.getTemplateForestryForSpecies("Steadfast"), combs, 9)); OBLIVION.drops.add(new HiveDrop(ForestryHelper.getTemplateForestryForSpecies("Steadfast"), combs, 9));
} }
private HiveType(String hiveName, BeeSpecies occupant, int light, boolean visible) private HiveType(String hiveName, BeeSpecies occupant, int light, boolean visible) {
{ this.name = hiveName;
this.name = hiveName; this.occupant = occupant;
this.occupant = occupant; this.lightLevel = light;
this.lightLevel = light; this.show = visible;
this.show = visible; this.drops = new ArrayList<IHiveDrop>();
this.drops = new ArrayList<IHiveDrop>(); }
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public static void registerIcons(IIconRegister register) public static void registerIcons(IIconRegister register) {
{ for (HiveType type : HiveType.values()) {
for (HiveType type : HiveType.values()) type.icons = new IIcon[2];
{
type.icons = new IIcon[2];
type.icons[0] = register.registerIcon(CommonProxy.DOMAIN + ":beehive." + type.ordinal() + ".top"); type.icons[0] = register.registerIcon(CommonProxy.DOMAIN + ":beehive." + type.ordinal() + ".top");
type.icons[1] = register.registerIcon(CommonProxy.DOMAIN + ":beehive." + type.ordinal() + ".side"); type.icons[1] = register.registerIcon(CommonProxy.DOMAIN + ":beehive." + type.ordinal() + ".side");
} }
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIconForSide(int side) public IIcon getIconForSide(int side) {
{ IIcon i = this.icons[0];
IIcon i = this.icons[0];
if (side != 0 && side != 1) if (side != 0 && side != 1) {
{ i = this.icons[1];
i = this.icons[1]; }
}
return i; return i;
} }
public int getLightValue() public int getLightValue() {
{ return this.lightLevel;
return this.lightLevel; }
}
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int fortune) public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int fortune) {
{ ArrayList<ItemStack> hiveDrops = new ArrayList<ItemStack>();
ArrayList<ItemStack> hiveDrops = new ArrayList<ItemStack>(); int dart;
int dart;
// Get a princess. Collections.shuffle(this.drops);
int throttle = 0;
while (hiveDrops.size() <= 0 && throttle < 10)
{
++throttle;
dart = world.rand.nextInt(100);
for (IHiveDrop drop : drops)
{
if (dart <= drop.getChance(world, x, y, z))
{
hiveDrops.add(drop.getPrincess(world, x, y, z, fortune));
break;
}
}
}
// Get a drone, maybe. // Get a princess.
dart = world.rand.nextInt(100); int throttle = 0;
for (IHiveDrop drop : drops) while (hiveDrops.size() <= 0 && throttle < 10) {
{ ++throttle;
if (dart <= drop.getChance(world, x, y, z)) for (IHiveDrop drop : drops) {
{ dart = world.rand.nextInt(100);
hiveDrops.addAll(drop.getDrones(world, x, y, z, fortune)); if (dart <= drop.getChance(world, x, y, z)) {
break; hiveDrops.add(drop.getPrincess(world, x, y, z, fortune));
} break;
} }
}
}
// Get additional drops. // Get a drone, maybe.
dart = world.rand.nextInt(100); for (IHiveDrop drop : drops) {
for (IHiveDrop drop : drops) dart = world.rand.nextInt(100);
{ if (dart <= drop.getChance(world, x, y, z)) {
if (dart <= drop.getChance(world, x, y, z)) hiveDrops.addAll(drop.getDrones(world, x, y, z, fortune));
{ break;
hiveDrops.addAll(drop.getAdditional(world, x, y, z, fortune)); }
} }
}
return hiveDrops; // Get additional drops.
} for (IHiveDrop drop : drops) {
dart = world.rand.nextInt(100);
if (dart <= drop.getChance(world, x, y, z)) {
hiveDrops.addAll(drop.getAdditional(world, x, y, z, fortune));
}
}
public static String[] getAllNames() return hiveDrops;
{ }
return (nameList == null) ? nameList = generateNames() : nameList;
}
public BeeSpecies getOccupant() { public static String[] getAllNames() {
return this.occupant; return (nameList == null) ? nameList = generateNames() : nameList;
} }
private static String[] generateNames() public BeeSpecies getOccupant() {
{ return this.occupant;
String[] names = new String[values().length]; }
for (int i = 0; i < names.length; ++i)
{ private static String[] generateNames() {
names[i] = values()[i].name; String[] names = new String[values().length];
} for (int i = 0; i < names.length; ++i) {
return names; names[i] = values()[i].name;
} }
return names;
}
} }
@@ -1,45 +1,38 @@
package magicbees.block.types; package magicbees.block.types;
public enum PlankType public enum PlankType {
{ GREATWOOD("greatwood", 48),
GREATWOOD("greatwood", 48), SILVERWOOD("silverwood", 49),
SILVERWOOD("silverwood", 49), ;
;
public String name; public String name;
public int textureIdx; public int textureIdx;
private static String[] nameList; private static String[] nameList;
private PlankType(String n, int idx) private PlankType(String n, int idx) {
{ this.name = n;
this.name = n; this.textureIdx = idx;
this.textureIdx = idx; }
}
public static PlankType getType(int meta) public static PlankType getType(int meta) {
{ PlankType type = null;
PlankType type = null;
if (meta >= 0 && meta <= values().length) if (meta >= 0 && meta <= values().length) {
{ type = values()[meta];
type = values()[meta]; }
}
return type; return type;
} }
public static String[] getAllNames() public static String[] getAllNames() {
{ return (nameList == null) ? nameList = generateNames() : nameList;
return (nameList == null) ? nameList = generateNames() : nameList; }
}
private static String[] generateNames() private static String[] generateNames() {
{ String[] names = new String[values().length];
String[] names = new String[values().length]; for (int i = 0; i < names.length; ++i) {
for (int i = 0; i < names.length; ++i) names[i] = values()[i].name;
{ }
names[i] = values()[i].name; return names;
} }
return names;
}
} }
@@ -10,113 +10,91 @@ import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class ContainerEffectJar extends Container public class ContainerEffectJar extends Container {
{ public TileEntityEffectJar jar;
public TileEntityEffectJar jar;
public int lastBeeHealth = 0; public int lastBeeHealth = 0;
public int speciesColour = 0xffffff; public int speciesColour = 0xffffff;
public ContainerEffectJar(TileEntityEffectJar tileEntityEffectJar, EntityPlayer player) public ContainerEffectJar(TileEntityEffectJar tileEntityEffectJar, EntityPlayer player) {
{ this.jar = tileEntityEffectJar;
this.jar = tileEntityEffectJar; this.addSlotToContainer(
this.addSlotToContainer(new SlotCustomItems(this.jar, 0, 80, 22, GameRegistry.findItemStack("Forestry", "beeDroneGE", 1))); new SlotCustomItems(this.jar, 0, 80, 22, GameRegistry.findItemStack("Forestry", "beeDroneGE", 1)));
for (int i = 0; i < 3; ++i) for (int i = 0; i < 3; ++i) {
{ for (int j = 0; j < 9; ++j) {
for (int j = 0; j < 9; ++j) this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 74 + i * 18));
{ }
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 74 + i * 18)); }
}
}
for (int i = 0; i < 9; ++i) for (int i = 0; i < 9; ++i) {
{ this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 132));
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 132)); }
} }
}
@Override @Override
public void addCraftingToCrafters(ICrafting crafting) public void addCraftingToCrafters(ICrafting crafting) {
{ super.addCraftingToCrafters(crafting);
super.addCraftingToCrafters(crafting);
crafting.sendProgressBarUpdate(this, 0, this.jar.currentBeeHealth); crafting.sendProgressBarUpdate(this, 0, this.jar.currentBeeHealth);
crafting.sendProgressBarUpdate(this, 1, this.jar.currentBeeColour); crafting.sendProgressBarUpdate(this, 1, this.jar.currentBeeColour);
} }
@Override @Override
public void detectAndSendChanges() public void detectAndSendChanges() {
{ super.detectAndSendChanges();
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); ++i) for (int i = 0; i < this.crafters.size(); ++i) {
{ ICrafting crafting = (ICrafting) this.crafters.get(i);
ICrafting crafting = (ICrafting)this.crafters.get(i);
if (this.lastBeeHealth != this.jar.currentBeeHealth) if (this.lastBeeHealth != this.jar.currentBeeHealth) {
{ crafting.sendProgressBarUpdate(this, 0, this.jar.currentBeeHealth);
crafting.sendProgressBarUpdate(this, 0, this.jar.currentBeeHealth); this.lastBeeHealth = this.jar.currentBeeHealth;
this.lastBeeHealth = this.jar.currentBeeHealth; }
} if (this.speciesColour != this.jar.currentBeeColour) {
if (this.speciesColour != this.jar.currentBeeColour) crafting.sendProgressBarUpdate(this, 1, this.jar.currentBeeColour);
{ this.speciesColour = this.jar.currentBeeColour;
crafting.sendProgressBarUpdate(this, 1, this.jar.currentBeeColour); }
this.speciesColour = this.jar.currentBeeColour; }
} }
}
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void updateProgressBar(int craftingId, int value) public void updateProgressBar(int craftingId, int value) {
{ if (craftingId == 0) {
if (craftingId == 0) this.jar.currentBeeHealth = value;
{ } else if (craftingId == 1) {
this.jar.currentBeeHealth = value; this.jar.currentBeeColour = value;
} }
else if (craftingId == 1) }
{
this.jar.currentBeeColour = value;
}
}
@Override @Override
public boolean canInteractWith(EntityPlayer entityplayer) public boolean canInteractWith(EntityPlayer entityplayer) {
{ return this.jar.isUseableByPlayer(entityplayer);
return this.jar.isUseableByPlayer(entityplayer); }
}
@Override @Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot) public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
{ Slot itemSlot = this.getSlot(slot);
Slot itemSlot = this.getSlot(slot); boolean clearSlot = false;
boolean clearSlot = false;
if (itemSlot != null && itemSlot.getHasStack()) if (itemSlot != null && itemSlot.getHasStack()) {
{ ItemStack srcStack = itemSlot.getStack();
ItemStack srcStack = itemSlot.getStack(); if (slot == 0 && srcStack != null) {
if (slot == 0 && srcStack != null) clearSlot = this.mergeItemStack(srcStack, 1, 36 + 1, false);
{ } else {
clearSlot = this.mergeItemStack(srcStack, 1, 36 + 1, false); if (this.getSlot(0).isItemValid(srcStack)) {
} clearSlot = this.mergeItemStack(srcStack, 0, 1, false);
else }
{ }
if (this.getSlot(0).isItemValid(srcStack)) }
{
clearSlot = this.mergeItemStack(srcStack, 0, 1, false);
}
}
}
if (clearSlot) if (clearSlot) {
{ itemSlot.putStack(null);
itemSlot.putStack(null); }
} itemSlot.onSlotChanged();
itemSlot.onSlotChanged(); player.inventory.markDirty();
player.inventory.markDirty();
return null;
}
return null;
}
} }
@@ -5,19 +5,18 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
public class ContainerMB extends Container public class ContainerMB extends Container {
{
protected final int PLAYER_INVENTORY_ROWS = 3; protected final int PLAYER_INVENTORY_ROWS = 3;
protected final int PLAYER_INVENTORY_COLUMNS = 9; protected final int PLAYER_INVENTORY_COLUMNS = 9;
public void addPlayerInventory(InventoryPlayer inventoryPlayer, int xStart, int yStart) public void addPlayerInventory(InventoryPlayer inventoryPlayer, int xStart, int yStart) {
{ for (int x = 0; x < PLAYER_INVENTORY_COLUMNS; x++) {
for (int x = 0; x < PLAYER_INVENTORY_COLUMNS; x++){ addSlotToContainer(
addSlotToContainer(new Slot(inventoryPlayer, x, xStart + 8 + 18 * x, yStart + 4 + PLAYER_INVENTORY_ROWS * 18)); new Slot(inventoryPlayer, x, xStart + 8 + 18 * x, yStart + 4 + PLAYER_INVENTORY_ROWS * 18));
} }
for (int y = 0; y < PLAYER_INVENTORY_ROWS; y++){ for (int y = 0; y < PLAYER_INVENTORY_ROWS; y++) {
for (int x = 0; x < PLAYER_INVENTORY_COLUMNS; x++){ for (int x = 0; x < PLAYER_INVENTORY_COLUMNS; x++) {
addSlotToContainer(new Slot(inventoryPlayer, x + y * 9 + 9, xStart + 8 + 18 * x, yStart + y * 18)); addSlotToContainer(new Slot(inventoryPlayer, x + y * 9 + 9, xStart + 8 + 18 * x, yStart + y * 18));
} }
} }
@@ -19,39 +19,46 @@ public class ContainerMagicApiary extends ContainerMB {
private static final int SLOT_QUEEN = 0; private static final int SLOT_QUEEN = 0;
private static final int SLOT_DRONE = 1; private static final int SLOT_DRONE = 1;
private static final int SLOT_FRAME_START = 2; private static final int SLOT_FRAME_START = 2;
private static final int SLOT_INVENTORY_START = 5; private static final int SLOT_INVENTORY_START = 5;
private static final int SLOT_FRAME_COUNT = 3; private static final int SLOT_FRAME_COUNT = 3;
private static final int SLOT_INVENTORY_COUNT = 7; private static final int SLOT_INVENTORY_COUNT = 7;
public ContainerMagicApiary(InventoryPlayer inventoryPlayer, TileEntityMagicApiary thaumicApiary){ public ContainerMagicApiary(InventoryPlayer inventoryPlayer, TileEntityMagicApiary thaumicApiary) {
this.apiary = thaumicApiary; this.apiary = thaumicApiary;
// Queen/Princess slot // Queen/Princess slot
addSlotToContainer(new SlotCustomItems(this.apiary, 0, 29, 39, ItemInterface.getItemStack("Forestry", "beeQueenGE", 1), ItemInterface.getItemStack("Forestry", "beePrincessGE", 1))); addSlotToContainer(new SlotCustomItems(
this.apiary,
0,
29,
39,
ItemInterface.getItemStack("Forestry", "beeQueenGE", 1),
ItemInterface.getItemStack("Forestry", "beePrincessGE", 1)));
// Drone slot // Drone slot
addSlotToContainer(new SlotCustomItems(this.apiary, 1, 29, 65, ItemInterface.getItemStack("Forestry", "beeDroneGE", 64))); addSlotToContainer(
new SlotCustomItems(this.apiary, 1, 29, 65, ItemInterface.getItemStack("Forestry", "beeDroneGE", 64)));
int currentSlot = 1; int currentSlot = 1;
// Frame slots // Frame slots
for (int x = 0; x < 3; x++){ for (int x = 0; x < 3; x++) {
currentSlot++; currentSlot++;
addSlotToContainer(new SlotFrame(thaumicApiary, currentSlot, 66, 23 + x * 29)); addSlotToContainer(new SlotFrame(thaumicApiary, currentSlot, 66, 23 + x * 29));
//LogHelper.info("[1] CURRENTSLOT: " + currentSlot); // LogHelper.info("[1] CURRENTSLOT: " + currentSlot);
} }
for (int x = 0; x < 3; x++){ for (int x = 0; x < 3; x++) {
currentSlot++; currentSlot++;
addSlotToContainer(new Slot(thaumicApiary, currentSlot, 116, 26 + x * 26)); addSlotToContainer(new Slot(thaumicApiary, currentSlot, 116, 26 + x * 26));
//LogHelper.info("[2] CURRENTSLOT: " + currentSlot); // LogHelper.info("[2] CURRENTSLOT: " + currentSlot);
} }
int j = 0; int j = 0;
for (int y = 0; y < 2; y++){ for (int y = 0; y < 2; y++) {
for (int x = 0; x < 2; x++){ for (int x = 0; x < 2; x++) {
currentSlot++; currentSlot++;
addSlotToContainer(new Slot(thaumicApiary, currentSlot, 95 + x * 42, 39 + j * 26)); addSlotToContainer(new Slot(thaumicApiary, currentSlot, 95 + x * 42, 39 + j * 26));
//LogHelper.info("[3] CURRENTSLOT: " + currentSlot); // LogHelper.info("[3] CURRENTSLOT: " + currentSlot);
} }
j++; j++;
} }
@@ -59,41 +66,39 @@ public class ContainerMagicApiary extends ContainerMB {
addPlayerInventory(inventoryPlayer, 0, 110); addPlayerInventory(inventoryPlayer, 0, 110);
maxSlot = currentSlot; maxSlot = currentSlot;
} }
@Override @Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex){ public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
Slot itemSlot = this.getSlot(slotIndex); Slot itemSlot = this.getSlot(slotIndex);
boolean clearSlot = false; boolean clearSlot = false;
if (itemSlot != null && itemSlot.getHasStack()) { if (itemSlot != null && itemSlot.getHasStack()) {
ItemStack srcStack = itemSlot.getStack(); ItemStack srcStack = itemSlot.getStack();
if (slotIndex <= maxSlot && srcStack != null){ if (slotIndex <= maxSlot && srcStack != null) {
clearSlot = this.mergeItemStack(srcStack, maxSlot + 1, maxSlot + 36, false); clearSlot = this.mergeItemStack(srcStack, maxSlot + 1, maxSlot + 36, false);
}else{ } else {
if (slotIndex > maxSlot && srcStack != null){ if (slotIndex > maxSlot && srcStack != null) {
if (BeeManager.beeRoot.isMember(srcStack)){ if (BeeManager.beeRoot.isMember(srcStack)) {
if (!BeeManager.beeRoot.isDrone(srcStack)){ if (!BeeManager.beeRoot.isDrone(srcStack)) {
if (this.getSlot(SLOT_QUEEN).getHasStack() == false) { if (this.getSlot(SLOT_QUEEN).getHasStack() == false) {
clearSlot = this.mergeItemStack(srcStack, SLOT_QUEEN, SLOT_QUEEN + 1, false); clearSlot = this.mergeItemStack(srcStack, SLOT_QUEEN, SLOT_QUEEN + 1, false);
}
}else{
if (this.getSlot(SLOT_DRONE).isItemValid(srcStack)){
clearSlot = this.mergeItemStack(srcStack, SLOT_DRONE, SLOT_DRONE + 1, false);
}
} }
}else if(srcStack.getItem() instanceof IHiveFrame){ } else {
clearSlot = this.mergeItemStack(srcStack, SLOT_FRAME_START, SLOT_FRAME_START + SLOT_FRAME_COUNT, false); if (this.getSlot(SLOT_DRONE).isItemValid(srcStack)) {
clearSlot = this.mergeItemStack(srcStack, SLOT_DRONE, SLOT_DRONE + 1, false);
}
}
} else if (srcStack.getItem() instanceof IHiveFrame) {
clearSlot = this.mergeItemStack(
srcStack, SLOT_FRAME_START, SLOT_FRAME_START + SLOT_FRAME_COUNT, false);
} }
} }
} }
} }
if (clearSlot){ if (clearSlot) {
itemSlot.putStack(null); itemSlot.putStack(null);
} }
@@ -108,7 +113,6 @@ public class ContainerMagicApiary extends ContainerMB {
return apiary.isUseableByPlayer(entityPlayer); return apiary.isUseableByPlayer(entityPlayer);
} }
@Override @Override
public void updateProgressBar(int i, int j) { public void updateProgressBar(int i, int j) {
apiary.getGUINetworkData(i, j); apiary.getGUINetworkData(i, j);
@@ -7,59 +7,60 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
public class GUIEffectJar extends GuiContainer {
public static final String BACKGROUND_FILE = "jarScreen.png";
public static final ResourceLocation BACKGROUND_LOCATION =
new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.GUI_TEXTURE + "jarScreen.png");
public class GUIEffectJar extends GuiContainer private static final int WIDTH = 176;
{ private static final int HEIGHT = 156;
public static final String BACKGROUND_FILE = "jarScreen.png";
public static final ResourceLocation BACKGROUND_LOCATION = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.GUI_TEXTURE + "jarScreen.png");
private static final int WIDTH = 176; private static final int SLOT_JAR_X = 80;
private static final int HEIGHT = 156; private static final int SLOT_JAR_Y = 22;
private static final int SLOT_INVENTORY_X = 8;
private static final int SLOT_INVENTORY_Y = 74;
private static final int BAR_DEST_X = 117;
private static final int BAR_DEST_Y = 10;
private static final int SLOT_JAR_X = 80; private static final int BAR_SRC_X = 176;
private static final int SLOT_JAR_Y = 22; private static final int BAR_SRC_Y = 0;
private static final int SLOT_INVENTORY_X = 8;
private static final int SLOT_INVENTORY_Y = 74;
private static final int BAR_DEST_X = 117;
private static final int BAR_DEST_Y = 10;
private static final int BAR_SRC_X = 176; private static final int BAR_WIDTH = 10;
private static final int BAR_SRC_Y = 0; private static final int BAR_HEIGHT = 40;
private static final int BAR_WIDTH = 10; public GUIEffectJar(TileEntityEffectJar jar, EntityPlayer player) {
private static final int BAR_HEIGHT = 40; super(new ContainerEffectJar(jar, player));
this.xSize = WIDTH;
this.ySize = HEIGHT;
}
public GUIEffectJar(TileEntityEffectJar jar, EntityPlayer player) @Override
{ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
super(new ContainerEffectJar(jar, player)); fontRendererObj.drawString("Inventory", 9, 63, 0);
this.xSize = WIDTH; }
this.ySize = HEIGHT;
}
@Override @Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
{ GL11.glColor4f(1f, 1f, 1f, 1f);
fontRendererObj.drawString("Inventory", 9, 63, 0); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_SRC_ALPHA);
} this.mc.getTextureManager().bindTexture(BACKGROUND_LOCATION);
@Override this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, xSize, ySize);
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
{
GL11.glColor4f(1f, 1f, 1f, 1f);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_SRC_ALPHA);
this.mc.getTextureManager().bindTexture(BACKGROUND_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, xSize, ySize); TileEntityEffectJar jar = ((ContainerEffectJar) this.inventorySlots).jar;
float r = ((jar.currentBeeColour >> 16) & 255) / 255f;
float g = ((jar.currentBeeColour >> 8) & 255) / 255f;
float b = (jar.currentBeeColour & 255) / 255f;
TileEntityEffectJar jar = ((ContainerEffectJar)this.inventorySlots).jar; GL11.glColor3f(r, g, b);
float r = ((jar.currentBeeColour >> 16) & 255) / 255f;
float g = ((jar.currentBeeColour >> 8) & 255) / 255f;
float b = (jar.currentBeeColour & 255) / 255f;
GL11.glColor3f(r, g, b);
int value = BAR_HEIGHT - (jar.currentBeeHealth * BAR_HEIGHT) / 100;
this.drawTexturedModalRect(this.guiLeft + BAR_DEST_X, this.guiTop + value + BAR_DEST_Y, BAR_SRC_X, BAR_SRC_Y, BAR_WIDTH, BAR_HEIGHT - value);
}
int value = BAR_HEIGHT - (jar.currentBeeHealth * BAR_HEIGHT) / 100;
this.drawTexturedModalRect(
this.guiLeft + BAR_DEST_X,
this.guiTop + value + BAR_DEST_Y,
BAR_SRC_X,
BAR_SRC_Y,
BAR_WIDTH,
BAR_HEIGHT - value);
}
} }
@@ -1,48 +1,36 @@
package magicbees.client.gui; package magicbees.client.gui;
import cpw.mods.fml.common.network.IGuiHandler;
import magicbees.tileentity.TileEntityEffectJar; import magicbees.tileentity.TileEntityEffectJar;
import magicbees.tileentity.TileEntityMagicApiary; import magicbees.tileentity.TileEntityMagicApiary;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
public class GUIHandler implements IGuiHandler public class GUIHandler implements IGuiHandler {
{
@Override @Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
{ Object value = null;
Object value = null;
if (ID == UIScreens.EFFECT_JAR.ordinal()) if (ID == UIScreens.EFFECT_JAR.ordinal()) {
{ value = new ContainerEffectJar((TileEntityEffectJar) world.getTileEntity(x, y, z), player);
value = new ContainerEffectJar((TileEntityEffectJar)world.getTileEntity(x, y, z), player); } else if (ID == UIScreens.THAUMIC_APIARY.ordinal()) {
}
else if (ID == UIScreens.THAUMIC_APIARY.ordinal())
{
TileEntityMagicApiary tileEntityThaumicApiary = (TileEntityMagicApiary) world.getTileEntity(x, y, z); TileEntityMagicApiary tileEntityThaumicApiary = (TileEntityMagicApiary) world.getTileEntity(x, y, z);
value = new ContainerMagicApiary(player.inventory, tileEntityThaumicApiary); value = new ContainerMagicApiary(player.inventory, tileEntityThaumicApiary);
} }
return value; return value;
} }
@Override @Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
{ if (ID == UIScreens.EFFECT_JAR.ordinal()) {
Object value = null; return new GUIEffectJar((TileEntityEffectJar) world.getTileEntity(x, y, z), player);
} else if (ID == UIScreens.THAUMIC_APIARY.ordinal()) {
if (ID == UIScreens.EFFECT_JAR.ordinal())
{
value = new GUIEffectJar((TileEntityEffectJar)world.getTileEntity(x, y, z), player);
}else if (ID == UIScreens.THAUMIC_APIARY.ordinal())
{
TileEntityMagicApiary tileEntityThaumicApiary = (TileEntityMagicApiary) world.getTileEntity(x, y, z); TileEntityMagicApiary tileEntityThaumicApiary = (TileEntityMagicApiary) world.getTileEntity(x, y, z);
value = new GuiMagicApiary(player.inventory, tileEntityThaumicApiary); return new GuiMagicApiary(player.inventory, tileEntityThaumicApiary);
} else {
return null;
} }
}
return value;
}
} }
@@ -1,35 +1,27 @@
package magicbees.client.gui; package magicbees.client.gui;
import java.util.Set;
import cpw.mods.fml.client.IModGuiFactory; import cpw.mods.fml.client.IModGuiFactory;
import java.util.Set;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
public class GuiFactory implements IModGuiFactory public class GuiFactory implements IModGuiFactory {
{
@Override @Override
public void initialize(Minecraft minecraftInstance) public void initialize(Minecraft minecraftInstance) {}
{
} @Override
public Class<? extends GuiScreen> mainConfigGuiClass() {
return ModGuiConfig.class;
}
@Override @Override
public Class<? extends GuiScreen> mainConfigGuiClass() public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
{ return null;
return ModGuiConfig.class; }
}
@Override @Override
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
{ return null;
return null; }
}
@Override
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element)
{
return null;
}
} }
@@ -1,21 +1,19 @@
package magicbees.client.gui; package magicbees.client.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import magicbees.main.CommonProxy; import magicbees.main.CommonProxy;
import magicbees.tileentity.TileEntityMagicApiary; import magicbees.tileentity.TileEntityMagicApiary;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class GuiMagicApiary extends GuiContainer public class GuiMagicApiary extends GuiContainer {
{ public static final ResourceLocation BACKGROUND_LOCATION =
public static final ResourceLocation BACKGROUND_LOCATION = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.GUI_TEXTURE + "apiary.png"); new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.GUI_TEXTURE + "apiary.png");
private static final int WIDTH = 176; private static final int WIDTH = 176;
private static final int HEIGHT = 190; private static final int HEIGHT = 190;
@@ -61,14 +59,12 @@ public class GuiMagicApiary extends GuiContainer
this.xSize = WIDTH; this.xSize = WIDTH;
this.ySize = HEIGHT; this.ySize = HEIGHT;
} }
@Override @Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) protected void drawGuiContainerForegroundLayer(int par1, int par2) {
{ fontRendererObj.drawString("Inventory", 9, 99, 0);
fontRendererObj.drawString("Inventory", 9, 99, 0); }
}
@Override @Override
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) { protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) {
@@ -77,7 +73,7 @@ public class GuiMagicApiary extends GuiContainer
this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
TileEntityMagicApiary apiary = ((ContainerMagicApiary)this.inventorySlots).apiary; TileEntityMagicApiary apiary = ((ContainerMagicApiary) this.inventorySlots).apiary;
drawLifebar(apiary); drawLifebar(apiary);
@@ -86,56 +82,72 @@ public class GuiMagicApiary extends GuiContainer
drawMutationIcon(apiary); drawMutationIcon(apiary);
} }
private void drawMutationIcon(TileEntityMagicApiary apiary) { private void drawMutationIcon(TileEntityMagicApiary apiary) {
if (apiary.isMutationBoosted()) { if (apiary.isMutationBoosted()) {
this.drawTexturedModalRect(this.guiLeft + MUTATIONBOOST_DEST_X, this.guiTop + MUTATIONBOOST_DEST_Y, this.drawTexturedModalRect(
MUTATIONBOOST_SRC_X, MUTATIONBOOST_SRC_Y, MUTATIONBOOST_WIDTH, MUTATIONBOOST_HEIGHT); this.guiLeft + MUTATIONBOOST_DEST_X,
this.guiTop + MUTATIONBOOST_DEST_Y,
MUTATIONBOOST_SRC_X,
MUTATIONBOOST_SRC_Y,
MUTATIONBOOST_WIDTH,
MUTATIONBOOST_HEIGHT);
} }
}
private void drawDeathRateIcon(TileEntityMagicApiary apiary) {
if (apiary.isDeathRateBoosted()) {
this.drawTexturedModalRect(this.guiLeft + DEATHBOOST_DEST_X, this.guiTop + DEATHBOOST_DEST_Y,
DEATHBOOST_SRC_X, DEATHBOOST_SRC_Y, DEATHBOOST_WIDTH, DEATHBOOST_HEIGHT);
}
}
private void drawWorkBoostIcon(TileEntityMagicApiary apiary) {
if (apiary.isProductionBoosted()) {
this.drawTexturedModalRect(this.guiLeft + WORKBOOST_DEST_X, this.guiTop + WORKBOOST_DEST_Y,
WORKBOOST_SRC_X, WORKBOOST_SRC_Y, WORKBOOST_WIDTH, WORKBOOST_HEIGHT);
}
}
private void drawLifebar(TileEntityMagicApiary apiary) {
int value = LIFEBAR_HEIGHT - apiary.getHealthScaled(LIFEBAR_HEIGHT);
int lifebarSrc = getLifebarSrc(apiary);
this.drawTexturedModalRect(this.guiLeft + LIFEBAR_DEST_X, this.guiTop + value + LIFEBAR_DEST_Y,
lifebarSrc, LIFEBAR_SRC_Y, LIFEBAR_WIDTH, LIFEBAR_HEIGHT - value);
}
private int getLifebarSrc(TileEntityMagicApiary apiary) {
int value = apiary.getHealthScaled(5);
if (value >= 5) {
return LIFEBAR_SRC_STAGE1_X;
}
else if (value >= 4) {
return LIFEBAR_SRC_STAGE2_X;
}
else if (value >= 3) {
return LIFEBAR_SRC_STAGE3_X;
}
else if (value >= 2) {
return LIFEBAR_SRC_STAGE4_X;
}
else {
return LIFEBAR_SRC_STAGE5_X;
}
} }
@Override private void drawDeathRateIcon(TileEntityMagicApiary apiary) {
protected void mouseClicked(int p_73864_1_, int p_73864_2_, int p_73864_3_) { if (apiary.isDeathRateBoosted()) {
// TODO Auto-generated method stub this.drawTexturedModalRect(
super.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_); this.guiLeft + DEATHBOOST_DEST_X,
} this.guiTop + DEATHBOOST_DEST_Y,
DEATHBOOST_SRC_X,
DEATHBOOST_SRC_Y,
DEATHBOOST_WIDTH,
DEATHBOOST_HEIGHT);
}
}
private void drawWorkBoostIcon(TileEntityMagicApiary apiary) {
if (apiary.isProductionBoosted()) {
this.drawTexturedModalRect(
this.guiLeft + WORKBOOST_DEST_X,
this.guiTop + WORKBOOST_DEST_Y,
WORKBOOST_SRC_X,
WORKBOOST_SRC_Y,
WORKBOOST_WIDTH,
WORKBOOST_HEIGHT);
}
}
private void drawLifebar(TileEntityMagicApiary apiary) {
int value = LIFEBAR_HEIGHT - apiary.getHealthScaled(LIFEBAR_HEIGHT);
int lifebarSrc = getLifebarSrc(apiary);
this.drawTexturedModalRect(
this.guiLeft + LIFEBAR_DEST_X,
this.guiTop + value + LIFEBAR_DEST_Y,
lifebarSrc,
LIFEBAR_SRC_Y,
LIFEBAR_WIDTH,
LIFEBAR_HEIGHT - value);
}
private int getLifebarSrc(TileEntityMagicApiary apiary) {
int value = apiary.getHealthScaled(5);
if (value >= 5) {
return LIFEBAR_SRC_STAGE1_X;
} else if (value >= 4) {
return LIFEBAR_SRC_STAGE2_X;
} else if (value >= 3) {
return LIFEBAR_SRC_STAGE3_X;
} else if (value >= 2) {
return LIFEBAR_SRC_STAGE4_X;
} else {
return LIFEBAR_SRC_STAGE5_X;
}
}
@Override
protected void mouseClicked(int p_73864_1_, int p_73864_2_, int p_73864_3_) {
// TODO Auto-generated method stub
super.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_);
}
} }
@@ -1,38 +1,39 @@
package magicbees.client.gui; package magicbees.client.gui;
import cpw.mods.fml.client.config.DummyConfigElement;
import cpw.mods.fml.client.config.GuiConfig;
import cpw.mods.fml.client.config.IConfigElement;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import magicbees.main.Config; import magicbees.main.Config;
import magicbees.main.utils.VersionInfo; import magicbees.main.utils.VersionInfo;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.config.ConfigElement; import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.common.config.Configuration;
import cpw.mods.fml.client.config.DummyConfigElement;
import cpw.mods.fml.client.config.GuiConfig;
import cpw.mods.fml.client.config.IConfigElement;
public class ModGuiConfig extends GuiConfig public class ModGuiConfig extends GuiConfig {
{ public ModGuiConfig(GuiScreen guiScreen) {
public ModGuiConfig(GuiScreen guiScreen) super(
{ guiScreen,
super(guiScreen, configElements(), VersionInfo.ModName, false, false, configElements(),
GuiConfig.getAbridgedConfigPath(Config.configuration.toString())); VersionInfo.ModName,
} false,
false,
GuiConfig.getAbridgedConfigPath(Config.configuration.toString()));
}
private static List<IConfigElement> configElements() { private static List<IConfigElement> configElements() {
List<IConfigElement> list = new ArrayList<IConfigElement>(); List<IConfigElement> list = new ArrayList<IConfigElement>();
list.add(categoryElement(Config.CATEGORY_GENERAL, "General", "magicbees.config.category.general")); list.add(categoryElement(Config.CATEGORY_GENERAL, "General", "magicbees.config.category.general"));
list.add(categoryElement(Config.CATEGORY_DEBUG, "Debug", "magicbees.config.category.debug")); list.add(categoryElement(Config.CATEGORY_DEBUG, "Debug", "magicbees.config.category.debug"));
list.add(categoryElement(Config.CATEGORY_MODULES, "Modules", "magicbees.config.category.modules")); list.add(categoryElement(Config.CATEGORY_MODULES, "Modules", "magicbees.config.category.modules"));
list.add(categoryElement(Config.CATEGORY_BOTANIA, "Botania Plugin", "magicbees.config.category.botania")); list.add(categoryElement(Config.CATEGORY_BOTANIA, "Botania Plugin", "magicbees.config.category.botania"));
return list; return list;
} }
private static IConfigElement categoryElement(String category, String name, String tooltip_key) { private static IConfigElement categoryElement(String category, String name, String tooltip_key) {
return new DummyConfigElement.DummyCategoryElement(name, tooltip_key, return new DummyConfigElement.DummyCategoryElement(
new ConfigElement(Config.configuration.getCategory(category)).getChildElements()); name, tooltip_key, new ConfigElement(Config.configuration.getCategory(category)).getChildElements());
} }
} }
@@ -3,7 +3,6 @@ package magicbees.client.gui;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -12,90 +11,70 @@ import net.minecraftforge.oredict.OreDictionary;
/** /**
* @author MysteriousAges * @author MysteriousAges
*/ */
public class SlotCustomItems extends Slot public class SlotCustomItems extends Slot {
{ private List<ItemStack> items;
private List<ItemStack> items;
public SlotCustomItems(IInventory inventory, int slotIndex, int xPos, int yPos, ItemStack... items) public SlotCustomItems(IInventory inventory, int slotIndex, int xPos, int yPos, ItemStack... items) {
{ super(inventory, slotIndex, xPos, yPos);
super(inventory, slotIndex, xPos, yPos); this.items = new ArrayList<ItemStack>(items.length);
this.items = new ArrayList<ItemStack>(items.length);
Collections.addAll(this.items, items); Collections.addAll(this.items, items);
} }
/** /**
* @return List of valid ItemStacks * @return List of valid ItemStacks
*/ */
public List<ItemStack> getValidItems() public List<ItemStack> getValidItems() {
{ return this.items;
return this.items; }
}
public void addValidItem(ItemStack newItem) public void addValidItem(ItemStack newItem) {
{ boolean contains = false;
boolean contains = false; for (int i = 0; i < this.items.size(); ++i) {
for (int i = 0; i < this.items.size(); ++i) ItemStack s = this.items.get(i);
{ if (s.getItem() == newItem.getItem()) {
ItemStack s = this.items.get(i); if (s.getItemDamage() == OreDictionary.WILDCARD_VALUE) {
if (s.getItem() == newItem.getItem()) contains = true;
{ break;
if (s.getItemDamage() == OreDictionary.WILDCARD_VALUE) } else if (s.getItemDamage() == newItem.getItemDamage()) {
{ contains = true;
contains = true; break;
break; }
} }
else if (s.getItemDamage() == newItem.getItemDamage()) }
{ if (!contains) {
contains = true; this.items.add(newItem);
break; }
} }
}
}
if (!contains)
{
this.items.add(newItem);
}
}
/** /**
* @param removeItem ItemStack to remove. * @param removeItem ItemStack to remove.
*/ */
public void removeValidItem(ItemStack removeItem) public void removeValidItem(ItemStack removeItem) {
{ for (int i = 0; i < this.items.size(); ++i) {
for (int i = 0; i < this.items.size(); ++i) ItemStack s = this.items.get(i);
{ if (s.getItem() == removeItem.getItem()) {
ItemStack s = this.items.get(i); if (s.getItemDamage() == OreDictionary.WILDCARD_VALUE) {
if (s.getItem() == removeItem.getItem()) this.items.remove(i);
{ break;
if (s.getItemDamage() == OreDictionary.WILDCARD_VALUE) } else if (s.getItemDamage() == removeItem.getItemDamage()) {
{ this.items.remove(i);
this.items.remove(i); break;
break; }
} }
else if (s.getItemDamage() == removeItem.getItemDamage()) }
{ }
this.items.remove(i);
break;
}
}
}
}
@Override
public boolean isItemValid(ItemStack itemStack)
{
for (ItemStack item : this.items)
{
if (item != null && item.getItem() == itemStack.getItem())
{
if (item.getItemDamage() == itemStack.getItemDamage() || item.getItemDamage() == OreDictionary.WILDCARD_VALUE)
{
return true;
}
}
}
return false;
}
@Override
public boolean isItemValid(ItemStack itemStack) {
for (ItemStack item : this.items) {
if (item != null && item.getItem() == itemStack.getItem()) {
if (item.getItemDamage() == itemStack.getItemDamage()
|| item.getItemDamage() == OreDictionary.WILDCARD_VALUE) {
return true;
}
}
}
return false;
}
} }
@@ -10,17 +10,17 @@ public class SlotFrame extends SlotCustomItems {
} }
@Override @Override
public boolean isItemValid(ItemStack itemStack){ public boolean isItemValid(ItemStack itemStack) {
if (itemStack == null){ if (itemStack == null) {
return false; return false;
} }
if (!inventory.isItemValidForSlot(getSlotIndex(), itemStack)){ if (!inventory.isItemValidForSlot(getSlotIndex(), itemStack)) {
return false; return false;
} }
boolean flag = false; boolean flag = false;
if(itemStack.getItem() instanceof IHiveFrame){ if (itemStack.getItem() instanceof IHiveFrame) {
flag = true; flag = true;
} }
@@ -1,7 +1,7 @@
package magicbees.client.gui; package magicbees.client.gui;
public enum UIScreens public enum UIScreens {
{ EFFECT_JAR,
EFFECT_JAR, THAUMIC_APIARY,
THAUMIC_APIARY,; ;
} }
@@ -9,31 +9,29 @@ import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class ModelEffectJar public class ModelEffectJar {
{ public static final ResourceLocation objFile =
public static final ResourceLocation objFile = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "effectJar.obj"); new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "effectJar.obj");
public static final ResourceLocation textureLocation = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "jarTexture.png"); public static final ResourceLocation textureLocation =
new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "jarTexture.png");
public static final ModelEffectJar model = new ModelEffectJar(); public static final ModelEffectJar model = new ModelEffectJar();
private IModelCustom effectJarObj; private IModelCustom effectJarObj;
public ModelEffectJar() public ModelEffectJar() {
{ this.effectJarObj = AdvancedModelLoader.loadModel(objFile);
this.effectJarObj = AdvancedModelLoader.loadModel(objFile); }
}
public void render() public void render() {
{ this.effectJarObj.renderPart("jarLid");
this.effectJarObj.renderPart("jarLid");
GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.effectJarObj.renderPart("jarBase"); this.effectJarObj.renderPart("jarBase");
GL11.glPopAttrib(); GL11.glPopAttrib();
}
}
} }
@@ -1,40 +1,42 @@
package magicbees.client.model; package magicbees.client.model;
import org.lwjgl.opengl.GL11; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import magicbees.main.CommonProxy; import magicbees.main.CommonProxy;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom; import net.minecraftforge.client.model.IModelCustom;
import cpw.mods.fml.relauncher.Side; import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class ModelVisAuraProvider { public class ModelVisAuraProvider {
public static final ResourceLocation objFile = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "visAuraConverter.obj"); public static final ResourceLocation objFile =
public static final ResourceLocation textureLocation = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "visAuraProvider.png"); new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "visAuraConverter.obj");
public static final ResourceLocation textureLocation =
new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "visAuraProvider.png");
public static final ModelVisAuraProvider model = new ModelVisAuraProvider(); public static final ModelVisAuraProvider model = new ModelVisAuraProvider();
private IModelCustom visAuraProviderObj; private IModelCustom visAuraProviderObj;
public ModelVisAuraProvider() { public ModelVisAuraProvider() {
this.visAuraProviderObj = AdvancedModelLoader.loadModel(objFile); this.visAuraProviderObj = AdvancedModelLoader.loadModel(objFile);
} }
public void render(long tick) { public void render(long tick) {
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glRotated(Math.sin(tick * Math.PI * 2 / 80) * 0.7, 0, 1, 0); GL11.glRotated(Math.sin(tick * Math.PI * 2 / 80) * 0.7, 0, 1, 0);
GL11.glRotated(Math.sin((tick + 25) * Math.PI * 2 / 150) * 0.75, 0.5, 0, 0.5); GL11.glRotated(Math.sin((tick + 25) * Math.PI * 2 / 150) * 0.75, 0.5, 0, 0.5);
GL11.glTranslated(Math.sin(tick * Math.PI * 2 / 1000) * 0.025, 0, Math.sin((tick + 30) * Math.PI * 2 / 650) * 0.03); GL11.glTranslated(
float red = (float)(Math.sin(tick * Math.PI * 2 / 130) * 0.2 + 0.8); Math.sin(tick * Math.PI * 2 / 1000) * 0.025, 0, Math.sin((tick + 30) * Math.PI * 2 / 650) * 0.03);
float green = (float)(Math.cos((tick + 2) * Math.PI * 2 / 140) * 0.2 + 0.8); float red = (float) (Math.sin(tick * Math.PI * 2 / 130) * 0.2 + 0.8);
float blue = (float)(Math.sin((tick + 5) * Math.PI * 2 / 99) * 0.2 + 0.8); float green = (float) (Math.cos((tick + 2) * Math.PI * 2 / 140) * 0.2 + 0.8);
GL11.glColor3f(red, green, blue); float blue = (float) (Math.sin((tick + 5) * Math.PI * 2 / 99) * 0.2 + 0.8);
this.visAuraProviderObj.renderPart("centre"); GL11.glColor3f(red, green, blue);
GL11.glPopMatrix(); this.visAuraProviderObj.renderPart("centre");
GL11.glPopMatrix();
GL11.glColor3f(1f, 1f, 1f); GL11.glColor3f(1f, 1f, 1f);
this.visAuraProviderObj.renderPart("frame"); this.visAuraProviderObj.renderPart("frame");
} }
} }
@@ -9,69 +9,60 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
public class RendererEffectJar extends TileEntitySpecialRenderer implements IItemRenderer public class RendererEffectJar extends TileEntitySpecialRenderer implements IItemRenderer {
{ public static RendererEffectJar instance = new RendererEffectJar();
public static RendererEffectJar instance = new RendererEffectJar();
@Override @Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
{ if (tileEntity instanceof TileEntityEffectJar) {
if (tileEntity instanceof TileEntityEffectJar) this.doRender(x, y, z, 1f);
{ }
this.doRender(x, y, z, 1f); }
}
}
@Override @Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) public boolean handleRenderType(ItemStack item, ItemRenderType type) {
{ return true;
return true; }
}
@Override @Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
{ return true;
return true; }
}
@Override @Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
{ switch (type) {
switch (type) default:
{ case ENTITY:
default: doRender(0, 0, 0, 1.8f);
case ENTITY: break;
doRender(0, 0, 0, 1.8f);
break;
case EQUIPPED: case EQUIPPED:
doRender(0, 0, 0, 1.5f); doRender(0, 0, 0, 1.5f);
break; break;
case EQUIPPED_FIRST_PERSON: case EQUIPPED_FIRST_PERSON:
doRender(-.5, .5, 0.25, 1f); doRender(-.5, .5, 0.25, 1f);
break; break;
case INVENTORY: case INVENTORY:
doRender(0.3, 0.25, 0.3, 1.5f); doRender(0.3, 0.25, 0.3, 1.5f);
break; break;
} }
} }
private void doRender(double x, double y, double z, float scale) private void doRender(double x, double y, double z, float scale) {
{ GL11.glPushMatrix();
GL11.glPushMatrix(); GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glScaled(scale, scale, scale); GL11.glScaled(scale, scale, scale);
GL11.glTranslated(x, y, z); GL11.glTranslated(x, y, z);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModelEffectJar.textureLocation); FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModelEffectJar.textureLocation);
ModelEffectJar.model.render(); ModelEffectJar.model.render();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
} }
@@ -1,50 +1,47 @@
package magicbees.client.render; package magicbees.client.render;
import cpw.mods.fml.client.FMLClientHandler;
import magicbees.client.model.ModelVisAuraProvider; import magicbees.client.model.ModelVisAuraProvider;
import magicbees.tileentity.TileEntityVisAuraProvider; import magicbees.tileentity.TileEntityVisAuraProvider;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
public class RendererVisAuraProvider extends TileEntitySpecialRenderer implements IItemRenderer { public class RendererVisAuraProvider extends TileEntitySpecialRenderer implements IItemRenderer {
public static RendererVisAuraProvider instance = new RendererVisAuraProvider(); public static RendererVisAuraProvider instance = new RendererVisAuraProvider();
@Override @Override
public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float tick) { public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float tick) {
if (entity instanceof TileEntityVisAuraProvider) { if (entity instanceof TileEntityVisAuraProvider) {
this.doRender(x, y, z, 1f, entity.getWorldObj().getTotalWorldTime()); this.doRender(x, y, z, 1f, entity.getWorldObj().getTotalWorldTime());
} }
} }
@Override @Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) { public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return true; return true;
} }
@Override @Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return true; return true;
} }
@Override @Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) { public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
doRender(0, 0, 0, 1f, 0); doRender(0, 0, 0, 1f, 0);
} }
private void doRender(double x, double y, double z, float scale, long tick) { private void doRender(double x, double y, double z, float scale, long tick) {
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glScaled(scale, scale, scale); GL11.glScaled(scale, scale, scale);
GL11.glTranslated(x, y, z); GL11.glTranslated(x, y, z);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModelVisAuraProvider.textureLocation); FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModelVisAuraProvider.textureLocation);
ModelVisAuraProvider.model.render(tick); ModelVisAuraProvider.model.render(tick);
GL11.glPopMatrix();
}
GL11.glPopMatrix();
}
} }
+64 -78
View File
@@ -1,7 +1,9 @@
package magicbees.item; package magicbees.item;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List; import java.util.List;
import magicbees.item.types.CapsuleType; import magicbees.item.types.CapsuleType;
import magicbees.item.types.FluidType; import magicbees.item.types.FluidType;
import magicbees.main.CommonProxy; import magicbees.main.CommonProxy;
@@ -11,91 +13,75 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemCapsule extends Item public class ItemCapsule extends Item {
{ private CapsuleType capsuleType;
private CapsuleType capsuleType;
public ItemCapsule(CapsuleType type, int maxStackSize) public ItemCapsule(CapsuleType type, int maxStackSize) {
{ super();
super(); this.capsuleType = type;
this.capsuleType = type; this.setCreativeTab(TabMagicBees.tabMagicBees);
this.setCreativeTab(TabMagicBees.tabMagicBees); this.setHasSubtypes(true);
this.setHasSubtypes(true); this.setMaxStackSize(maxStackSize);
this.setMaxStackSize(maxStackSize); this.setUnlocalizedName("capsule." + type.toString().toLowerCase());
this.setUnlocalizedName("capsule." + type.toString().toLowerCase()); GameRegistry.registerItem(this, "capsule." + type.toString().toLowerCase());
GameRegistry.registerItem(this, "capsule." + type.toString().toLowerCase()); }
}
public CapsuleType getType() public CapsuleType getType() {
{ return this.capsuleType;
return this.capsuleType; }
}
@Override @Override
public String getItemStackDisplayName(ItemStack itemStack) public String getItemStackDisplayName(ItemStack itemStack) {
{ return String.format(
return String.format(this.capsuleType.getLocalizedName(), FluidType.values()[itemStack.getItemDamage()].getDisplayName()); this.capsuleType.getLocalizedName(), FluidType.values()[itemStack.getItemDamage()].getDisplayName());
} }
public ItemStack getCapsuleForLiquid(FluidType l) public ItemStack getCapsuleForLiquid(FluidType l) {
{ return new ItemStack(this, 1, l.ordinal());
return new ItemStack(this, 1, l.ordinal()); }
}
@SuppressWarnings({ "unchecked", "rawtypes" }) @SuppressWarnings({"unchecked", "rawtypes"})
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List itemList) public void getSubItems(Item item, CreativeTabs tab, List itemList) {
{ for (FluidType l : FluidType.values()) {
for (FluidType l : FluidType.values()) if (l.available) {
{ itemList.add(new ItemStack(this, 1, l.ordinal()));
if (l.available) }
{ }
itemList.add(new ItemStack(this, 1, l.ordinal())); }
}
}
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public boolean requiresMultipleRenderPasses() public boolean requiresMultipleRenderPasses() {
{ return true;
return true; }
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister) public void registerIcons(IIconRegister iconRegister) {
{ this.itemIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":capsule"
this.itemIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":capsule" + this.capsuleType.getName().substring(0, 1).toUpperCase() + this.capsuleType.getName().substring(0, 1).toUpperCase()
+ this.capsuleType.getName().substring(1)); + this.capsuleType.getName().substring(1));
for (FluidType t : FluidType.values()) for (FluidType t : FluidType.values()) {
{ if (t != FluidType.EMPTY) {
if (t != FluidType.EMPTY) t.liquidIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":liquids/" + t.liquidID);
{ }
t.liquidIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":liquids/" + t.liquidID); }
} }
}
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIconFromDamageForRenderPass(int metadata, int pass) public IIcon getIconFromDamageForRenderPass(int metadata, int pass) {
{ IIcon i = this.itemIcon;
IIcon i = this.itemIcon; if (metadata != 0 && pass == 0) {
if (metadata != 0 && pass == 0) i = FluidType.values()[metadata % FluidType.values().length].liquidIcon;
{ }
i = FluidType.values()[metadata % FluidType.values().length].liquidIcon; return i;
} }
return i;
}
@Override @Override
public int getRenderPasses(int metadata) public int getRenderPasses(int metadata) {
{ return (metadata == 0) ? 1 : 2;
return (metadata == 0) ? 1 : 2; }
}
} }
+69 -86
View File
@@ -1,7 +1,10 @@
package magicbees.item; package magicbees.item;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.core.Tabs;
import java.util.List; import java.util.List;
import magicbees.item.types.CombType; import magicbees.item.types.CombType;
import magicbees.main.Config; import magicbees.main.Config;
import magicbees.main.utils.compat.ForestryHelper; import magicbees.main.utils.compat.ForestryHelper;
@@ -10,103 +13,83 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.core.Tabs;
public class ItemComb extends Item public class ItemComb extends Item {
{ public ItemComb() {
public ItemComb() super();
{ this.setCreativeTab(Tabs.tabApiculture);
super(); this.setHasSubtypes(true);
this.setCreativeTab(Tabs.tabApiculture); this.setUnlocalizedName("comb");
this.setHasSubtypes(true); GameRegistry.registerItem(this, "comb");
this.setUnlocalizedName("comb"); }
GameRegistry.registerItem(this, "comb");
}
public ItemStack getStackForType(CombType type) public ItemStack getStackForType(CombType type) {
{ return new ItemStack(this, 1, type.ordinal());
return new ItemStack(this, 1, type.ordinal()); }
}
public ItemStack getStackForType(CombType type, int count) public ItemStack getStackForType(CombType type, int count) {
{ return new ItemStack(this, count, type.ordinal());
return new ItemStack(this, count, type.ordinal()); }
}
@SuppressWarnings({ "unchecked", "rawtypes" }) @SuppressWarnings({"unchecked", "rawtypes"})
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tabs, List list) public void getSubItems(Item item, CreativeTabs tabs, List list) {
{ for (CombType type : CombType.values()) {
for (CombType type : CombType.values()) if (type.showInList || Config.forestryDebugEnabled) {
{ list.add(this.getStackForType(type));
if (type.showInList || Config.forestryDebugEnabled) }
{ }
list.add(this.getStackForType(type)); }
}
}
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public boolean requiresMultipleRenderPasses() public boolean requiresMultipleRenderPasses() {
{ return true;
return true; }
}
@Override @Override
public int getRenderPasses(int meta) public int getRenderPasses(int meta) {
{ return 2;
return 2; }
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon secondIcon; private IIcon secondIcon;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister) public void registerIcons(IIconRegister par1IconRegister) {
{ this.itemIcon = par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":beeCombs.0");
this.itemIcon = par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":beeCombs.0"); this.secondIcon = par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":beeCombs.1");
this.secondIcon = par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":beeCombs.1"); }
}
@Override @Override
public IIcon getIcon(ItemStack stack, int pass) public IIcon getIcon(ItemStack stack, int pass) {
{ return (pass == 0) ? itemIcon : secondIcon;
return (pass == 0) ? itemIcon : secondIcon; }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass) public int getColorFromItemStack(ItemStack stack, int pass) {
{ int meta = Math.max(0, Math.min(CombType.values().length - 1, stack.getItemDamage()));
int meta = Math.max(0, Math.min(CombType.values().length - 1, stack.getItemDamage())); int colour = CombType.values()[meta].getColours()[0];
int colour = CombType.values()[meta].getColours()[0];
if (pass >= 1) if (pass >= 1) {
{ colour = CombType.values()[meta].getColours()[1];
colour = CombType.values()[meta].getColours()[1]; }
}
return colour; return colour;
} }
@Override
public String getItemStackDisplayName(ItemStack stack)
{
return CombType.values()[stack.getItemDamage()].getName();
}
@Override
public int getDamage(ItemStack stack) {
if (CombType.values().length < super.getDamage(stack)) {
stack.setItemDamage(0);
}
return super.getDamage(stack);
}
@Override
public String getItemStackDisplayName(ItemStack stack) {
return CombType.values()[stack.getItemDamage()].getName();
}
@Override
public int getDamage(ItemStack stack) {
if (CombType.values().length < super.getDamage(stack)) {
stack.setItemDamage(0);
}
return super.getDamage(stack);
}
} }
+58 -73
View File
@@ -1,10 +1,10 @@
package magicbees.item; package magicbees.item;
import java.util.List;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.core.Tabs;
import java.util.List;
import magicbees.item.types.DropType; import magicbees.item.types.DropType;
import magicbees.main.utils.compat.ForestryHelper; import magicbees.main.utils.compat.ForestryHelper;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@@ -12,88 +12,73 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import forestry.api.core.Tabs;
public class ItemDrop extends Item public class ItemDrop extends Item {
{ public ItemDrop() {
public ItemDrop() super();
{ this.setCreativeTab(Tabs.tabApiculture);
super(); this.setHasSubtypes(true);
this.setCreativeTab(Tabs.tabApiculture); this.setUnlocalizedName("drop");
this.setHasSubtypes(true); GameRegistry.registerItem(this, "drop");
this.setUnlocalizedName("drop"); }
GameRegistry.registerItem(this, "drop");
}
public ItemStack getStackForType(DropType type) public ItemStack getStackForType(DropType type) {
{ return new ItemStack(this, 1, type.ordinal());
return new ItemStack(this, 1, type.ordinal()); }
}
public ItemStack getStackForType(DropType type, int count) public ItemStack getStackForType(DropType type, int count) {
{ return new ItemStack(this, count, type.ordinal());
return new ItemStack(this, count, type.ordinal()); }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@SuppressWarnings({ "unchecked", "rawtypes" }) @SuppressWarnings({"unchecked", "rawtypes"})
public void getSubItems(Item item, CreativeTabs tabs, List list) public void getSubItems(Item item, CreativeTabs tabs, List list) {
{ for (DropType type : DropType.values()) {
for (DropType type : DropType.values()) list.add(this.getStackForType(type));
{ }
list.add(this.getStackForType(type)); }
}
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public boolean requiresMultipleRenderPasses() public boolean requiresMultipleRenderPasses() {
{ return true;
return true; }
}
@Override @Override
public int getRenderPasses(int metadata) public int getRenderPasses(int metadata) {
{ return 2;
return 2; }
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon secondIcon; private IIcon secondIcon;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister) public void registerIcons(IIconRegister par1IconRegister) {
{ this.itemIcon = par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":honeyDrop.0");
this.itemIcon = par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":honeyDrop.0"); this.secondIcon = par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":honeyDrop.1");
this.secondIcon = par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":honeyDrop.1"); }
}
@Override @Override
public IIcon getIcon(ItemStack stack, int pass) public IIcon getIcon(ItemStack stack, int pass) {
{ return (pass == 0) ? this.itemIcon : this.secondIcon;
return (pass == 0) ? this.itemIcon : this.secondIcon; }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass) public int getColorFromItemStack(ItemStack stack, int pass) {
{ int meta = Math.max(0, Math.min(DropType.values().length - 1, stack.getItemDamage()));
int meta = Math.max(0, Math.min(DropType.values().length - 1, stack.getItemDamage())); int colour = DropType.values()[meta].combColour[0];
int colour = DropType.values()[meta].combColour[0];
if (pass >= 1) if (pass >= 1) {
{ colour = DropType.values()[meta].combColour[1];
colour = DropType.values()[meta].combColour[1]; }
}
return colour; return colour;
} }
@Override
public String getItemStackDisplayName(ItemStack stack)
{
return DropType.values()[stack.getItemDamage()].getName();
}
@Override
public String getItemStackDisplayName(ItemStack stack) {
return DropType.values()[stack.getItemDamage()].getName();
}
} }
+40 -43
View File
@@ -1,5 +1,6 @@
package magicbees.item; package magicbees.item;
import forestry.api.arboriculture.IToolGrafter;
import magicbees.main.Config; import magicbees.main.Config;
import magicbees.main.utils.compat.ThaumcraftHelper; import magicbees.main.utils.compat.ThaumcraftHelper;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@@ -9,53 +10,49 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import forestry.api.arboriculture.IToolGrafter;
public class ItemGrafter extends Item implements IToolGrafter { public class ItemGrafter extends Item implements IToolGrafter {
public ItemGrafter() { public ItemGrafter() {
super(); super();
this.setMaxStackSize(1); this.setMaxStackSize(1);
this.setCreativeTab(forestry.api.core.Tabs.tabArboriculture); this.setCreativeTab(forestry.api.core.Tabs.tabArboriculture);
this.setHarvestLevel("grafter", 3); this.setHarvestLevel("grafter", 3);
} }
@Override @Override
public float getSaplingModifier(ItemStack stack, World world, EntityPlayer player, int x, int y, int z) { public float getSaplingModifier(ItemStack stack, World world, EntityPlayer player, int x, int y, int z) {
return 100f; return 100f;
} }
@Override @Override
public boolean onBlockDestroyed(ItemStack itemstack, World world, Block block, int x, int y, int z, EntityLivingBase entityLiving) { public boolean onBlockDestroyed(
int damage = 1; ItemStack itemstack, World world, Block block, int x, int y, int z, EntityLivingBase entityLiving) {
if (ThaumcraftHelper.isActive()) { int damage = 1;
if (block == ThaumcraftHelper.leaf) if (ThaumcraftHelper.isActive()) {
{ if (block == ThaumcraftHelper.leaf) {
int meta = world.getBlockMetadata(x, y, z) & 1; int meta = world.getBlockMetadata(x, y, z) & 1;
if (meta == 0 || meta == 1) if (meta == 0 || meta == 1) {
{ double chance = Math.random();
double chance = Math.random(); if (chance <= Config.thaumcraftSaplingDroprate) {
if (chance <= Config.thaumcraftSaplingDroprate) this.dropItem(world, x, y, z, new ItemStack(ThaumcraftHelper.plant, 1, meta));
{ }
this.dropItem(world, x, y, z, new ItemStack(ThaumcraftHelper.plant, 1, meta)); }
} }
} }
} itemstack.damageItem(damage, entityLiving);
} return true;
itemstack.damageItem(damage, entityLiving); }
return true;
}
protected void dropItem(World world, int x, int y, int z, ItemStack item) {
if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) {
float f = 0.7F;
double d0 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
double d1 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
double d2 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
EntityItem entityitem = new EntityItem(world, (double)x + d0, (double)y + d1, (double)z + d2, item);
entityitem.delayBeforeCanPickup = 10;
world.spawnEntityInWorld(entityitem);
}
}
protected void dropItem(World world, int x, int y, int z, ItemStack item) {
if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) {
float f = 0.7F;
double d0 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
double d1 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
double d2 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
EntityItem entityitem = new EntityItem(world, (double) x + d0, (double) y + d1, (double) z + d2, item);
entityitem.delayBeforeCanPickup = 10;
world.spawnEntityInWorld(entityitem);
}
}
} }
+25 -27
View File
@@ -1,43 +1,41 @@
package magicbees.item; package magicbees.item;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import magicbees.block.types.HiveType; import magicbees.block.types.HiveType;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/** /**
* Created by Allen on 7/29/2014. * Created by Allen on 7/29/2014.
*/ */
public class ItemMagicHive extends ItemBlock public class ItemMagicHive extends ItemBlock {
{ public ItemMagicHive(Block block) {
public ItemMagicHive(Block block) super(block);
{ setMaxDamage(0);
super(block); setHasSubtypes(true);
setMaxDamage(0); }
setHasSubtypes(true);
}
@Override @Override
public int getMetadata(int i) { public int getMetadata(int i) {
return i; return i;
} }
protected Block getBlock() { protected Block getBlock() {
return field_150939_a; return field_150939_a;
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override @Override
public IIcon getIconFromDamage(int meta) { public IIcon getIconFromDamage(int meta) {
return this.getBlock().getIcon(1, meta); return this.getBlock().getIcon(1, meta);
} }
@Override @Override
public String getUnlocalizedName(ItemStack itemstack) public String getUnlocalizedName(ItemStack itemstack) {
{ return getBlock().getUnlocalizedName() + "."
return getBlock().getUnlocalizedName() + "." + HiveType.getHiveFromMeta(itemstack.getItemDamage()).name().toLowerCase(); + HiveType.getHiveFromMeta(itemstack.getItemDamage()).name().toLowerCase();
} }
} }
@@ -3,6 +3,10 @@ package magicbees.item;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.apiculture.IBee;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.apiculture.IHiveFrame;
import magicbees.item.types.HiveFrameType; import magicbees.item.types.HiveFrameType;
import magicbees.main.CommonProxy; import magicbees.main.CommonProxy;
import magicbees.main.utils.TabMagicBees; import magicbees.main.utils.TabMagicBees;
@@ -10,55 +14,45 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import forestry.api.apiculture.IBee; public class ItemMagicHiveFrame extends Item implements IHiveFrame {
import forestry.api.apiculture.IBeeHousing; private HiveFrameType type;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.apiculture.IHiveFrame;
public class ItemMagicHiveFrame extends Item implements IHiveFrame public ItemMagicHiveFrame(HiveFrameType frameType) {
{ super();
private HiveFrameType type; this.type = frameType;
this.setMaxDamage(this.type.maxDamage);
this.setMaxStackSize(1);
this.setCreativeTab(TabMagicBees.tabMagicBees);
this.setUnlocalizedName("frame" + frameType.getName());
GameRegistry.registerItem(this, "frame" + frameType.getName());
}
public ItemMagicHiveFrame(HiveFrameType frameType) @SideOnly(Side.CLIENT)
{ public void registerIcons(IIconRegister par1IconRegister) {
super(); this.itemIcon = par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":frame" + type.getName());
this.type = frameType; }
this.setMaxDamage(this.type.maxDamage);
this.setMaxStackSize(1);
this.setCreativeTab(TabMagicBees.tabMagicBees);
this.setUnlocalizedName("frame" + frameType.getName());
GameRegistry.registerItem(this, "frame" + frameType.getName());
}
@SideOnly(Side.CLIENT) // --------- IHiveFrame functions -----------------------------------------
public void registerIcons(IIconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":frame" + type.getName());
}
// --------- IHiveFrame functions ----------------------------------------- @Override
public ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear) {
frame.setItemDamage(frame.getItemDamage() + wear);
@Override if (frame.getItemDamage() >= frame.getMaxDamage()) {
public ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear) { // Break the frame.
frame.setItemDamage(frame.getItemDamage() + wear); frame = null;
}
if (frame.getItemDamage() >= frame.getMaxDamage()) { return frame;
// Break the frame. }
frame = null;
}
return frame; @Override
} public IBeeModifier getBeeModifier() {
return type;
@Override }
public IBeeModifier getBeeModifier() {
return type;
}
@Override
public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2)
{
return false;
}
@Override
public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) {
return false;
}
} }
@@ -1,5 +1,8 @@
package magicbees.item; package magicbees.item;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import magicbees.main.CommonProxy; import magicbees.main.CommonProxy;
import magicbees.main.utils.compat.BotaniaHelper; import magicbees.main.utils.compat.BotaniaHelper;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@@ -8,48 +11,47 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import vazkii.botania.api.mana.IManaUsingItem; import vazkii.botania.api.mana.IManaUsingItem;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@Optional.InterfaceList({ @Optional.InterfaceList({
@Optional.Interface(iface = "vazkii.botania.api.mana.IManaUsingItem", modid = BotaniaHelper.Name, striprefs = true) @Optional.Interface(iface = "vazkii.botania.api.mana.IManaUsingItem", modid = BotaniaHelper.Name, striprefs = true)
}) })
public class ItemManasteelGrafter extends ItemGrafter implements IManaUsingItem { public class ItemManasteelGrafter extends ItemGrafter implements IManaUsingItem {
public static final int MANA_PER_DAMAGE = 90; public static final int MANA_PER_DAMAGE = 90;
public ItemManasteelGrafter() { public ItemManasteelGrafter() {
super(); super();
this.setMaxDamage(15); this.setMaxDamage(15);
this.setUnlocalizedName("manasteelGrafter"); this.setUnlocalizedName("manasteelGrafter");
} }
@Override @Override
@Optional.Method(modid = BotaniaHelper.Name) @Optional.Method(modid = BotaniaHelper.Name)
public boolean getIsRepairable(ItemStack toolStack, ItemStack material) { public boolean getIsRepairable(ItemStack toolStack, ItemStack material) {
return (material.getItem() == BotaniaHelper.itemManaResource && material.getItemDamage() == BotaniaHelper.ManaResource.MANASTEEL.ordinal()) || super.getIsRepairable(toolStack, material); return (material.getItem() == BotaniaHelper.itemManaResource
} && material.getItemDamage() == BotaniaHelper.ManaResource.MANASTEEL.ordinal())
|| super.getIsRepairable(toolStack, material);
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister) { public void registerIcons(IIconRegister iconRegister) {
this.itemIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":manasteelGrafter"); this.itemIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":manasteelGrafter");
} }
@Override @Override
public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5) { public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5) {
// Unsure if the server-side exclusion is necessary, but boy it looks disconcerting on the client if it's in. // Unsure if the server-side exclusion is necessary, but boy it looks disconcerting on the client if it's in.
if (/*!world.isRemote && */stack.getItemDamage() > 0 && player instanceof EntityPlayer) { if (
if (BotaniaHelper.requestMana(stack, (EntityPlayer)player, MANA_PER_DAMAGE, 1)) { /*!world.isRemote && */ stack.getItemDamage() > 0 && player instanceof EntityPlayer) {
stack.setItemDamage(stack.getItemDamage() - 1); if (BotaniaHelper.requestMana(stack, (EntityPlayer) player, MANA_PER_DAMAGE, 1)) {
} stack.setItemDamage(stack.getItemDamage() - 1);
} }
} }
}
@Override
public boolean usesMana(ItemStack arg0) {
return true;
}
@Override
public boolean usesMana(ItemStack arg0) {
return true;
}
} }
@@ -1,5 +1,9 @@
package magicbees.item; package magicbees.item;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.core.IToolScoop;
import magicbees.main.CommonProxy; import magicbees.main.CommonProxy;
import magicbees.main.utils.compat.BotaniaHelper; import magicbees.main.utils.compat.BotaniaHelper;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@@ -11,57 +15,57 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import vazkii.botania.api.mana.IManaUsingItem; import vazkii.botania.api.mana.IManaUsingItem;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.core.IToolScoop;
@Optional.InterfaceList({ @Optional.InterfaceList({
@Optional.Interface(iface = "vazkii.botania.api.mana.IManaUsingItem", modid = BotaniaHelper.Name, striprefs = true) @Optional.Interface(iface = "vazkii.botania.api.mana.IManaUsingItem", modid = BotaniaHelper.Name, striprefs = true)
}) })
public class ItemManasteelScoop extends Item implements IManaUsingItem, IToolScoop { public class ItemManasteelScoop extends Item implements IManaUsingItem, IToolScoop {
public static final int MANA_PER_DAMAGE = 30; public static final int MANA_PER_DAMAGE = 30;
public ItemManasteelScoop() { public ItemManasteelScoop() {
super(); super();
this.maxStackSize = 1; this.maxStackSize = 1;
this.setMaxDamage(20); this.setMaxDamage(20);
this.setCreativeTab(forestry.api.core.Tabs.tabApiculture); this.setCreativeTab(forestry.api.core.Tabs.tabApiculture);
this.setUnlocalizedName("manasteelScoop"); this.setUnlocalizedName("manasteelScoop");
this.setHarvestLevel("scoop", 3); this.setHarvestLevel("scoop", 3);
} }
@Override @Override
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase player) { public boolean onBlockDestroyed(
stack.damageItem(1, player); ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase player) {
return true; stack.damageItem(1, player);
} return true;
}
@Override @Override
public boolean usesMana(ItemStack stack) { public boolean usesMana(ItemStack stack) {
return true; return true;
} }
@Override @Override
@Optional.Method(modid = BotaniaHelper.Name) @Optional.Method(modid = BotaniaHelper.Name)
public boolean getIsRepairable(ItemStack toolStack, ItemStack material) { public boolean getIsRepairable(ItemStack toolStack, ItemStack material) {
return (material.getItem() == BotaniaHelper.itemManaResource && material.getItemDamage() == BotaniaHelper.ManaResource.MANASTEEL.ordinal()) || super.getIsRepairable(toolStack, material); return (material.getItem() == BotaniaHelper.itemManaResource
} && material.getItemDamage() == BotaniaHelper.ManaResource.MANASTEEL.ordinal())
|| super.getIsRepairable(toolStack, material);
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister) { public void registerIcons(IIconRegister iconRegister) {
this.itemIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":manasteelScoop"); this.itemIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":manasteelScoop");
} }
@Override @Override
public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5) { public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5) {
// Unsure if the server-side exclusion is necessary, but boy it looks disconcerting on the client if it's in. // Unsure if the server-side exclusion is necessary, but boy it looks disconcerting on the client if it's in.
if (/*!world.isRemote && */stack.getItemDamage() > 0 && player instanceof EntityPlayer) { if (
if (BotaniaHelper.requestMana(stack, (EntityPlayer)player, MANA_PER_DAMAGE, 1)) { /*!world.isRemote && */ stack.getItemDamage() > 0 && player instanceof EntityPlayer) {
stack.setItemDamage(stack.getItemDamage() - 1); if (BotaniaHelper.requestMana(stack, (EntityPlayer) player, MANA_PER_DAMAGE, 1)) {
} stack.setItemDamage(stack.getItemDamage() - 1);
} }
} }
}
} }
@@ -1,10 +1,9 @@
package magicbees.item; package magicbees.item;
import java.util.List;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import magicbees.item.types.ResourceType; import magicbees.item.types.ResourceType;
import magicbees.main.CommonProxy; import magicbees.main.CommonProxy;
import magicbees.main.utils.TabMagicBees; import magicbees.main.utils.TabMagicBees;
@@ -14,63 +13,52 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
public class ItemMiscResources extends Item public class ItemMiscResources extends Item {
{ private IIcon[] icons = new IIcon[ResourceType.values().length];
private IIcon[] icons = new IIcon[ResourceType.values().length];
public ItemMiscResources() public ItemMiscResources() {
{ super();
super(); this.setCreativeTab(TabMagicBees.tabMagicBees);
this.setCreativeTab(TabMagicBees.tabMagicBees); this.setHasSubtypes(true);
this.setHasSubtypes(true); this.setUnlocalizedName("miscResources");
this.setUnlocalizedName("miscResources"); GameRegistry.registerItem(this, "miscResources");
GameRegistry.registerItem(this, "miscResources"); }
}
public ItemStack getStackForType(ResourceType type) public ItemStack getStackForType(ResourceType type) {
{ return new ItemStack(this, 1, type.ordinal());
return new ItemStack(this, 1, type.ordinal()); }
}
public ItemStack getStackForType(ResourceType type, int count) public ItemStack getStackForType(ResourceType type, int count) {
{ return new ItemStack(this, count, type.ordinal());
return new ItemStack(this, count, type.ordinal()); }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@SuppressWarnings({ "unchecked", "rawtypes" }) @SuppressWarnings({"unchecked", "rawtypes"})
public void getSubItems(Item item, CreativeTabs tabs, List list) public void getSubItems(Item item, CreativeTabs tabs, List list) {
{ for (ResourceType type : ResourceType.values()) {
for (ResourceType type : ResourceType.values()) if (type.showInList) {
{ list.add(this.getStackForType(type));
if (type.showInList) }
{ }
list.add(this.getStackForType(type)); }
}
}
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister) public void registerIcons(IIconRegister par1IconRegister) {
{ for (int i = 0; i < ResourceType.values().length; i++) {
for (int i = 0; i < ResourceType.values().length; i++) this.icons[i] =
{ par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":" + ResourceType.values()[i].getName());
this.icons[i] = par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":" + ResourceType.values()[i].getName()); }
} }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int meta) public IIcon getIconFromDamage(int meta) {
{ return icons[meta];
return icons[meta]; }
}
@Override
public String getItemStackDisplayName(ItemStack stack)
{
return ResourceType.values()[stack.getItemDamage()].getLocalizedName();
}
@Override
public String getItemStackDisplayName(ItemStack stack) {
return ResourceType.values()[stack.getItemDamage()].getLocalizedName();
}
} }
Loaded 100 of 185 files, more files were not shown because too many files have changed in this diff. Show more