Compare commits

...
53 Commits
Author SHA1 Message Date
Martin Robertz 097c0c62e4 update 2025-05-11 12:58:32 +02:00
c04775398a Polishes Alchemic Calcinator & Belljars (#79)
Co-authored-by: Martin Robertz <[email protected]>
Co-authored-by: Maya <[email protected]>
Co-authored-by: koolkrafter5 <[email protected]>
2025-05-11 01:20:27 -04:00
Srdra 62789ce20b Lil fix for PR #83, shift down Purpura yet another tier (#84) 2025-05-10 10:50:29 -05:00
Srdra 8685e1fd72 Buff the Incenses in the Incense Crucible (#83) 2025-05-09 17:02:10 -05:00
koolkrafter5 6b016444ba Enable Jabel and Generic Injection (#82) 2025-05-07 23:49:37 -04:00
Maya 1552b81459 update 2025-05-07 11:05:13 -05:00
koolkrafter5 5e6c4e848c Migrate StructureLib Blood Altar handler from StructureCompat (#81) 2025-05-07 15:54:48 +00:00
koolkrafter5andMaya 9f2d0b5241 Big item refactor (#73)
Co-authored-by: Maya <[email protected]>
2025-05-07 15:43:45 +00:00
Martin Robertz e75e9f778a update 2025-05-04 12:50:51 +02:00
FourIsTheNumber 6bd083125a Add config to disable potion flask repairability (#80) 2025-05-01 09:33:46 +02:00
Martin Robertz 09fbb5574b update 2025-04-25 13:43:04 +02:00
Guillaume Mercier 559e2439b2 Remove Profanity (#78) 2025-04-25 14:50:10 +08:00
Martin Robertz ef17235ae5 update 2025-04-20 21:45:39 +02:00
ABKQPOandMaya efe1e6044a Fix Mark of the Falling Tower does not check item stack and does not immediately remove entities (#75)
Co-authored-by: Maya <[email protected]>
2025-04-19 14:38:37 +00:00
koolkrafter5andMaya 14a4825e33 More comma-separation (#74)
Co-authored-by: Maya <[email protected]>
2025-04-19 14:31:10 +00:00
koolkrafter5 f5791ff631 Fix rituals not working when doDaylightCycle is set to false. (#72) 2025-04-19 09:28:39 -05:00
Maya ead07b752b Show LP comma-separated with divination sigil (#71) 2025-04-09 01:23:09 -05:00
Maya d821098d4e update 2025-04-08 23:43:52 -05:00
koolkrafter5andMaya 8762c24331 Ritual of Speed bugfix and cleanup (#70)
Co-authored-by: Maya <[email protected]>
2025-04-09 04:42:00 +00:00
koolkrafter5andMaya a1f62e0db6 NEI Meteor Oredict Support (#69)
Co-authored-by: Maya <[email protected]>
2025-04-08 19:57:01 +00:00
koolkrafter5 242312bee5 Config to Allow Altar Components to be Any Block (#68) 2025-04-08 14:52:16 -05:00
Martin Robertz c0b4b797c8 update 2025-01-22 18:39:05 +01:00
koolkrafter5 bd584c6d52 New TypeAdapter for ItemStack (#67) 2025-01-21 23:59:50 -06:00
Martin Robertz ac50cfc691 update 2025-01-21 17:26:09 +01:00
koolkrafter5 7e607b4c58 Misc. interconnected meteor loose ends and code cleanup (#66) 2025-01-21 08:49:56 -06:00
koolkrafter5 e629d04310 GSON Hotfix (#65) 2025-01-18 17:11:06 -06:00
Martin Robertz 52b4415e8c update 2025-01-18 22:28:14 +01:00
koolkrafter5andMartin Robertz 3f9641b861 Make meteor reagents completely configurable and add some new options to their functionality. (#63)
Co-authored-by: Martin Robertz <[email protected]>
2025-01-18 08:04:42 +01:00
Martin Robertz 1fd6ac323b update 2025-01-17 12:08:59 +01:00
Ruling-0 38f2dbb395 Fix ability to int overflow when adding to LP network (#64) 2025-01-17 05:37:09 +00:00
Martin Robertz 84e41cc920 update 2024-12-30 20:23:52 +01:00
glowredman 5bfdabb5f6 Add Localizations (#62) 2024-12-30 12:01:57 -06:00
Maya 2e95450cf0 update 2024-11-23 07:53:02 -06:00
Martin Robertz 8ff0421f55 update 2024-11-22 20:59:50 +01:00
koolkrafter5 ba0a0e3357 Readd Meteor Filler (#60) 2024-11-22 17:38:56 +01:00
FabbozandMartin Robertz 222ad1645e LP Hud fix (#59)
* LP Hud fix

* fix lpHud 2

* Add files via upload

* sa

* update deps

---------

Co-authored-by: Martin Robertz <[email protected]>
2024-10-20 12:08:50 +02:00
Alexdoru 7b48d96988 make static final fields of RitualEffectWellOfSuffering public (#58) 2024-09-13 21:11:38 +02:00
Martin Robertz baa2336b58 update 2024-09-06 23:08:27 +02:00
Jason Mitchell 1341be8f49 Make waila optional (#56)
* Make waila optional
2024-09-06 16:20:45 +00:00
NotAPenguin 89eaa78e51 update gt and fix name (#55) 2024-09-03 11:50:50 +02:00
Lyfts a7d6f8e59b Fix teleposer unable to teleport to the end (#54)
* update deps

* fix teleposer unable to teleport to the end
2024-05-19 12:51:13 +02:00
Martin Robertz 6c18cd1bee update 2024-05-10 11:20:30 +02:00
LyftsGitHub GTNH Actionsgithub-actions[bot]
fcddb56254 Fix client-side crash on servers (#52)
* update deps

* fix client crash on servers

* spotlessApply (#53)

Co-authored-by: GitHub GTNH Actions <>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-05-10 09:36:17 +02:00
Martin Robertz 4a185d64cb update 2024-05-03 19:45:10 +02:00
Guillaume Mercier e14b1f23c9 Add new rune to reduce the delay between crafts (#51)
* add layout.json to gitignore

* Add quickness rune

This rune reduces the delay between consecutive crafts. This is done by essentially scheduling a recipe check every time a recipe completes. Using something like a world accelerator will have no effect on the frequency and the runes themselves do not increase the frequency at which the altar naturally checks for updates.

This commit also addresses a couple other issues with the altar.
- since the altar was using the world time and not the world age, some mechanics were impossible to trigger if you set doDaylightCycle to false.
- For example it was impossible to start a craft if the time wasn't set to a multiple of 100.
2024-05-03 07:09:58 +02:00
Martin Robertz 0b70f3ed51 update 2024-03-25 18:08:13 +01:00
Abdiel Kavash 1c8ceacb7f New formats for meteor config file. (#50) 2024-03-25 16:12:09 +01:00
Raven Szewczyk 3037e0f583 [ci skip] upgraded build system 2024-02-04 19:57:12 +00:00
Martin Robertz 269eff14d3 update bs+deps 2024-01-21 20:31:44 +01:00
Abdiel KavashandMartin Robertz ff2f889c76 Ritual of Gaia's Transformation fixes. (#49)
* Added server->client notification of biome change.

* Fix floating point inaccuracy.

* Replaced inefficient search algorithm.

* Move structure initialization out of a loop. Oops.

* update bs+deps+gardle

* fix wci

* one more

* Always send full 32 bytes with every message.

---------

Co-authored-by: Martin Robertz <[email protected]>
2024-01-21 20:30:57 +01:00
Martin Robertz 3218730853 update deps+bs 2024-01-11 22:58:42 +01:00
Raven Szewczyk e5662ec707 [ci skip] upgraded build system 2024-01-08 21:24:16 +00:00
miozune 6376f78aa5 Fix tooltip for meteor NEI (#48)
* updateBuildScript

* Update dependencies

* Fix warning with AT

* Fix tooltip for meteor NEI
2023-08-08 10:05:01 +02:00
159 changed files with 2990 additions and 3824 deletions

No files matched your search

+1
View File
@@ -27,3 +27,4 @@ whitelist.json
*.iws *.iws
src/main/resources/mixins.*.json src/main/resources/mixins.*.json
*.bat *.bat
layout.json
+2 -1509
View File
File diff suppressed because it is too large. Load diff
+13 -11
View File
@@ -23,20 +23,22 @@
*/ */
dependencies { dependencies {
api("com.github.GTNewHorizons:waila:1.6.0:dev") api("com.github.GTNewHorizons:waila:1.8.4:dev")
api("com.github.GTNewHorizons:NotEnoughItems:2.3.63-GTNH:dev") api("com.github.GTNewHorizons:NotEnoughItems:2.7.40-GTNH:dev")
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.43.111:dev") {transitive = false } compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.51.275:dev") {transitive = false }
compileOnly("com.github.GTNewHorizons:Botania:1.9.23-GTNH:api") {transitive = false } compileOnly("com.github.GTNewHorizons:Botania:1.12.6-GTNH:api") {transitive = false }
compileOnly("com.github.GTNewHorizons:ForestryMC:4.6.10:api") {transitive = false } compileOnly("com.github.GTNewHorizons:ForestryMC:4.10.7:api") {transitive = false }
compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.3.4:dev") {transitive = false } compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.6.2:dev") {transitive = false }
compileOnly("com.github.GTNewHorizons:Chisel:2.11.3-GTNH:api") {transitive = false }
compileOnly("com.github.GTNewHorizons:Chisel:2.16.4-GTNH:api") {transitive = false }
compileOnly("com.github.GTNewHorizons:ZenScript:1.0.0-GTNH") {transitive = false } compileOnly("com.github.GTNewHorizons:ZenScript:1.0.0-GTNH") {transitive = false }
compileOnly("com.github.GTNewHorizons:CraftTweaker:3.2.12:dev") {transitive = false } compileOnly("com.github.GTNewHorizons:CraftTweaker:3.4.1:dev") {transitive = false }
compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") {transitive = false } compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") {transitive = false }
compileOnly("curse.maven:guide-api-228832:2287185") {transitive = false } compileOnly("curse.maven:guide-api-228832:2287185") {transitive = false }
compileOnly("com.github.GTNewHorizons:StructureLib:1.4.10:dev")
} }
+163 -28
View File
@@ -1,68 +1,203 @@
modName = Blood Magic: Alchemical Wizardry # ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
# LOCAL to test local config updates.
gtnh.settings.blowdryerTag = 0.2.0
# This is a case-sensitive string to identify your mod. Convention is to use lower case. # Human-readable mod name, available for mcmod.info population.
modName = Blood Magic\: Alchemical Wizardry
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
# Conventionally lowercase.
modId = AWWayofTime modId = AWWayofTime
# Root package of the mod, used to find various classes in other properties,
# mcmod.info substitution, enabling assertions in run tasks, etc.
modGroup = WayofTime.alchemicalWizardry modGroup = WayofTime.alchemicalWizardry
# WHY is there no version field? # Whether to use modGroup as the maven publishing group.
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the # When false, com.github.GTNewHorizons is used.
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/ useModGroupForPublishing = false
# Will update your build.gradle automatically whenever an update is available # Updates your build.gradle and settings.gradle automatically whenever an update is available.
autoUpdateBuildScript = false autoUpdateBuildScript = false
# Version of Minecraft to target
minecraftVersion = 1.7.10 minecraftVersion = 1.7.10
# Version of Minecraft Forge to target
forgeVersion = 10.13.4.1614 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 # Specify an MCP channel for dependency deobfuscation and the deobfParams task.
# restart Minecraft in development. Choose this dependent on your mod: channel = stable
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
developmentEnvironmentUserName = "Developer"
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
mappingsVersion = 12
# Generate a class with String fields for the mod id, name, version and group name named with the fields below # Defines other MCP mappings for dependency deobfuscation.
generateGradleTokenClass =WayofTime.alchemicalWizardry.Tags remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
gradleTokenModId =
gradleTokenModName = # Select a default username for testing your mod. You can always override this per-run by running
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
developmentEnvironmentUserName = Developer
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
enableModernJavaSyntax = true
# Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
enableGenericInjection = true
# Generate a class with a String field for the mod version named as defined below.
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
generateGradleTokenClass = WayofTime.alchemicalWizardry.Tags
# Name of the token containing the project's current version to generate/replace.
gradleTokenVersion = VERSION gradleTokenVersion = VERSION
# [DEPRECATED] Mod ID replacement token.
gradleTokenModId =
# [DEPRECATED] Mod name replacement token.
gradleTokenModName =
# [DEPRECATED] Mod Group replacement token.
gradleTokenGroupName = gradleTokenGroupName =
# [DEPRECATED] # [DEPRECATED]
# Multiple source files can be defined here by providing a comma-seperated list: Class1.java,Class2.java,Class3.java # Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION"; # public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's # The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...]) # version in @Mod([...], version = VERSION, [...]).
# Leave these properties empty to skip individual token replacements # Leave these properties empty to skip individual token replacements.
replaceGradleTokenInFile = replaceGradleTokenInFile =
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can # 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. # leave this property empty.
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api # Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
apiPackage = api apiPackage = api
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/ # Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# Example value: mymodid_at.cfg # There can be multiple files in a space-separated list.
accessTransformersFile = # Example value: mymodid_at.cfg nei_at.cfg
accessTransformersFile = NEI_at.cfg
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled! # Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false usesMixins = false
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
# Mixin classes will have access to "main" classes, but not the other way around.
separateMixinSourceSet =
# Adds some debug arguments like verbose output and class export.
usesMixinDebug = false
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise. # Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin = mixinPlugin =
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail! # Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage = mixinsPackage =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin! # Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatability only # This parameter is for legacy compatibility only
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin # Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
coreModClass = coreModClass =
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class # 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! # that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly = false containsMixinsAndOrCoreModOnly = false
# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your # Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
# responsibility check the licence and request permission for distribution, if required. forceEnableMixins = false
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
# responsibility to check the license and request permission for distribution if required.
usesShadowedDependencies = false usesShadowedDependencies = false
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older # If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
# their own classes, making the minimization unreliable.
minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
# list of strings, with the acceptable keys being(case does not matter):
# cursemaven
# modrinth
excludeWellKnownRepositories =
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
usesMavenPublishing = true
# Maven repository to publish the mod to.
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
#
# The project's ID on Modrinth. Can be either the slug or the ID.
# Leave this empty if you don't want to publish to Modrinth.
modrinthProjectId =
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
# Syntax: scope1-type1:name1;scope2-type2:name2;...
# Where scope can be one of [required, optional, incompatible, embedded],
# type can be one of [project, version],
# and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
#
# The project's numeric ID on CurseForge. You can find this in the About Project box.
# Leave this empty if you don't want to publish on CurseForge.
curseForgeProjectId =
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
# Syntax: type1:name1;type2:name2;...
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
# and the name is the CurseForge project slug of the other mod.
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
curseForgeRelations =
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
# projects. New projects should not use this parameter. # projects. New projects should not use this parameter.
customArchiveBaseName = BloodMagic customArchiveBaseName = BloodMagic
# Optional parameter to have the build automatically fail if an illegal version is used.
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
# The check is ONLY performed if the version is a git tag.
# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+
# versionPattern =
# Uncomment to prevent the source code from being published.
# noPublishedSources = true
# Uncomment this to disable Spotless checks.
# This should only be uncommented to keep it easier to sync with upstream/other forks.
# That is, if there is no other active fork/upstream, NEVER change this.
# disableSpotless = true
# Uncomment this to disable Checkstyle checks (currently wildcard import check).
disableCheckstyle = true
# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
# (force use delegated build).
# This is meant to be set in $HOME/.gradle/gradle.properties.
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build.
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
# ideaOverrideBuildType = idea
# Whether IDEA should run spotless checks when pressing the Build button.
# This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true
Binary file not shown.
+2 -1
View File
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
Vendored
+20 -13
View File
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@@ -83,10 +85,8 @@ done
# This is normally unused # This is normally unused
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# 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. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@@ -133,10 +133,13 @@ location of your Java installation."
fi fi
else else
JAVACMD=java JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
@@ -144,7 +147,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045 # shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
@@ -152,7 +155,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045 # shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@@ -197,11 +200,15 @@ if "$cygwin" || "$msys" ; then
done done
fi fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
# shell script including quotes and variable substitutions, so put them in DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded. # Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \
Vendored
+12 -10
View File
@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute if %ERRORLEVEL% equ 0 goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail
@@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute if exist "%JAVA_EXE%" goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail
+5 -10
View File
@@ -4,10 +4,10 @@ pluginManagement {
maven { maven {
// RetroFuturaGradle // RetroFuturaGradle
name "GTNH Maven" name "GTNH Maven"
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" url "https://nexus.gtnewhorizons.com/repository/public/"
allowInsecureProtocol = true
mavenContent { mavenContent {
includeGroup("com.gtnewhorizons.retrofuturagradle") includeGroup("com.gtnewhorizons")
includeGroupByRegex("com\\.gtnewhorizons\\..+")
} }
} }
gradlePluginPortal() gradlePluginPortal()
@@ -17,12 +17,7 @@ pluginManagement {
} }
plugins { plugins {
id 'com.diffplug.blowdryerSetup' version '1.6.0' id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.38'
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains
} }
blowdryerSetup {
repoSubfolder 'gtnhShared'
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
//devLocal '.' // Use this when testing config updates locally
}
@@ -250,7 +250,8 @@ import WayofTime.alchemicalWizardry.common.spell.simple.SpellTeleport;
import WayofTime.alchemicalWizardry.common.spell.simple.SpellWateryGrave; import WayofTime.alchemicalWizardry.common.spell.simple.SpellWateryGrave;
import WayofTime.alchemicalWizardry.common.spell.simple.SpellWindGust; import WayofTime.alchemicalWizardry.common.spell.simple.SpellWindGust;
import WayofTime.alchemicalWizardry.common.summoning.SummoningHelperAW; import WayofTime.alchemicalWizardry.common.summoning.SummoningHelperAW;
import WayofTime.alchemicalWizardry.common.summoning.meteor.Meteor; import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorReagentRegistry;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorRegistry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator; import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar; import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar;
@@ -276,6 +277,7 @@ import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
import WayofTime.alchemicalWizardry.common.tileEntity.gui.GuiHandler; import WayofTime.alchemicalWizardry.common.tileEntity.gui.GuiHandler;
import WayofTime.alchemicalWizardry.common.tweaker.MineTweakerIntegration; import WayofTime.alchemicalWizardry.common.tweaker.MineTweakerIntegration;
import WayofTime.alchemicalWizardry.compat.BloodMagicWailaPlugin; import WayofTime.alchemicalWizardry.compat.BloodMagicWailaPlugin;
import WayofTime.alchemicalWizardry.compat.structurelib.CompatStructureLib;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod;
@@ -307,6 +309,8 @@ public class AlchemicalWizardry {
public static boolean parseTextFiles = false; public static boolean parseTextFiles = false;
public static int defaultMeteorCost = 1000000;
public static String defaultMeteorBlock;
public static boolean doMeteorsDestroyBlocks = true; public static boolean doMeteorsDestroyBlocks = true;
public static String[] allowedCrushedOresArray; public static String[] allowedCrushedOresArray;
@@ -490,6 +494,7 @@ public class AlchemicalWizardry {
public static boolean causeHungerWithRegen; public static boolean causeHungerWithRegen;
public static boolean causeHungerChatMessage = true; public static boolean causeHungerChatMessage = true;
public static boolean disableBoundToolsRightClick; public static boolean disableBoundToolsRightClick;
public static boolean allowPotionRepair;
public static BlockStack[] secondTierRunes = new BlockStack[10]; public static BlockStack[] secondTierRunes = new BlockStack[10];
public static BlockStack[] thirdTierRunes = new BlockStack[10]; public static BlockStack[] thirdTierRunes = new BlockStack[10];
@@ -620,35 +625,12 @@ public class AlchemicalWizardry {
@EventHandler @EventHandler
public void preInit(FMLPreInitializationEvent event) { public void preInit(FMLPreInitializationEvent event) {
File bmDirectory = new File("config/BloodMagic/schematics");
if (!bmDirectory.exists() && bmDirectory.mkdirs()) { generateDefaultConfig(
try { "config/BloodMagic/schematics",
InputStream in = AlchemicalWizardry.class "/assets/alchemicalwizardry/schematics/building/buildings.zip");
.getResourceAsStream("/assets/alchemicalwizardry/schematics/building/buildings.zip"); generateDefaultConfig("config/BloodMagic/meteors", "/assets/alchemicalwizardry/meteors/meteors.zip");
logger.info("none yet!"); generateDefaultConfig("config/BloodMagic/meteors/reagents", "/assets/alchemicalwizardry/meteors/reagents.zip");
if (in != null) {
logger.info("I have found a zip!");
ZipInputStream zipStream = new ZipInputStream(in);
ZipEntry entry;
while ((entry = zipStream.getNextEntry()) != null) {
File file = new File(bmDirectory, entry.getName());
if (file.exists() && file.length() > 3L) {
continue;
}
FileOutputStream out = new FileOutputStream(file);
byte[] buffer = new byte[8192];
int len;
while ((len = zipStream.read(buffer)) != -1) {
out.write(buffer, 0, len);
}
out.close();
}
}
} catch (Exception e) {}
}
TEDemonPortal.loadBuildingList(); TEDemonPortal.loadBuildingList();
@@ -707,6 +689,42 @@ public class AlchemicalWizardry {
ModAchievements.init(); ModAchievements.init();
} }
/**
* Attempt to generate default configs at the given destination using a zip located at the given source.
*
* @param destination The destination path for the config, starting inside .minecraft.
* @param source The source path for the config's zip, starting in src/main/resources/
*/
private static void generateDefaultConfig(String destination, String source) {
File destinationDirectory = new File(destination);
if (!destinationDirectory.exists() && destinationDirectory.mkdirs()) {
try {
InputStream in = AlchemicalWizardry.class.getResourceAsStream(source);
logger.info("Attempting to load default config for {}", destinationDirectory);
if (in != null) {
logger.info("Unpacking zip found at {}", source);
ZipInputStream zipStream = new ZipInputStream(in);
ZipEntry entry;
while ((entry = zipStream.getNextEntry()) != null) {
File file = new File(destinationDirectory, entry.getName());
if (file.exists() && file.length() > 3L) {
continue;
}
FileOutputStream out = new FileOutputStream(file);
byte[] buffer = new byte[8192];
int len;
while ((len = zipStream.read(buffer)) != -1) {
out.write(buffer, 0, len);
}
out.close();
}
}
} catch (Exception e) {}
}
}
@EventHandler @EventHandler
public void load(FMLInitializationEvent event) { public void load(FMLInitializationEvent event) {
int craftingConstant = OreDictionary.WILDCARD_VALUE; int craftingConstant = OreDictionary.WILDCARD_VALUE;
@@ -718,8 +736,9 @@ public class AlchemicalWizardry {
proxy.registerEntities(); proxy.registerEntities();
proxy.registerEntityTrackers(); proxy.registerEntityTrackers();
proxy.registerEvents(); proxy.registerEvents();
BloodMagicWailaPlugin.init(); if (Loader.isModLoaded("Waila")) {
BloodMagicWailaPlugin.init();
}
// ItemStacks used for crafting go here // ItemStacks used for crafting go here
ItemStack lapisStack = new ItemStack(Items.dye, 1, 4); ItemStack lapisStack = new ItemStack(Items.dye, 1, 4);
ItemStack lavaBucketStack = new ItemStack(Items.lava_bucket); ItemStack lavaBucketStack = new ItemStack(Items.lava_bucket);
@@ -766,6 +785,7 @@ public class AlchemicalWizardry {
ItemStack bloodRuneCraftedStack = new ItemStack(ModBlocks.bloodRune, 1); ItemStack bloodRuneCraftedStack = new ItemStack(ModBlocks.bloodRune, 1);
ItemStack bloodRuneStack = new ItemStack(ModBlocks.bloodRune); ItemStack bloodRuneStack = new ItemStack(ModBlocks.bloodRune);
ItemStack speedRuneStack = new ItemStack(ModBlocks.speedRune); ItemStack speedRuneStack = new ItemStack(ModBlocks.speedRune);
ItemStack accelerationRuneStack = new ItemStack(ModBlocks.bloodRune, 1, 5);
ItemStack runeOfSacrificeStack = new ItemStack(ModBlocks.runeOfSacrifice); ItemStack runeOfSacrificeStack = new ItemStack(ModBlocks.runeOfSacrifice);
ItemStack runeOfSelfSacrificeStack = new ItemStack(ModBlocks.runeOfSelfSacrifice); ItemStack runeOfSelfSacrificeStack = new ItemStack(ModBlocks.runeOfSelfSacrifice);
ItemStack miningSigilStackCrafted = new ItemStack(ModItems.sigilOfTheFastMiner); ItemStack miningSigilStackCrafted = new ItemStack(ModItems.sigilOfTheFastMiner);
@@ -2425,6 +2445,21 @@ public class AlchemicalWizardry {
'o', 'o',
obsidianStack)); obsidianStack));
GameRegistry.addRecipe(
new ShapedBloodOrbRecipe(
new ItemStack(ModBlocks.bloodRune, 1, 6),
"eae",
"sos",
"eae",
'e',
etherealSlateStack,
's',
speedRuneStack,
'a',
accelerationRuneStack,
'o',
archmageBloodOrbStack));
AlchemyRecipeRegistry.registerRecipe( AlchemyRecipeRegistry.registerRecipe(
crackedRunicPlateStackCrafted, crackedRunicPlateStackCrafted,
10, 10,
@@ -3298,12 +3333,18 @@ public class AlchemicalWizardry {
isFMPLoaded = Loader.isModLoaded("ForgeMultipart"); isFMPLoaded = Loader.isModLoaded("ForgeMultipart");
isChiselLoaded = Loader.isModLoaded("chisel"); isChiselLoaded = Loader.isModLoaded("chisel");
if (Loader.isModLoaded("structurelib")) {
CompatStructureLib.init();
}
BloodMagicConfiguration.loadBlacklist(); BloodMagicConfiguration.loadBlacklist();
BloodMagicConfiguration.blacklistRituals(); BloodMagicConfiguration.blacklistRituals();
BloodMagicConfiguration.loadCustomLPValues(); BloodMagicConfiguration.loadCustomLPValues();
DemonVillageLootRegistry.init(); DemonVillageLootRegistry.init();
Meteor.loadConfig();
MeteorRegistry.loadConfig();
MeteorReagentRegistry.loadConfig();
this.initCompressionHandlers(); this.initCompressionHandlers();
} }
@@ -4487,7 +4528,7 @@ public class AlchemicalWizardry {
return strings; return strings;
} }
@Mod.EventHandler @EventHandler
public void initCommands(FMLServerStartingEvent event) { public void initCommands(FMLServerStartingEvent event) {
event.registerServerCommand(new CommandBloodMagic()); event.registerServerCommand(new CommandBloodMagic());
} }
@@ -29,6 +29,7 @@ import WayofTime.alchemicalWizardry.common.AlchemicalWizardryEventHooks;
import WayofTime.alchemicalWizardry.common.demonVillage.DemonVillagePath; import WayofTime.alchemicalWizardry.common.demonVillage.DemonVillagePath;
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour; import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorComponent;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
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;
@@ -102,6 +103,23 @@ public class BloodMagicConfiguration {
AlchemicalWizardry.doMeteorsDestroyBlocks = config.get("meteor", "doMeteorsDestroyBlocks", true) AlchemicalWizardry.doMeteorsDestroyBlocks = config.get("meteor", "doMeteorsDestroyBlocks", true)
.getBoolean(true); .getBoolean(true);
AlchemicalWizardry.defaultMeteorCost = config.getInt(
"defaultMeteorCost",
"meteor",
1000000,
0,
Integer.MAX_VALUE,
"The default LP cost to use for meteors if the \"cost\" property is not present in its config file.\n");
AlchemicalWizardry.defaultMeteorBlock = config.getString(
"defaultMeteorBlock",
"meteor",
"",
"The block to use for filler in meteors if none is provided in the meteor's config file and "
+ "that\nmeteor's fillerChance is greater than 0. Also used as a fallback for empty ore "
+ "lists in meteor configs.\nSpecify the block with the "
+ "format:\n\"modId:itemName:meta\"\nDefaults to minecraft:stone:0 if no block is provided or "
+ "the provided block cannot be found.");
MeteorComponent.setDefaultMeteorBlock();
AlchemicalWizardry.allowedCrushedOresArray = config.get( AlchemicalWizardry.allowedCrushedOresArray = config.get(
"oreCrushing", "oreCrushing",
"allowedOres", "allowedOres",
@@ -113,6 +131,7 @@ public class BloodMagicConfiguration {
.getBoolean(); .getBoolean();
AlchemicalWizardry.causeHungerChatMessage = config.get("WimpySettings", "causeHungerChatMessage", true) AlchemicalWizardry.causeHungerChatMessage = config.get("WimpySettings", "causeHungerChatMessage", true)
.getBoolean(); .getBoolean();
AlchemicalWizardry.allowPotionRepair = config.get("WimpySettings", "allowPotionRepair", true).getBoolean();
// AlchemicalWizardry.lockdownAltar = config.get("WimpySettings", "LockdownAltarWithRegen", true).getBoolean(); // AlchemicalWizardry.lockdownAltar = config.get("WimpySettings", "LockdownAltarWithRegen", true).getBoolean();
AlchemicalWizardry.lockdownAltar = false; AlchemicalWizardry.lockdownAltar = false;
AlchemicalWizardry.disableBoundToolsRightClick = config AlchemicalWizardry.disableBoundToolsRightClick = config
@@ -611,41 +630,55 @@ public class BloodMagicConfiguration {
new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0), new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0),
new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1), new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1),
new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3), new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3),
new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5) }); new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5),
new BlockStack(ModBlocks.bloodRune, 6) });
AlchemicalWizardry.thirdTierRunes = BloodMagicConfiguration.getAltarRunesForTier( AlchemicalWizardry.thirdTierRunes = BloodMagicConfiguration.getAltarRunesForTier(
"thirdTier", "thirdTier",
new BlockStack[] { new BlockStack(ModBlocks.bloodRune, 0), new BlockStack(ModBlocks.speedRune, 0), new BlockStack[] { new BlockStack(ModBlocks.bloodRune, 0), new BlockStack(ModBlocks.speedRune, 0),
new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0), new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0),
new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1), new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1),
new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3), new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3),
new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5) }); new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5),
new BlockStack(ModBlocks.bloodRune, 6) });
AlchemicalWizardry.fourthTierRunes = BloodMagicConfiguration.getAltarRunesForTier( AlchemicalWizardry.fourthTierRunes = BloodMagicConfiguration.getAltarRunesForTier(
"fourthTier", "fourthTier",
new BlockStack[] { new BlockStack(ModBlocks.bloodRune, 0), new BlockStack(ModBlocks.speedRune, 0), new BlockStack[] { new BlockStack(ModBlocks.bloodRune, 0), new BlockStack(ModBlocks.speedRune, 0),
new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0), new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0),
new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1), new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1),
new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3), new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3),
new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5) }); new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5),
new BlockStack(ModBlocks.bloodRune, 6) });
AlchemicalWizardry.fifthTierRunes = BloodMagicConfiguration.getAltarRunesForTier( AlchemicalWizardry.fifthTierRunes = BloodMagicConfiguration.getAltarRunesForTier(
"fifthTier", "fifthTier",
new BlockStack[] { new BlockStack(ModBlocks.bloodRune, 0), new BlockStack(ModBlocks.speedRune, 0), new BlockStack[] { new BlockStack(ModBlocks.bloodRune, 0), new BlockStack(ModBlocks.speedRune, 0),
new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0), new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0),
new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1), new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1),
new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3), new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3),
new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5) }); new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5),
new BlockStack(ModBlocks.bloodRune, 6) });
AlchemicalWizardry.sixthTierRunes = BloodMagicConfiguration.getAltarRunesForTier( AlchemicalWizardry.sixthTierRunes = BloodMagicConfiguration.getAltarRunesForTier(
"sixthTier", "sixthTier",
new BlockStack[] { new BlockStack(ModBlocks.bloodRune, 0), new BlockStack(ModBlocks.speedRune, 0), new BlockStack[] { new BlockStack(ModBlocks.bloodRune, 0), new BlockStack(ModBlocks.speedRune, 0),
new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0), new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0),
new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1), new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1),
new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3), new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3),
new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5) }); new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5),
new BlockStack(ModBlocks.bloodRune, 6) });
AlchemicalWizardry.specialAltarBlock = getAltarRunesForTier( AlchemicalWizardry.specialAltarBlock = getAltarRunesForTier(
"specialBlocks", "specialBlocks",
new BlockStack[] { new BlockStack(Blocks.stonebrick, 0), new BlockStack(Blocks.glowstone, 0), new BlockStack[] { new BlockStack(Blocks.air, 0), new BlockStack(Blocks.glowstone, 0),
new BlockStack(Blocks.stonebrick, 0), new BlockStack(ModBlocks.largeBloodStoneBrick, 0), new BlockStack(Blocks.air, 0), new BlockStack(ModBlocks.largeBloodStoneBrick, 0),
new BlockStack(Blocks.beacon, 0), new BlockStack(Blocks.stonebrick, 0), new BlockStack(Blocks.beacon, 0), new BlockStack(Blocks.air, 0),
new BlockStack(ModBlocks.blockCrystal, 0) }); new BlockStack(ModBlocks.blockCrystal, 0) },
"Set the special blocks for the altar with the format mod:block(:meta) in the following order:\n"
+ "Tier 3 pillar\n"
+ "Tier 3 cap\n"
+ "Tier 4 pillar\n"
+ "Tier 4 cap\n"
+ "Tier 5 beacon\n"
+ "Tier 6 pillar\n"
+ "Tier 6 cap\n"
+ "Set any of these to minecraft:air to allow for that component to be any block EXCEPT air (e.g., let any block be used for a pillar).");
config.save(); config.save();
} }
@@ -785,12 +818,16 @@ public class BloodMagicConfiguration {
} }
private static BlockStack[] getAltarRunesForTier(String tierName, BlockStack[] defaultValues) { private static BlockStack[] getAltarRunesForTier(String tierName, BlockStack[] defaultValues) {
return getAltarRunesForTier(tierName, defaultValues, "");
}
private static BlockStack[] getAltarRunesForTier(String tierName, BlockStack[] defaultValues, String comment) {
String[] defaultNames = new String[defaultValues.length]; String[] defaultNames = new String[defaultValues.length];
for (int i = 0; i < defaultValues.length; i++) { for (int i = 0; i < defaultValues.length; i++) {
defaultNames[i] = Block.blockRegistry.getNameForObject(defaultValues[i].getBlock()) + ":" defaultNames[i] = Block.blockRegistry.getNameForObject(defaultValues[i].getBlock()) + ":"
+ defaultValues[i].getMeta(); + defaultValues[i].getMeta();
} }
Property property = config.get("rune overrides", tierName, defaultNames); Property property = config.get("rune overrides", tierName, defaultNames, comment);
String[] names = property.getStringList(); String[] names = property.getStringList();
if (names.length != defaultNames.length) { if (names.length != defaultNames.length) {
property.set(defaultNames); property.set(defaultNames);
@@ -6,7 +6,48 @@ import net.minecraft.item.Item;
import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool; import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool;
import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool;
import WayofTime.alchemicalWizardry.common.items.*; import WayofTime.alchemicalWizardry.common.items.AWBaseItems;
import WayofTime.alchemicalWizardry.common.items.ActivationCrystal;
import WayofTime.alchemicalWizardry.common.items.AirScribeTool;
import WayofTime.alchemicalWizardry.common.items.ApprenticeBloodOrb;
import WayofTime.alchemicalWizardry.common.items.ArchmageBloodOrb;
import WayofTime.alchemicalWizardry.common.items.ArmourInhibitor;
import WayofTime.alchemicalWizardry.common.items.BlankSpell;
import WayofTime.alchemicalWizardry.common.items.BloodShard;
import WayofTime.alchemicalWizardry.common.items.BoundAxe;
import WayofTime.alchemicalWizardry.common.items.BoundPickaxe;
import WayofTime.alchemicalWizardry.common.items.BoundShovel;
import WayofTime.alchemicalWizardry.common.items.CheatyItem;
import WayofTime.alchemicalWizardry.common.items.CreativeDagger;
import WayofTime.alchemicalWizardry.common.items.DaggerOfSacrifice;
import WayofTime.alchemicalWizardry.common.items.DawnScribeTool;
import WayofTime.alchemicalWizardry.common.items.DemonPlacer;
import WayofTime.alchemicalWizardry.common.items.DemonicTelepositionFocus;
import WayofTime.alchemicalWizardry.common.items.DuskScribeTool;
import WayofTime.alchemicalWizardry.common.items.EarthScribeTool;
import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
import WayofTime.alchemicalWizardry.common.items.EnergyBazooka;
import WayofTime.alchemicalWizardry.common.items.EnergyBlast;
import WayofTime.alchemicalWizardry.common.items.EnergySword;
import WayofTime.alchemicalWizardry.common.items.EnhancedTelepositionFocus;
import WayofTime.alchemicalWizardry.common.items.FireScribeTool;
import WayofTime.alchemicalWizardry.common.items.ItemAlchemyBase;
import WayofTime.alchemicalWizardry.common.items.ItemBloodLetterPack;
import WayofTime.alchemicalWizardry.common.items.ItemComplexSpellCrystal;
import WayofTime.alchemicalWizardry.common.items.ItemComponents;
import WayofTime.alchemicalWizardry.common.items.ItemDiabloKey;
import WayofTime.alchemicalWizardry.common.items.ItemIncense;
import WayofTime.alchemicalWizardry.common.items.ItemRitualDismantler;
import WayofTime.alchemicalWizardry.common.items.ItemRitualDiviner;
import WayofTime.alchemicalWizardry.common.items.LavaCrystal;
import WayofTime.alchemicalWizardry.common.items.LifeBucket;
import WayofTime.alchemicalWizardry.common.items.MagicianBloodOrb;
import WayofTime.alchemicalWizardry.common.items.MasterBloodOrb;
import WayofTime.alchemicalWizardry.common.items.ReinforcedTelepositionFocus;
import WayofTime.alchemicalWizardry.common.items.SacrificialDagger;
import WayofTime.alchemicalWizardry.common.items.TelepositionFocus;
import WayofTime.alchemicalWizardry.common.items.TranscendentBloodOrb;
import WayofTime.alchemicalWizardry.common.items.WaterScribeTool;
import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour; import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour;
import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmourEarth; import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmourEarth;
import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmourFire; import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmourFire;
@@ -1,4 +1,185 @@
package WayofTime.alchemicalWizardry.api.items.interfaces; package WayofTime.alchemicalWizardry.api.items.interfaces;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public interface IBindable { public interface IBindable {
/**
* Used by bound tools and the energy blaster/bazooka to check if they should skip their right click function.
* Drains the soul network by the amount returned by rightClickCost.
*/
default boolean checkRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (toggle(par1ItemStack, par2World, par3EntityPlayer)) {
return true;
}
if (par2World.isRemote) {
return true;
}
if (!isActive(par1ItemStack) || SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) {
return true;
}
if (isBoundTool() && AlchemicalWizardry.disableBoundToolsRightClick) {
return true;
}
if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionInhibit)) {
return true;
}
if (!(par3EntityPlayer.capabilities.isCreativeMode
|| EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, rightClickCost()))) {
return true;
}
return false;
}
/**
* Adds the active state and owner information to an item if it has the relevant tags.
*/
default void addBindingInformation(ItemStack par1ItemStack, List par3List) {
NBTTagCompound itemTag = getTag(par1ItemStack);
if (itemTag.getBoolean("isActive")) {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
} else if (itemTag.hasKey("isActive")) { // Only if present and set to false rather than not present at all
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
}
if (!itemTag.getString("ownerName").equals("")) {
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ itemTag.getString("ownerName"));
}
}
static void setActive(ItemStack par1ItemStack, boolean state) {
NBTTagCompound itemTag = getTag(par1ItemStack);
itemTag.setBoolean("isActive", state);
}
static boolean isActive(ItemStack par1ItemStack) {
NBTTagCompound itemTag = getTag(par1ItemStack);
return itemTag.getBoolean("isActive");
}
static NBTTagCompound getTag(ItemStack par1ItemStack) {
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
if (itemTag == null) {
par1ItemStack.setTagCompound(new NBTTagCompound());
itemTag = par1ItemStack.getTagCompound();
}
return itemTag;
}
default boolean toggle(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
setActive(par1ItemStack, !isActive(par1ItemStack));
setDrainTick(par1ItemStack, par2World);
return true;
}
return false;
}
/**
* Checks if the current tick is the proper tick to do a passive drain based on getDrainTicks. If it is, it runs
* doPassiveDrain and returns true. Otherwise, returns false.
*/
default boolean checkPassiveDrain(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
NBTTagCompound itemTag = getTag(par1ItemStack);
if (par2World.getTotalWorldTime() % this.drainTicks() == itemTag.getInteger("worldTimeDelay")
&& itemTag.getBoolean("isActive")) {
this.doPassiveDrain(par1ItemStack, par3EntityPlayer);
return true;
}
return false;
}
/**
* The action to take when checkPassiveDrain is run on the proper tick based on getDrainTicks.
*/
default void doPassiveDrain(ItemStack par1ItemStack, EntityPlayer par3EntityPlayer) {
if (!par3EntityPlayer.capabilities.isCreativeMode) {
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, drainCost())) {
setActive(par1ItemStack, false);
}
}
}
/**
* Sets the drain tick delay based on the current world age and getDrainTicks().
*/
default void setDrainTick(ItemStack par1ItemStack, World par2World) {
getTag(par1ItemStack)
.setInteger("worldTimeDelay", (int) (par2World.getTotalWorldTime() - 1) % this.drainTicks());
}
static boolean checkAndSetItemOwner(ItemStack item, EntityPlayer player) {
return !SpellHelper.isFakePlayer(player) && SoulNetworkHandler.checkAndSetItemPlayer(item, player);
}
/**
* Sets the item's owner even if it already has one.
*/
static void setItemOwner(ItemStack item, String ownerName) {
NBTTagCompound tag = IBindable.getTag(item);
tag.setString("ownerName", ownerName);
}
/**
* Sets the item's owner only if it does not already have one.
*/
static void checkAndSetItemOwner(ItemStack item, String ownerName) {
NBTTagCompound tag = IBindable.getTag(item);
if (tag.getString("ownerName").isEmpty()) {
tag.setString("ownerName", ownerName);
}
}
static String getOwnerName(ItemStack item) {
NBTTagCompound tag = IBindable.getTag(item);
return tag.getString("ownerName");
}
/**
* The number of ticks between passive drains from the soul network while the item is active.
*/
default int drainTicks() {
return 200;
}
/**
* Return true if the right click function should be disabled with the config disableBoundToolsRightClick.
*/
default boolean isBoundTool() {
return false;
}
/**
* The cost to use the right click function of this item. Used by bound tools and the Energy Blaster/Bazooka.
*/
default int rightClickCost() {
return 0;
}
/**
* The amount of LP drained from the soul network for each passive drain while the item is active.
*/
default int drainCost() {
return 0;
}
} }
@@ -1,4 +1,39 @@
package WayofTime.alchemicalWizardry.api.items.interfaces; package WayofTime.alchemicalWizardry.api.items.interfaces;
public interface ISigil { import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
public interface ISigil extends IBindable {
/**
* Toggles the state of the sigil. Returns true if the sigil is active after the toggle or false if it is inactive
* after the toggle.
*/
default boolean toggleSigil(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
IBindable.setActive(par1ItemStack, !IBindable.isActive(par1ItemStack));
if (!par3EntityPlayer.capabilities.isCreativeMode
&& !EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, this.drainCost())) {
IBindable.setActive(par1ItemStack, false);
}
if (IBindable.isActive(par1ItemStack)) {
par1ItemStack.setItemDamage(1);
this.setDrainTick(par1ItemStack, par2World);
return true;
} else {
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
return false;
}
}
/**
* Return false if this sigil should not be able to be put in the Sigil of Holding.
*/
default boolean canBeStored() {
return true;
}
} }
@@ -13,7 +13,7 @@ import WayofTime.alchemicalWizardry.api.tile.IBloodAltar;
public class PlayerSacrificeHandler { public class PlayerSacrificeHandler {
public static float scalingOfSacrifice = 0.001f; public static float scalingOfSacrifice = 0.001f;
public static int soulFrayDuration = 400; public static int soulFrayDuration = 240;
public static Potion soulFrayId; public static Potion soulFrayId;
public static float getPlayerIncense(EntityPlayer player) { public static float getPlayerIncense(EntityPlayer player) {
@@ -14,6 +14,8 @@ import WayofTime.alchemicalWizardry.api.event.AddToNetworkEvent;
import WayofTime.alchemicalWizardry.api.event.ItemBindEvent; import WayofTime.alchemicalWizardry.api.event.ItemBindEvent;
import WayofTime.alchemicalWizardry.api.event.ItemDrainInContainerEvent; import WayofTime.alchemicalWizardry.api.event.ItemDrainInContainerEvent;
import WayofTime.alchemicalWizardry.api.event.ItemDrainNetworkEvent; import WayofTime.alchemicalWizardry.api.event.ItemDrainNetworkEvent;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.Event; import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.common.eventhandler.Event.Result; import cpw.mods.fml.common.eventhandler.Event.Result;
@@ -35,11 +37,12 @@ public class SoulNetworkHandler {
} }
public static int getCurrentMaxOrb(String ownerName) { public static int getCurrentMaxOrb(String ownerName) {
if (MinecraftServer.getServer() == null) { MinecraftServer mcServer = FMLCommonHandler.instance().getMinecraftServerInstance();
if (mcServer == null) {
return 0; return 0;
} }
World world = MinecraftServer.getServer().worldServers[0]; World world = mcServer.worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName); LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
if (data == null) { if (data == null) {
@@ -51,11 +54,12 @@ public class SoulNetworkHandler {
} }
public static void setMaxOrbToMax(String ownerName, int maxOrb) { public static void setMaxOrbToMax(String ownerName, int maxOrb) {
if (MinecraftServer.getServer() == null) { MinecraftServer mcServer = FMLCommonHandler.instance().getMinecraftServerInstance();
if (mcServer == null) {
return; return;
} }
World world = MinecraftServer.getServer().worldServers[0]; World world = mcServer.worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName); LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
if (data == null) { if (data == null) {
@@ -96,7 +100,7 @@ public class SoulNetworkHandler {
} }
public static int syphonFromNetwork(String ownerName, int damageToBeDone) { public static int syphonFromNetwork(String ownerName, int damageToBeDone) {
MinecraftServer mcServer = MinecraftServer.getServer(); MinecraftServer mcServer = FMLCommonHandler.instance().getMinecraftServerInstance();
if (mcServer == null || mcServer.worldServers.length == 0) { if (mcServer == null || mcServer.worldServers.length == 0) {
return 0; return 0;
} }
@@ -192,11 +196,12 @@ public class SoulNetworkHandler {
} }
public static boolean canSyphonFromOnlyNetwork(String ownerName, int damageToBeDone) { public static boolean canSyphonFromOnlyNetwork(String ownerName, int damageToBeDone) {
if (MinecraftServer.getServer() == null) { MinecraftServer mcServer = FMLCommonHandler.instance().getMinecraftServerInstance();
if (mcServer == null) {
return false; return false;
} }
World world = MinecraftServer.getServer().worldServers[0]; World world = mcServer.worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName); LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
if (data == null) { if (data == null) {
@@ -208,11 +213,12 @@ public class SoulNetworkHandler {
} }
public static int getCurrentEssence(String ownerName) { public static int getCurrentEssence(String ownerName) {
if (MinecraftServer.getServer() == null) { MinecraftServer mcServer = FMLCommonHandler.instance().getMinecraftServerInstance();
if (mcServer == null) {
return 0; return 0;
} }
World world = MinecraftServer.getServer().worldServers[0]; World world = mcServer.worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName); LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
if (data == null) { if (data == null) {
@@ -224,11 +230,12 @@ public class SoulNetworkHandler {
} }
public static void setCurrentEssence(String ownerName, int essence) { public static void setCurrentEssence(String ownerName, int essence) {
if (MinecraftServer.getServer() == null) { MinecraftServer mcServer = FMLCommonHandler.instance().getMinecraftServerInstance();
if (mcServer == null) {
return; return;
} }
World world = MinecraftServer.getServer().worldServers[0]; World world = mcServer.worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName); LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
if (data == null) { if (data == null) {
@@ -255,11 +262,12 @@ public class SoulNetworkHandler {
return 0; return 0;
} }
if (MinecraftServer.getServer() == null) { MinecraftServer mcServer = FMLCommonHandler.instance().getMinecraftServerInstance();
if (mcServer == null) {
return 0; return 0;
} }
World world = MinecraftServer.getServer().worldServers[0]; World world = mcServer.worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, event.ownerNetwork); LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, event.ownerNetwork);
if (data == null) { if (data == null) {
@@ -273,7 +281,7 @@ public class SoulNetworkHandler {
return 0; return 0;
} }
int newEss = Math.min(event.maximum, currEss + event.addedAmount); int newEss = (int) Math.min(Integer.MAX_VALUE, Math.min(event.maximum, (long) currEss + event.addedAmount));
if (event.getResult() != Event.Result.DENY) { if (event.getResult() != Event.Result.DENY) {
data.currentEssence = newEss; data.currentEssence = newEss;
} }
@@ -333,14 +341,9 @@ public class SoulNetworkHandler {
return false; return false;
} }
@Deprecated
public static void checkAndSetItemOwner(ItemStack item, String ownerName) { public static void checkAndSetItemOwner(ItemStack item, String ownerName) {
if (item.getTagCompound() == null) { IBindable.checkAndSetItemOwner(item, ownerName);
item.setTagCompound(new NBTTagCompound());
}
if (item.getTagCompound().getString("ownerName").equals("")) {
item.getTagCompound().setString("ownerName", ownerName);
}
} }
public static String getUsername(EntityPlayer player) { public static String getUsername(EntityPlayer player) {
@@ -348,10 +351,11 @@ public class SoulNetworkHandler {
} }
public static EntityPlayer getPlayerForUsername(String str) { public static EntityPlayer getPlayerForUsername(String str) {
if (MinecraftServer.getServer() == null) { MinecraftServer mcServer = FMLCommonHandler.instance().getMinecraftServerInstance();
if (mcServer == null) {
return null; return null;
} }
return MinecraftServer.getServer().getConfigurationManager().func_152612_a(str); return mcServer.getConfigurationManager().func_152612_a(str);
} }
public static void causeNauseaToPlayer(ItemStack stack) { public static void causeNauseaToPlayer(ItemStack stack) {
@@ -17,6 +17,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool; import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
public class SpellParadigmTool extends SpellParadigm { public class SpellParadigmTool extends SpellParadigm {
@@ -159,7 +160,7 @@ public class SpellParadigmTool extends SpellParadigm {
itemTool.setDuration(toolStack, world, this.duration); itemTool.setDuration(toolStack, world, this.duration);
itemTool.loadParadigmIntoStack(toolStack, this.bufferedEffectList); itemTool.loadParadigmIntoStack(toolStack, this.bufferedEffectList);
SoulNetworkHandler.checkAndSetItemOwner(toolStack, SoulNetworkHandler.getOwnerName(crystalStack)); IBindable.checkAndSetItemOwner(toolStack, SoulNetworkHandler.getOwnerName(crystalStack));
itemTool.setContainedCrystal(toolStack, crystalStack); itemTool.setContainedCrystal(toolStack, crystalStack);
@@ -1,6 +1,7 @@
package WayofTime.alchemicalWizardry.client.nei; package WayofTime.alchemicalWizardry.client.nei;
import java.awt.*; import java.awt.Point;
import java.awt.Rectangle;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@@ -10,14 +11,17 @@ import java.util.stream.Collectors;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.oredict.OreDictionary;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorParadigm; import com.google.common.base.Joiner;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorParadigmComponent;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.common.summoning.meteor.Meteor;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorComponent;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorRegistry; import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorRegistry;
import codechicken.lib.gui.GuiDraw; import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils; import codechicken.nei.NEIServerUtils;
@@ -35,44 +39,95 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
private final int radius; private final int radius;
private Point focus; private Point focus;
public CachedMeteorRecipe(MeteorParadigm meteor, ItemStack focusStack) { public CachedMeteorRecipe(Meteor meteor, ItemStack focusStack) {
this.input.add(new PositionedStack(meteor.focusStack, 74, 4)); this.input.add(new PositionedStack(meteor.focusItem, 74, 4));
int row = 0; int row = 0;
int col = 0; int col = 0;
float totalMeteorWeight = meteor.getTotalMeteorWeight(); float totalComponentWeight = MeteorComponent.getTotalListWeight(meteor.ores);
List<MeteorParadigmComponent> sortedComponents = new ArrayList<>(meteor.componentList); float fillerChance = meteor.fillerChance;
sortedComponents.sort(Comparator.comparingInt(c -> -c.chance)); List<MeteorComponent> sortedComponents = new ArrayList<>(meteor.ores);
sortedComponents.sort(Comparator.comparingInt(c -> -c.getWeight()));
for (MeteorParadigmComponent component : sortedComponents) { float fillerRatio = (float) (fillerChance / 100.0);
ItemStack stack = component.getValidBlockParadigm(); float componentRatio = 1 - fillerRatio;
int xPos = 3 + 18 * col;
int yPos = 37 + 18 * row;
List<String> tooltips = new ArrayList<>(); if (fillerChance < 100) {
if (stack == null) { for (MeteorComponent component : sortedComponents) {
stack = new ItemStack(Blocks.fire); ItemStack stack = component.getBlock();
tooltips.add(String.format("no entries found for oredict \"%s\"", component.getOreDictName())); int xPos = 3 + 18 * col;
int yPos = 37 + 18 * row;
List<String> tooltips = new ArrayList<>();
float chance = component.getWeight() / totalComponentWeight * componentRatio;
tooltips.add(I18n.format("nei.recipe.meteor.chance", getFormattedChance(chance)));
tooltips.add(I18n.format("nei.recipe.meteor.amount", getEstimatedAmount(chance, meteor.radius)));
if (!component.getRequiredReagents().isEmpty()) {
tooltips.add(I18n.format("nei.recipe.meteor.reagent", getReagentStrings(component)));
}
this.outputs.add(new TooltipStack(stack, xPos, yPos, tooltips));
col++;
if (col > 8) {
col = 0;
row++;
}
if (matchItem(focusStack, stack)) {
this.focus = new Point(xPos - 1, yPos - 1);
}
} }
float chance = component.getChance() / totalMeteorWeight; }
tooltips.add(I18n.format("nei.recipe.meteor.chance", getFormattedChance(chance))); if (fillerChance > 0) {
tooltips.add(I18n.format("nei.recipe.meteor.amount", getEstimatedAmount(chance, meteor.radius))); if (col != 0) {
this.outputs.add(new TooltipStack(stack, xPos, yPos, tooltips));
col++;
if (col > 8) {
col = 0; col = 0;
row++; row++;
} }
if (focusStack != null && matchItem(focusStack, stack)) { List<MeteorComponent> sortedFiller = new ArrayList<>(meteor.filler);
this.focus = new Point(xPos - 1, yPos - 1); sortedFiller.sort(Comparator.comparingInt(c -> -c.getWeight()));
float totalFillerWeight = MeteorComponent.getTotalListWeight(meteor.filler);
for (MeteorComponent filler : sortedFiller) {
ItemStack stack = filler.getBlock();
int xPos = 3 + 18 * col;
int yPos = 37 + 18 * row;
List<String> tooltips = new ArrayList<>();
float chance = filler.getWeight() / totalFillerWeight * fillerRatio;
tooltips.add(I18n.format("nei.recipe.meteor.chance", getFormattedChance(chance)));
tooltips.add(I18n.format("nei.recipe.meteor.amount", getEstimatedAmount(chance, meteor.radius)));
tooltips.add(I18n.format("nei.recipe.meteor.filler"));
if (!filler.getRequiredReagents().isEmpty()) {
tooltips.add(I18n.format("nei.recipe.meteor.reagent", getReagentStrings(filler)));
}
this.outputs.add(new TooltipStack(stack, xPos, yPos, tooltips));
col++;
if (col > 8) {
col = 0;
row++;
}
if (matchItem(focusStack, stack)) {
this.focus = new Point(xPos - 1, yPos - 1);
}
} }
} }
this.radius = meteor.radius; this.radius = meteor.radius;
this.cost = meteor.cost; this.cost = meteor.cost;
} }
private String getReagentStrings(MeteorComponent component) {
ArrayList<Reagent> reagents = component.getRequiredReagents();
ArrayList<String> reagentNames = new ArrayList<>();
for (Reagent r : reagents) {
reagentNames.add(r.name);
}
return Joiner.on(", ").join(reagentNames);
}
@Override @Override
public List<PositionedStack> getIngredients() { public List<PositionedStack> getIngredients() {
return this.input; return this.input;
@@ -105,7 +160,7 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
@Override @Override
public void loadCraftingRecipes(String outputId, Object... results) { public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getOverlayIdentifier()) && getClass() == NEIMeteorRecipeHandler.class) { if (outputId.equals(getOverlayIdentifier()) && getClass() == NEIMeteorRecipeHandler.class) {
for (MeteorParadigm meteor : getSortedMeteors()) { for (Meteor meteor : getSortedMeteors()) {
arecipes.add(new CachedMeteorRecipe(meteor, null)); arecipes.add(new CachedMeteorRecipe(meteor, null));
} }
} else { } else {
@@ -115,8 +170,11 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
@Override @Override
public void loadCraftingRecipes(ItemStack result) { public void loadCraftingRecipes(ItemStack result) {
for (MeteorParadigm meteor : getSortedMeteors()) { for (Meteor meteor : getSortedMeteors()) {
if (meteor.componentList.stream().anyMatch(m -> matchItem(result, m.getValidBlockParadigm()))) { if (meteor.ores.stream().anyMatch(m -> matchItem(result, m.getBlock()))) {
arecipes.add(new CachedMeteorRecipe(meteor, result));
}
if (meteor.fillerChance > 0 && meteor.filler.stream().anyMatch(m -> matchItem(result, m.getBlock()))) {
arecipes.add(new CachedMeteorRecipe(meteor, result)); arecipes.add(new CachedMeteorRecipe(meteor, result));
} }
} }
@@ -124,8 +182,8 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
@Override @Override
public void loadUsageRecipes(ItemStack ingredient) { public void loadUsageRecipes(ItemStack ingredient) {
for (MeteorParadigm meteor : getSortedMeteors()) { for (Meteor meteor : getSortedMeteors()) {
if (matchItem(ingredient, meteor.focusStack)) { if (matchItem(ingredient, meteor.focusItem)) {
arecipes.add(new CachedMeteorRecipe(meteor, null)); arecipes.add(new CachedMeteorRecipe(meteor, null));
} }
} }
@@ -136,11 +194,34 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
if (NEIServerUtils.areStacksSameTypeCrafting(compared, compareTo)) { if (NEIServerUtils.areStacksSameTypeCrafting(compared, compareTo)) {
return true; return true;
} }
// ignore ore variants (like basalt ore)
// Ignore GregTech ore variants (like basalt ore)
if (compared.getUnlocalizedName().startsWith("gt.blockores") if (compared.getUnlocalizedName().startsWith("gt.blockores")
&& compareTo.getUnlocalizedName().startsWith("gt.blockores")) { && compareTo.getUnlocalizedName().startsWith("gt.blockores")) {
return compared.getItemDamage() % 1000 == compareTo.getItemDamage() % 1000; return compared.getItemDamage() % 1000 == compareTo.getItemDamage() % 1000;
} }
// Check oredicts for ores. Checks for direct matches (oreIron with oreIron) as well as IC2/GT crushed ores
// (crushedGold with oreGold), EFR raw ores (rawCopper with oreCopper (although those all seem to have oreX
// anyways)), and GT:NH raw ores (rawOreDiamond with oreDiamond).
String[] prefixes = { "crushed", "rawOre", "raw" };
for (int i : OreDictionary.getOreIDs(compareTo)) {
String s1 = OreDictionary.getOreName(i);
if (s1.startsWith("ore")) {
for (int j : OreDictionary.getOreIDs(compared)) {
if (i == j) {
return true;
}
String s2 = OreDictionary.getOreName(j);
for (String prefix : prefixes) {
if (i == OreDictionary.getOreID(s2.replaceFirst("^" + prefix, "ore"))) {
return true;
}
}
}
}
}
return false; return false;
} }
@@ -182,7 +263,7 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
public List<String> handleItemTooltip(GuiRecipe<?> gui, ItemStack stack, List<String> currenttip, int recipe) { public List<String> handleItemTooltip(GuiRecipe<?> gui, ItemStack stack, List<String> currenttip, int recipe) {
CachedMeteorRecipe meteorRecipe = (CachedMeteorRecipe) this.arecipes.get(recipe); CachedMeteorRecipe meteorRecipe = (CachedMeteorRecipe) this.arecipes.get(recipe);
for (PositionedStack pStack : meteorRecipe.outputs) { for (PositionedStack pStack : meteorRecipe.outputs) {
if (!gui.isMouseOver(pStack, recipe)) continue; // if (!gui.isMouseOver(pStack, recipe)) continue; // put it back when NEI is properly patched
if (!(pStack instanceof TooltipStack)) break; if (!(pStack instanceof TooltipStack)) break;
TooltipStack tStack = (TooltipStack) pStack; TooltipStack tStack = (TooltipStack) pStack;
@@ -199,8 +280,8 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
return I18n.format("nei.recipe.meteor.category"); return I18n.format("nei.recipe.meteor.category");
} }
private List<MeteorParadigm> getSortedMeteors() { private List<Meteor> getSortedMeteors() {
return MeteorRegistry.paradigmList.stream().sorted(Comparator.comparing(m -> m.cost)) return MeteorRegistry.meteorList.stream().sorted(Comparator.comparing(m -> m.cost))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@@ -209,6 +290,6 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
} }
private int getEstimatedAmount(float chance, int radius) { private int getEstimatedAmount(float chance, int radius) {
return (int) Math.ceil(4f / 3 * Math.PI * Math.pow(radius, 3) * chance); return (int) Math.ceil(4f / 3 * Math.PI * Math.pow(radius + 0.5, 3) * chance);
} }
} }
@@ -106,26 +106,24 @@ public class RenderHelper {
GL11.glPushMatrix(); GL11.glPushMatrix();
int xSize = 32; int xSize = 32;
int ySize = 32; int ySize = 32;
int amount = Math.max((int) (256 * ((double) (maxAmount - lpAmount) / maxAmount)), 0); int amount = Math.max((int) (256 * ((double) (maxAmount - lpAmount) / maxAmount)), 0);
int x = (lpBarX - xSize / 2) * 8; int x = (lpBarX - xSize / 2) * 8;
int y = (lpBarY - ySize / 2) * 8; int y = (lpBarY - ySize / 2) * 8;
ResourceLocation test2 = new ResourceLocation("alchemicalwizardry", "textures/gui/container1.png"); ResourceLocation test2 = new ResourceLocation("alchemicalwizardry", "textures/gui/container1.png");
GL11.glColor4f(1, 0, 0, 1.0F); GL11.glColor4f(1, 0, 0, 1.0F);
mc.getTextureManager().bindTexture(test2); GL11.glEnable(GL11.GL_BLEND);
mc.renderEngine.bindTexture(test2);
GL11.glScalef(1f / 8f, 1f / 8f, 1f / 8f); GL11.glScalef(1f / 8f, 1f / 8f, 1f / 8f);
GL11.glPushMatrix();
drawTexturedModalRect(x, y + amount, 0, amount, 256, 256 - amount); drawTexturedModalRect(x, y + amount, 0, amount, 256, 256 - amount);
GL11.glPopMatrix();
ResourceLocation test = new ResourceLocation("alchemicalwizardry", "textures/gui/lpVial.png"); ResourceLocation test = new ResourceLocation("alchemicalwizardry", "textures/gui/lpVial.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(test); mc.renderEngine.bindTexture(test);
GL11.glPushMatrix();
drawTexturedModalRect(x, y, 0, 0, 256, 256); drawTexturedModalRect(x, y, 0, 0, 256, 256);
GL11.glPopMatrix();
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix(); GL11.glPopMatrix();
} }
@@ -11,6 +11,7 @@ import net.minecraft.server.MinecraftServer;
import WayofTime.alchemicalWizardry.ModItems; import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.common.items.LavaCrystal; import WayofTime.alchemicalWizardry.common.items.LavaCrystal;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.IFuelHandler; import cpw.mods.fml.common.IFuelHandler;
public class AlchemicalWizardryFuelHandler implements IFuelHandler { public class AlchemicalWizardryFuelHandler implements IFuelHandler {
@@ -35,11 +36,12 @@ public class AlchemicalWizardryFuelHandler implements IFuelHandler {
return 0; return 0;
} }
if (MinecraftServer.getServer() == null) { MinecraftServer mcServer = FMLCommonHandler.instance().getMinecraftServerInstance();
if (mcServer == null) {
return 0; return 0;
} }
if (MinecraftServer.getServer().getConfigurationManager() == null) { if (mcServer.getConfigurationManager() == null) {
return 0; return 0;
} }
@@ -1,5 +1,7 @@
package WayofTime.alchemicalWizardry.common; package WayofTime.alchemicalWizardry.common;
import java.util.Arrays;
import java.util.BitSet;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@@ -10,6 +12,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
@@ -77,6 +80,8 @@ public enum NewPacketHandler {
.addAfter(tileAltarCodec, "CurrentReagentBarMessageHandler", new CurrentReagentBarMessageHandler()); .addAfter(tileAltarCodec, "CurrentReagentBarMessageHandler", new CurrentReagentBarMessageHandler());
clientChannel.pipeline() clientChannel.pipeline()
.addAfter(tileAltarCodec, "CurrentAddedHPMessageHandler", new CurrentAddedHPMessageHandler()); .addAfter(tileAltarCodec, "CurrentAddedHPMessageHandler", new CurrentAddedHPMessageHandler());
clientChannel.pipeline()
.addAfter(tileAltarCodec, "GaiaBiomeChangeHandler", new GaiaBiomeChangeMessageHandler());
} }
@SideOnly(Side.SERVER) @SideOnly(Side.SERVER)
@@ -283,6 +288,23 @@ public enum NewPacketHandler {
} }
} }
private static class GaiaBiomeChangeMessageHandler extends SimpleChannelInboundHandler<GaiaBiomeChangeMessage> {
@Override
protected void channelRead0(ChannelHandlerContext ctx, GaiaBiomeChangeMessage msg) throws Exception {
Chunk chunk = AlchemicalWizardry.proxy.getClientWorld().getChunkFromChunkCoords(msg.chunkX, msg.chunkZ);
if (chunk != null) {
byte[] biomeArray = chunk.getBiomeArray();
for (int i = 0; i < 16 * 16; ++i) {
if (msg.mask.get(i)) {
biomeArray[i] = msg.biome;
}
}
chunk.setBiomeArray(biomeArray);
}
}
}
public static class BMMessage { public static class BMMessage {
int index; int index;
@@ -417,6 +439,16 @@ public enum NewPacketHandler {
byte keyPressed; byte keyPressed;
} }
public static class GaiaBiomeChangeMessage extends BMMessage {
int chunkX;
int chunkZ;
byte biome;
BitSet mask;
// One bit per coordinate in a chunk, 16*16 bits = 32 bytes
public static final int maskByteCount = 32;
}
private class ClientToServerCodec extends FMLIndexedMessageToMessageCodec<BMMessage> { private class ClientToServerCodec extends FMLIndexedMessageToMessageCodec<BMMessage> {
public ClientToServerCodec() {} public ClientToServerCodec() {}
@@ -458,6 +490,7 @@ public enum NewPacketHandler {
addDiscriminator(12, CurrentReagentBarMessage.class); addDiscriminator(12, CurrentReagentBarMessage.class);
addDiscriminator(13, CurrentAddedHPMessage.class); addDiscriminator(13, CurrentAddedHPMessage.class);
addDiscriminator(14, KeyboardMessage.class); addDiscriminator(14, KeyboardMessage.class);
addDiscriminator(15, GaiaBiomeChangeMessage.class);
} }
@Override @Override
@@ -669,6 +702,17 @@ public enum NewPacketHandler {
target.writeByte(((KeyboardMessage) msg).keyPressed); target.writeByte(((KeyboardMessage) msg).keyPressed);
break; break;
case 15:
target.writeInt(((GaiaBiomeChangeMessage) msg).chunkX);
target.writeInt(((GaiaBiomeChangeMessage) msg).chunkZ);
target.writeByte(((GaiaBiomeChangeMessage) msg).biome);
byte[] arr = Arrays.copyOf(
((GaiaBiomeChangeMessage) msg).mask.toByteArray(),
GaiaBiomeChangeMessage.maskByteCount);
target.writeBytes(arr);
break;
} }
} }
@@ -894,6 +938,16 @@ public enum NewPacketHandler {
System.out.println("Packet recieved: being decoded"); System.out.println("Packet recieved: being decoded");
((KeyboardMessage) msg).keyPressed = dat.readByte(); ((KeyboardMessage) msg).keyPressed = dat.readByte();
break; break;
case 15:
((GaiaBiomeChangeMessage) msg).chunkX = dat.readInt();
((GaiaBiomeChangeMessage) msg).chunkZ = dat.readInt();
((GaiaBiomeChangeMessage) msg).biome = dat.readByte();
byte[] buffer = new byte[GaiaBiomeChangeMessage.maskByteCount];
dat.readBytes(buffer);
((GaiaBiomeChangeMessage) msg).mask = BitSet.valueOf(buffer);
break;
} }
} }
} }
@@ -1067,6 +1121,17 @@ public enum NewPacketHandler {
return INSTANCE.channels.get(Side.CLIENT).generatePacketFrom(msg); return INSTANCE.channels.get(Side.CLIENT).generatePacketFrom(msg);
} }
public static Packet getGaiaBiomeChangePacket(int x, int z, byte biome, BitSet mask) {
GaiaBiomeChangeMessage msg = new GaiaBiomeChangeMessage();
msg.index = 15;
msg.chunkX = x;
msg.chunkZ = z;
msg.biome = biome;
msg.mask = mask;
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
}
public void sendTo(Packet message, EntityPlayerMP player) { public void sendTo(Packet message, EntityPlayerMP player) {
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET) this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET)
.set(FMLOutboundHandler.OutboundTarget.PLAYER); .set(FMLOutboundHandler.OutboundTarget.PLAYER);
@@ -1087,6 +1152,13 @@ public enum NewPacketHandler {
this.channels.get(Side.SERVER).writeAndFlush(message); this.channels.get(Side.SERVER).writeAndFlush(message);
} }
public void sendToDimension(Packet message, Integer dimensionId) {
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET)
.set(FMLOutboundHandler.OutboundTarget.DIMENSION);
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(dimensionId);
this.channels.get(Side.SERVER).writeAndFlush(message);
}
public void sendToServer(Packet message) { public void sendToServer(Packet message) {
this.channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET) this.channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET)
.set(FMLOutboundHandler.OutboundTarget.TOSERVER); .set(FMLOutboundHandler.OutboundTarget.TOSERVER);
@@ -5,21 +5,28 @@ import java.util.Random;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator; import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator; import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockAlchemicCalcinator extends BlockContainer { public class BlockAlchemicCalcinator extends BlockContainer {
@SideOnly(Side.CLIENT)
private IIcon icon;
public BlockAlchemicCalcinator() { public BlockAlchemicCalcinator() {
super(Material.rock); super(Material.rock);
setHardness(2.0F); setHardness(2.0F);
@@ -28,6 +35,18 @@ public class BlockAlchemicCalcinator extends BlockContainer {
this.setBlockName("alchemicCalcinator"); this.setBlockName("alchemicCalcinator");
} }
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
return icon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.icon = iconRegister.registerIcon("AlchemicalWizardry:BlankRune");
}
@Override @Override
public TileEntity createNewTileEntity(World world, int meta) { public TileEntity createNewTileEntity(World world, int meta) {
return new TEAlchemicCalcinator(); return new TEAlchemicCalcinator();
@@ -3,8 +3,10 @@ package WayofTime.alchemicalWizardry.common.block;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@@ -13,6 +15,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
@@ -26,12 +29,36 @@ import cpw.mods.fml.relauncher.SideOnly;
public class BlockBelljar extends BlockContainer { public class BlockBelljar extends BlockContainer {
@SideOnly(Side.CLIENT)
private IIcon bottomIcon;
@SideOnly(Side.CLIENT)
private IIcon otherIcon;
public BlockBelljar() { public BlockBelljar() {
super(Material.glass); super(Material.glass);
setHardness(2.0F); setHardness(2.0F);
setResistance(5.0F); setResistance(5.0F);
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("crystalBelljar"); this.setBlockName("crystalBelljar");
this.setStepSound(Block.soundTypeGlass);
this.setHarvestLevel("pickaxe", 0);
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
if (side == 0) {
return bottomIcon;
}
return otherIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.bottomIcon = iconRegister.registerIcon("minecraft:planks_oak");
this.otherIcon = iconRegister.registerIcon("minecraft:glass");
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@@ -11,6 +11,7 @@ import net.minecraft.world.Explosion;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.items.ActivationCrystal; import WayofTime.alchemicalWizardry.common.items.ActivationCrystal;
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@@ -79,7 +80,7 @@ public class BlockMasterStone extends BlockContainer {
acItem.getCrystalLevel(playerItem), acItem.getCrystalLevel(playerItem),
playerItem, playerItem,
player, player,
acItem.getOwnerName(playerItem)); IBindable.getOwnerName(playerItem));
world.markBlockForUpdate(x, y, z); world.markBlockForUpdate(x, y, z);
return true; return true;
} }
@@ -33,6 +33,9 @@ public class BloodRune extends Block {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon accelerationRuneIcon; private IIcon accelerationRuneIcon;
@SideOnly(Side.CLIENT)
private IIcon quicknessRuneIcon;
public BloodRune() { public BloodRune() {
super(Material.iron); super(Material.iron);
this.setBlockName("bloodRune"); this.setBlockName("bloodRune");
@@ -50,6 +53,7 @@ public class BloodRune extends Block {
this.orbCapacityRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:OrbCapacityRune"); this.orbCapacityRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:OrbCapacityRune");
this.betterCapacityRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:BetterCapacityRune"); this.betterCapacityRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:BetterCapacityRune");
this.accelerationRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:AccelerationRune"); this.accelerationRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:AccelerationRune");
this.quicknessRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:QuicknessRune");
} }
public int getRuneEffect(int metaData) { public int getRuneEffect(int metaData) {
@@ -71,6 +75,9 @@ public class BloodRune extends Block {
case 5: // Acceleration rune case 5: // Acceleration rune
return 9; return 9;
case 6: // Quickness Rune
return 10;
} }
return 0; return 0;
@@ -89,6 +96,7 @@ public class BloodRune extends Block {
par3List.add(new ItemStack(par1, 1, 3)); par3List.add(new ItemStack(par1, 1, 3));
par3List.add(new ItemStack(par1, 1, 4)); par3List.add(new ItemStack(par1, 1, 4));
par3List.add(new ItemStack(par1, 1, 5)); par3List.add(new ItemStack(par1, 1, 5));
par3List.add(new ItemStack(par1, 1, 6));
} else { } else {
super.getSubBlocks(par1, par2CreativeTabs, par3List); super.getSubBlocks(par1, par2CreativeTabs, par3List);
} }
@@ -115,6 +123,10 @@ public class BloodRune extends Block {
case 5: case 5:
return this.accelerationRuneIcon; return this.accelerationRuneIcon;
case 6:
return this.quicknessRuneIcon;
default: default:
return blockIcon; return blockIcon;
} }
@@ -11,6 +11,7 @@ public class AltarUpgradeComponent {
private int orbCapacitiveUpgrades; private int orbCapacitiveUpgrades;
private int betterCapacitiveUpgrades; private int betterCapacitiveUpgrades;
private int accelerationUpgrades; private int accelerationUpgrades;
private int quicknessUpgrades;
public AltarUpgradeComponent() { public AltarUpgradeComponent() {
speedUpgrades = 0; speedUpgrades = 0;
@@ -22,6 +23,7 @@ public class AltarUpgradeComponent {
orbCapacitiveUpgrades = 0; orbCapacitiveUpgrades = 0;
betterCapacitiveUpgrades = 0; betterCapacitiveUpgrades = 0;
accelerationUpgrades = 0; accelerationUpgrades = 0;
quicknessUpgrades = 0;
} }
public void addSpeedUpgrade() { public void addSpeedUpgrade() {
@@ -60,6 +62,10 @@ public class AltarUpgradeComponent {
accelerationUpgrades++; accelerationUpgrades++;
} }
public void addQuicknessUpgrade() {
quicknessUpgrades++;
}
public int getSpeedUpgrades() { public int getSpeedUpgrades() {
return speedUpgrades; return speedUpgrades;
} }
@@ -95,4 +101,8 @@ public class AltarUpgradeComponent {
public int getAccelerationUpgrades() { public int getAccelerationUpgrades() {
return this.accelerationUpgrades; return this.accelerationUpgrades;
} }
public int getQuicknessUpgrades() {
return this.quicknessUpgrades;
}
} }
@@ -5,6 +5,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@@ -65,9 +66,14 @@ public class UpgradedAltars {
private static boolean checkAltarComponent(AltarComponent altarComponent, IBlockAccess world, int x, int y, int z, private static boolean checkAltarComponent(AltarComponent altarComponent, IBlockAccess world, int x, int y, int z,
int altarTier) { int altarTier) {
Block block = world.getBlock(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ()); int compX = x + altarComponent.getX();
int metadata = world int compY = y + altarComponent.getY();
.getBlockMetadata(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ()); int compZ = z + altarComponent.getZ();
if (altarComponent.getBlock() == Blocks.air) {
return !world.isAirBlock(compX, compY, compZ);
}
Block block = world.getBlock(compX, compY, compZ);
int metadata = world.getBlockMetadata(compX, compY, compZ);
if (altarComponent.isBloodRune()) { if (altarComponent.isBloodRune()) {
boolean result = false; boolean result = false;
BlockStack[] runes = getRuneOverrides(altarTier); BlockStack[] runes = getRuneOverrides(altarTier);
@@ -142,6 +148,10 @@ public class UpgradedAltars {
case 9: case 9:
upgrades.addAccelerationUpgrade(); upgrades.addAccelerationUpgrade();
break; break;
case 10:
upgrades.addQuicknessUpgrade();
break;
} }
} }
} }
@@ -410,6 +410,12 @@ public class BloodMagicGuide {
PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.accelerationRune"))); PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.accelerationRune")));
entries.add(new EntryUniText(accelerationRunePages, "guide.BloodMagic.entryName.architect.accelerationRune")); entries.add(new EntryUniText(accelerationRunePages, "guide.BloodMagic.entryName.architect.accelerationRune"));
ArrayList<IPage> quicknessRuneRecipe = new ArrayList();
demonicOrbPages.add(getOrbPageForRecipe(RecipeHolder.quicknessRuneRecipe));
quicknessRuneRecipe.addAll(
PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.quicknessRune")));
entries.add(new EntryUniText(quicknessRuneRecipe, "guide.BloodMagic.entryName.architect.quicknessRune"));
ArrayList<IPage> harvestPages = new ArrayList(); ArrayList<IPage> harvestPages = new ArrayList();
demonicOrbPages.add(getOrbPageForRecipe(RecipeHolder.harvestSigilRecipe)); demonicOrbPages.add(getOrbPageForRecipe(RecipeHolder.harvestSigilRecipe));
harvestPages harvestPages
@@ -10,7 +10,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
public class CommandBind extends CommandBase { public class CommandBind extends CommandBase {
@@ -38,8 +37,8 @@ public class CommandBind extends CommandBase {
} }
if (item != null && item.getItem() instanceof IBindable) { if (item != null && item.getItem() instanceof IBindable) {
if (EnergyItems.getOwnerName(item).isEmpty()) { if (IBindable.getOwnerName(item).isEmpty()) {
EnergyItems.checkAndSetItemOwner(item, targetPlayer); IBindable.checkAndSetItemOwner(item, targetPlayer);
func_152373_a(iCommandSender, this, "commands.bind.success"); func_152373_a(iCommandSender, this, "commands.bind.success");
} else { } else {
throw new CommandException("commands.bind.failed.alreadyBound"); throw new CommandException("commands.bind.failed.alreadyBound");
@@ -1,6 +1,10 @@
package WayofTime.alchemicalWizardry.common.commands; package WayofTime.alchemicalWizardry.common.commands;
import java.util.*; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.command.CommandBase; import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender; import net.minecraft.command.ICommandSender;
@@ -7,7 +7,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
public class CommandUnbind extends CommandBase { public class CommandUnbind extends CommandBase {
@@ -30,7 +29,7 @@ public class CommandUnbind extends CommandBase {
ItemStack item = entityplayermp.getCurrentEquippedItem(); ItemStack item = entityplayermp.getCurrentEquippedItem();
if (item != null && item.getItem() instanceof IBindable) { if (item != null && item.getItem() instanceof IBindable) {
if (!EnergyItems.getOwnerName(item).isEmpty()) { if (!IBindable.getOwnerName(item).isEmpty()) {
item.getTagCompound().removeTag("ownerName"); item.getTagCompound().removeTag("ownerName");
func_152373_a(iCommandSender, this, "commands.unbind.success"); func_152373_a(iCommandSender, this, "commands.unbind.success");
} else { } else {
@@ -9,7 +9,6 @@ import net.minecraft.util.StatCollector;
import WayofTime.alchemicalWizardry.api.command.SubCommandBase; import WayofTime.alchemicalWizardry.api.command.SubCommandBase;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
public class SubCommandBind extends SubCommandBase { public class SubCommandBind extends SubCommandBase {
@@ -56,10 +55,10 @@ public class SubCommandBind extends SubCommandBase {
} }
if (bind) { if (bind) {
EnergyItems.setItemOwner(held, playerName); IBindable.setItemOwner(held, playerName);
commandSender.addChatMessage(new ChatComponentTranslation("commands.bind.success")); commandSender.addChatMessage(new ChatComponentTranslation("commands.bind.success"));
} else { } else {
if (!EnergyItems.getOwnerName(held).isEmpty()) { if (!IBindable.getOwnerName(held).isEmpty()) {
held.stackTagCompound.removeTag("ownerName"); held.stackTagCompound.removeTag("ownerName");
commandSender.addChatMessage(new ChatComponentTranslation("commands.bind.remove.success")); commandSender.addChatMessage(new ChatComponentTranslation("commands.bind.remove.success"));
} }
@@ -3,7 +3,15 @@ package WayofTime.alchemicalWizardry.common.entity.mob;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.*; import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIFollowOwner;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.passive.EntityHorse; import net.minecraft.entity.passive.EntityHorse;
@@ -3,7 +3,16 @@ package WayofTime.alchemicalWizardry.common.entity.mob;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.*; import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIFollowOwner;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILeapAtTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.passive.EntityHorse; import net.minecraft.entity.passive.EntityHorse;
@@ -1,7 +1,19 @@
package WayofTime.alchemicalWizardry.common.entity.mob; package WayofTime.alchemicalWizardry.common.entity.mob;
import net.minecraft.entity.*; import net.minecraft.entity.Entity;
import net.minecraft.entity.ai.*; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IRangedAttackMob;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIArrowAttack;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIFollowOwner;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.passive.EntityHorse; import net.minecraft.entity.passive.EntityHorse;
@@ -3,7 +3,15 @@ package WayofTime.alchemicalWizardry.common.entity.mob;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.*; import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIFollowOwner;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.passive.EntityHorse; import net.minecraft.entity.passive.EntityHorse;
@@ -3,7 +3,15 @@ package WayofTime.alchemicalWizardry.common.entity.mob;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.*; import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIFollowOwner;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.passive.EntityHorse; import net.minecraft.entity.passive.EntityHorse;
@@ -1,7 +1,19 @@
package WayofTime.alchemicalWizardry.common.entity.mob; package WayofTime.alchemicalWizardry.common.entity.mob;
import net.minecraft.entity.*; import net.minecraft.entity.Entity;
import net.minecraft.entity.ai.*; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IRangedAttackMob;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIArrowAttack;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIFollowOwner;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.passive.EntityHorse; import net.minecraft.entity.passive.EntityHorse;
@@ -1,7 +1,19 @@
package WayofTime.alchemicalWizardry.common.entity.mob; package WayofTime.alchemicalWizardry.common.entity.mob;
import net.minecraft.entity.*; import net.minecraft.entity.Entity;
import net.minecraft.entity.ai.*; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IRangedAttackMob;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIArrowAttack;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIFollowOwner;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.passive.EntityHorse; import net.minecraft.entity.passive.EntityHorse;
@@ -1,22 +1,22 @@
package WayofTime.alchemicalWizardry.common.entity.projectile; package WayofTime.alchemicalWizardry.common.entity.projectile;
import java.util.ArrayList;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorRegistry; import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorRegistry;
public class EntityMeteor extends EnergyBlastProjectile { public class EntityMeteor extends EnergyBlastProjectile {
private int meteorID; private int meteorID;
public boolean hasTerrae; public ArrayList<Reagent> reagentList = new ArrayList<>();
public boolean hasOrbisTerrae;
public boolean hasCrystallos;
public boolean hasIncendium;
public boolean hasTennebrae;
public EntityMeteor(World par1World) { public EntityMeteor(World par1World) {
super(par1World); super(par1World);
@@ -33,11 +33,11 @@ public class EntityMeteor extends EnergyBlastProjectile {
super.writeEntityToNBT(par1NBTTagCompound); super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setInteger("meteorID", meteorID); par1NBTTagCompound.setInteger("meteorID", meteorID);
par1NBTTagCompound.setBoolean("hasTerrae", hasTerrae);
par1NBTTagCompound.setBoolean("hasOrbisTerrae", hasOrbisTerrae); for (Reagent r : reagentList) {
par1NBTTagCompound.setBoolean("hasCrystallos", hasCrystallos); par1NBTTagCompound.setBoolean("reagent." + r.name, true);
par1NBTTagCompound.setBoolean("hasIncendium", hasIncendium); }
par1NBTTagCompound.setBoolean("hasTennebrae", hasTennebrae);
} }
@Override @Override
@@ -45,11 +45,11 @@ public class EntityMeteor extends EnergyBlastProjectile {
super.readEntityFromNBT(par1NBTTagCompound); super.readEntityFromNBT(par1NBTTagCompound);
meteorID = par1NBTTagCompound.getInteger("meteorID"); meteorID = par1NBTTagCompound.getInteger("meteorID");
hasTerrae = par1NBTTagCompound.getBoolean("hasTerrae"); for (Reagent r : ReagentRegistry.reagentList.values()) {
hasOrbisTerrae = par1NBTTagCompound.getBoolean("hasOrbisTerrae"); if (par1NBTTagCompound.getBoolean("reagent." + r.name)) {
hasIncendium = par1NBTTagCompound.getBoolean("hasIncendium"); reagentList.add(r);
hasCrystallos = par1NBTTagCompound.getBoolean("hasCrystallos"); }
hasTennebrae = par1NBTTagCompound.getBoolean("hasTennebrae"); }
} }
@Override @Override
@@ -66,13 +66,7 @@ public class EntityMeteor extends EnergyBlastProjectile {
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) { if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) {
this.onImpact(mop.entityHit); this.onImpact(mop.entityHit);
} else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
MeteorRegistry.createMeteorImpact( MeteorRegistry.createMeteorImpact(worldObj, mop.blockX, mop.blockY, mop.blockZ, this.meteorID, reagentList);
worldObj,
mop.blockX,
mop.blockY,
mop.blockZ,
this.meteorID,
new boolean[] { hasTerrae, hasOrbisTerrae, hasCrystallos, hasIncendium, hasTennebrae });
} }
this.setDead(); this.setDead();
@@ -80,13 +74,8 @@ public class EntityMeteor extends EnergyBlastProjectile {
@Override @Override
public void onImpact(Entity mop) { public void onImpact(Entity mop) {
MeteorRegistry.createMeteorImpact( MeteorRegistry
worldObj, .createMeteorImpact(worldObj, (int) this.posX, (int) this.posY, (int) this.posZ, meteorID, reagentList);
(int) this.posX,
(int) this.posY,
(int) this.posZ,
meteorID,
new boolean[] { hasTerrae, hasOrbisTerrae, hasCrystallos, hasIncendium, hasTennebrae });
this.setDead(); this.setDead();
} }
@@ -58,6 +58,7 @@ public class RecipeHolder {
public static IRecipe keyOfBindingRecipe; public static IRecipe keyOfBindingRecipe;
public static IRecipe energyBazookaRecipe; public static IRecipe energyBazookaRecipe;
public static IRecipe accelerationRuneRecipe; public static IRecipe accelerationRuneRecipe;
public static IRecipe quicknessRuneRecipe;
public static IRecipe harvestSigilRecipe; public static IRecipe harvestSigilRecipe;
public static IRecipe crystalCluserRecipe; public static IRecipe crystalCluserRecipe;
public static IRecipe arcanePlinthRecipe; public static IRecipe arcanePlinthRecipe;
@@ -152,6 +153,7 @@ public class RecipeHolder {
harvestSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemHarvestSigil)); harvestSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemHarvestSigil));
crystalCluserRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockCrystal)); crystalCluserRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockCrystal));
weakRitualStoneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.imperfectRitualStone)); weakRitualStoneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.imperfectRitualStone));
quicknessRuneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.bloodRune, 1, 6));
arcanePlinthRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockPlinth)); arcanePlinthRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockPlinth));
arcanePedestalRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockPedestal)); arcanePedestalRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockPedestal));
@@ -17,6 +17,7 @@ import org.lwjgl.input.Keyboard;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry; import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -92,16 +93,12 @@ public class ActivationCrystal extends EnergyItems {
} }
} }
if (!(par1ItemStack.getTagCompound() == null)) { addBindingInformation(par1ItemStack, par3List);
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
return par1ItemStack; return par1ItemStack;
} }
@@ -113,7 +110,7 @@ public class ActivationCrystal extends EnergyItems {
public String getUnlocalizedName(ItemStack itemStack) { public String getUnlocalizedName(ItemStack itemStack) {
// This is what will do all the localisation things on the alchemy components so you dont have to set it :D // This is what will do all the localisation things on the alchemy components so you dont have to set it :D
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, ACTIVATION_CRYSTAL_NAMES.length - 1); int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, ACTIVATION_CRYSTAL_NAMES.length - 1);
return ("" + "item.activationCrystal" + ACTIVATION_CRYSTAL_NAMES[meta]); return ("item.activationCrystal" + ACTIVATION_CRYSTAL_NAMES[meta]);
} }
@Override @Override
@@ -6,13 +6,13 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -24,8 +24,6 @@ public class ArmourInhibitor extends EnergyItems {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon passiveIcon; private IIcon passiveIcon;
private int tickDelay = 200;
public ArmourInhibitor() { public ArmourInhibitor() {
super(); super();
this.maxStackSize = 1; this.maxStackSize = 1;
@@ -37,18 +35,7 @@ public class ArmourInhibitor extends EnergyItems {
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.armorinhibitor.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.armorinhibitor.desc1"));
par3List.add(StatCollector.translateToLocal("tooltip.armorinhibitor.desc2")); par3List.add(StatCollector.translateToLocal("tooltip.armorinhibitor.desc2"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
} else {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
}
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
@Override @Override
@@ -61,13 +48,7 @@ public class ArmourInhibitor extends EnergyItems {
@Override @Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
if (stack.getTagCompound() == null) { if (IBindable.isActive(stack)) {
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.getTagCompound();
if (tag.getBoolean("isActive")) {
return this.activeIcon; return this.activeIcon;
} else { } else {
return this.passiveIcon; return this.passiveIcon;
@@ -86,20 +67,15 @@ public class ArmourInhibitor extends EnergyItems {
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
return par1ItemStack; return par1ItemStack;
} }
if (par1ItemStack.getTagCompound() == null) { IBindable.setActive(par1ItemStack, !IBindable.isActive(par1ItemStack));
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = par1ItemStack.getTagCompound(); if (IBindable.isActive(par1ItemStack)) {
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
if (tag.getBoolean("isActive")) {
par1ItemStack.setItemDamage(1); par1ItemStack.setItemDamage(1);
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % tickDelay); this.setDrainTick(par1ItemStack, par2World);
} else { } else {
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage()); par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
} }
@@ -115,14 +91,7 @@ public class ArmourInhibitor extends EnergyItems {
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity; EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
if (par1ItemStack.getTagCompound() == null) { if (IBindable.isActive(par1ItemStack)) {
par1ItemStack.setTagCompound(new NBTTagCompound());
}
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
if (par2World.getWorldTime() % tickDelay == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")) {}
// TODO Do stuff
par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 2, 0)); par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 2, 0));
} }
} }
@@ -12,6 +12,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.DimensionManager;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.tileEntity.TEHomHeart; import WayofTime.alchemicalWizardry.common.tileEntity.TEHomHeart;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -33,16 +34,11 @@ public class BlankSpell extends EnergyItems {
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.blankspell.desc")); par3List.add(StatCollector.translateToLocal("tooltip.blankspell.desc"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) { if (!(par1ItemStack.getTagCompound() == null)) {
NBTTagCompound itemTag = par1ItemStack.getTagCompound(); NBTTagCompound itemTag = par1ItemStack.getTagCompound();
if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) {
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
par3List.add( par3List.add(
StatCollector.translateToLocal("tooltip.alchemy.coords") + " " StatCollector.translateToLocal("tooltip.alchemy.coords") + " "
+ itemTag.getInteger("xCoord") + itemTag.getInteger("xCoord")
@@ -57,7 +53,7 @@ public class BlankSpell extends EnergyItems {
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
return par1ItemStack; return par1ItemStack;
} }
@@ -32,6 +32,7 @@ public class BoundAxe extends ItemAxe implements IBindable {
public float efficiencyOnProperMaterial = 12.0F; public float efficiencyOnProperMaterial = 12.0F;
public float damageVsEntity; public float damageVsEntity;
public int rightClickCost = 10000;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon activeIcon; private IIcon activeIcon;
@@ -59,23 +60,15 @@ public class BoundAxe extends ItemAxe implements IBindable {
return this.energyUsed; return this.energyUsed;
} }
@Override
public int drainCost() {
return this.energyUsed;
}
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.boundaxe.desc")); par3List.add(StatCollector.translateToLocal("tooltip.boundaxe.desc"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
} else {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
}
if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) {
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
}
} }
@Override @Override
@@ -88,13 +81,7 @@ public class BoundAxe extends ItemAxe implements IBindable {
@Override @Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
if (stack.getTagCompound() == null) { if (IBindable.isActive(stack)) {
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.getTagCompound();
if (tag.getBoolean("isActive")) {
return this.activeIcon; return this.activeIcon;
} else { } else {
return this.passiveIcon; return this.passiveIcon;
@@ -103,29 +90,7 @@ public class BoundAxe extends ItemAxe implements IBindable {
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer)) {
this.setActivated(par1ItemStack, !getActivated(par1ItemStack));
par1ItemStack.getTagCompound().setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
return par1ItemStack;
}
if (par2World.isRemote) {
return par1ItemStack;
}
if (!getActivated(par1ItemStack) || SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) {
return par1ItemStack;
}
if (AlchemicalWizardry.disableBoundToolsRightClick) {
return par1ItemStack;
}
if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionInhibit)) {
return par1ItemStack;
}
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 10000)) {
return par1ItemStack; return par1ItemStack;
} }
@@ -185,45 +150,18 @@ public class BoundAxe extends ItemAxe implements IBindable {
if (par1ItemStack.getTagCompound() == null) { if (par1ItemStack.getTagCompound() == null) {
par1ItemStack.setTagCompound(new NBTTagCompound()); par1ItemStack.setTagCompound(new NBTTagCompound());
} }
if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
if (!par3EntityPlayer.capabilities.isCreativeMode) {
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 20)) {
this.setActivated(par1ItemStack, false);
}
}
}
par1ItemStack.setItemDamage(0); par1ItemStack.setItemDamage(0);
} }
public void setActivated(ItemStack par1ItemStack, boolean newActivated) {
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
if (itemTag == null) {
par1ItemStack.setTagCompound(new NBTTagCompound());
}
itemTag.setBoolean("isActive", newActivated);
}
public boolean getActivated(ItemStack par1ItemStack) {
if (!par1ItemStack.hasTagCompound()) {
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
return itemTag.getBoolean("isActive");
}
/** /**
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if * Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
* sword * sword
*/ */
@Override @Override
public float func_150893_a(ItemStack par1ItemStack, Block par2Block) { public float func_150893_a(ItemStack par1ItemStack, Block par2Block) {
if (!getActivated(par1ItemStack)) { if (!IBindable.isActive(par1ItemStack)) {
return 0.0F; return 0.0F;
} }
@@ -236,7 +174,7 @@ public class BoundAxe extends ItemAxe implements IBindable {
*/ */
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase,
EntityLivingBase par3EntityLivingBase) { EntityLivingBase par3EntityLivingBase) {
return getActivated(par1ItemStack); return IBindable.isActive(par1ItemStack);
} }
public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, Block par3, int par4, int par5, int par6, public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, Block par3, int par4, int par5, int par6,
@@ -266,7 +204,7 @@ public class BoundAxe extends ItemAxe implements IBindable {
*/ */
@Override @Override
public float getDigSpeed(ItemStack stack, Block block, int meta) { public float getDigSpeed(ItemStack stack, Block block, int meta) {
if (!getActivated(stack)) { if (!IBindable.isActive(stack)) {
return 0.0F; return 0.0F;
} }
@@ -279,11 +217,21 @@ public class BoundAxe extends ItemAxe implements IBindable {
@Override @Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
return !getActivated(stack); return !IBindable.isActive(stack);
} }
@Override @Override
public int getHarvestLevel(ItemStack stack, String toolClass) { public int getHarvestLevel(ItemStack stack, String toolClass) {
return getActivated(stack) ? super.getHarvestLevel(stack, toolClass) : -1; return IBindable.isActive(stack) ? super.getHarvestLevel(stack, toolClass) : -1;
}
@Override
public boolean isBoundTool() {
return true;
}
@Override
public int rightClickCost() {
return rightClickCost;
} }
} }
@@ -33,6 +33,7 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
public float efficiencyOnProperMaterial = 12.0F; public float efficiencyOnProperMaterial = 12.0F;
public float damageVsEntity; public float damageVsEntity;
public int rightClickCost = 10000;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon activeIcon; private IIcon activeIcon;
@@ -60,24 +61,16 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
return this.energyUsed; return this.energyUsed;
} }
@Override
public int drainCost() {
return this.energyUsed;
}
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.boundpickaxe.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.boundpickaxe.desc1"));
par3List.add(StatCollector.translateToLocal("tooltip.boundpickaxe.desc2")); par3List.add(StatCollector.translateToLocal("tooltip.boundpickaxe.desc2"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
} else {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
}
if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) {
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
}
} }
@Override @Override
@@ -90,13 +83,7 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
@Override @Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
if (stack.getTagCompound() == null) { if (IBindable.isActive(stack)) {
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.getTagCompound();
if (tag.getBoolean("isActive")) {
return this.activeIcon; return this.activeIcon;
} else { } else {
return this.passiveIcon; return this.passiveIcon;
@@ -105,32 +92,9 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer)) {
this.setActivated(par1ItemStack, !getActivated(par1ItemStack));
par1ItemStack.getTagCompound().setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
return par1ItemStack; return par1ItemStack;
} }
if (par2World.isRemote) {
return par1ItemStack;
}
if (!getActivated(par1ItemStack) || SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) {
return par1ItemStack;
}
if (AlchemicalWizardry.disableBoundToolsRightClick) {
return par1ItemStack;
}
if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionInhibit)) {
return par1ItemStack;
}
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 10000)) {
return par1ItemStack;
}
Vec3 blockVec = SpellHelper.getEntityBlockVector(par3EntityPlayer); Vec3 blockVec = SpellHelper.getEntityBlockVector(par3EntityPlayer);
int posX = (int) (blockVec.xCoord); int posX = (int) (blockVec.xCoord);
int posY = (int) (blockVec.yCoord); int posY = (int) (blockVec.yCoord);
@@ -203,38 +167,11 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
par1ItemStack.setTagCompound(new NBTTagCompound()); par1ItemStack.setTagCompound(new NBTTagCompound());
} }
if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
if (!par3EntityPlayer.capabilities.isCreativeMode) {
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 20)) {
this.setActivated(par1ItemStack, false);
}
}
}
par1ItemStack.setItemDamage(0); par1ItemStack.setItemDamage(0);
} }
public void setActivated(ItemStack par1ItemStack, boolean newActivated) {
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
if (itemTag == null) {
par1ItemStack.setTagCompound(new NBTTagCompound());
}
itemTag.setBoolean("isActive", newActivated);
}
public boolean getActivated(ItemStack par1ItemStack) {
if (!par1ItemStack.hasTagCompound()) {
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
return itemTag.getBoolean("isActive");
}
/** /**
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if * Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
* sword * sword
@@ -242,7 +179,7 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
@Override @Override
public float func_150893_a(ItemStack par1ItemStack, Block par2Block) // getStrVsBlock public float func_150893_a(ItemStack par1ItemStack, Block par2Block) // getStrVsBlock
{ {
if (!getActivated(par1ItemStack)) { if (!IBindable.isActive(par1ItemStack)) {
return 0.0F; return 0.0F;
} }
@@ -253,9 +190,10 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
* the damage on the stack. * the damage on the stack.
*/ */
@Override
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase,
EntityLivingBase par3EntityLivingBase) { EntityLivingBase par3EntityLivingBase) {
return getActivated(par1ItemStack); return IBindable.isActive(par1ItemStack);
} }
@Override @Override
@@ -263,7 +201,7 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
EntityLivingBase par7EntityLivingBase) { EntityLivingBase par7EntityLivingBase) {
if (par7EntityLivingBase instanceof EntityPlayer) { if (par7EntityLivingBase instanceof EntityPlayer) {
EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par7EntityLivingBase, getEnergyUsed()); EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par7EntityLivingBase, drainCost());
} }
return true; return true;
} }
@@ -290,7 +228,7 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
*/ */
@Override @Override
public float getDigSpeed(ItemStack stack, Block block, int meta) { public float getDigSpeed(ItemStack stack, Block block, int meta) {
if (!getActivated(stack)) { if (!IBindable.isActive(stack)) {
return 0.0F; return 0.0F;
} }
@@ -303,11 +241,21 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
@Override @Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
return !getActivated(stack); return !IBindable.isActive(stack);
} }
@Override @Override
public int getHarvestLevel(ItemStack stack, String toolClass) { public int getHarvestLevel(ItemStack stack, String toolClass) {
return getActivated(stack) ? super.getHarvestLevel(stack, toolClass) : -1; return IBindable.isActive(stack) ? super.getHarvestLevel(stack, toolClass) : -1;
}
@Override
public boolean isBoundTool() {
return true;
}
@Override
public int rightClickCost() {
return rightClickCost;
} }
} }
@@ -34,6 +34,7 @@ public class BoundShovel extends ItemSpade implements IBindable {
public float efficiencyOnProperMaterial = 12.0F; public float efficiencyOnProperMaterial = 12.0F;
public float damageVsEntity; public float damageVsEntity;
public int rightClickCost = 10000;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon activeIcon; private IIcon activeIcon;
@@ -61,23 +62,15 @@ public class BoundShovel extends ItemSpade implements IBindable {
return this.energyUsed; return this.energyUsed;
} }
@Override
public int drainCost() {
return this.energyUsed;
}
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.boundshovel.desc")); par3List.add(StatCollector.translateToLocal("tooltip.boundshovel.desc"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
} else {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
}
if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) {
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
}
} }
@Override @Override
@@ -90,13 +83,7 @@ public class BoundShovel extends ItemSpade implements IBindable {
@Override @Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
if (stack.getTagCompound() == null) { if (IBindable.isActive(stack)) {
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.getTagCompound();
if (tag.getBoolean("isActive")) {
return this.activeIcon; return this.activeIcon;
} else { } else {
return this.passiveIcon; return this.passiveIcon;
@@ -105,29 +92,7 @@ public class BoundShovel extends ItemSpade implements IBindable {
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer)) {
this.setActivated(par1ItemStack, !getActivated(par1ItemStack));
par1ItemStack.getTagCompound().setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
return par1ItemStack;
}
if (par2World.isRemote) {
return par1ItemStack;
}
if (!getActivated(par1ItemStack) || SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) {
return par1ItemStack;
}
if (AlchemicalWizardry.disableBoundToolsRightClick) {
return par1ItemStack;
}
if (par3EntityPlayer.isPotionActive(AlchemicalWizardry.customPotionInhibit)) {
return par1ItemStack;
}
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 10000)) {
return par1ItemStack; return par1ItemStack;
} }
@@ -186,45 +151,19 @@ public class BoundShovel extends ItemSpade implements IBindable {
if (par1ItemStack.getTagCompound() == null) { if (par1ItemStack.getTagCompound() == null) {
par1ItemStack.setTagCompound(new NBTTagCompound()); par1ItemStack.setTagCompound(new NBTTagCompound());
} }
if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")
&& par1ItemStack.getTagCompound().getBoolean("isActive")) { checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
if (!par3EntityPlayer.capabilities.isCreativeMode) {
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 20)) {
this.setActivated(par1ItemStack, false);
}
}
}
par1ItemStack.setItemDamage(0); par1ItemStack.setItemDamage(0);
} }
public void setActivated(ItemStack par1ItemStack, boolean newActivated) {
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
if (itemTag == null) {
par1ItemStack.setTagCompound(new NBTTagCompound());
}
itemTag.setBoolean("isActive", newActivated);
}
public boolean getActivated(ItemStack par1ItemStack) {
if (!par1ItemStack.hasTagCompound()) {
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
return itemTag.getBoolean("isActive");
}
/** /**
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if * Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
* sword * sword
*/ */
@Override @Override
public float func_150893_a(ItemStack par1ItemStack, Block par2Block) { public float func_150893_a(ItemStack par1ItemStack, Block par2Block) {
if (!getActivated(par1ItemStack)) { if (!IBindable.isActive(par1ItemStack)) {
return 0.0F; return 0.0F;
} }
@@ -237,7 +176,7 @@ public class BoundShovel extends ItemSpade implements IBindable {
*/ */
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase,
EntityLivingBase par3EntityLivingBase) { EntityLivingBase par3EntityLivingBase) {
return getActivated(par1ItemStack); return IBindable.isActive(par1ItemStack);
} }
public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6,
@@ -275,7 +214,7 @@ public class BoundShovel extends ItemSpade implements IBindable {
*/ */
@Override @Override
public float getDigSpeed(ItemStack stack, Block block, int meta) { public float getDigSpeed(ItemStack stack, Block block, int meta) {
if (!getActivated(stack)) { if (!IBindable.isActive(stack)) {
return 0.0F; return 0.0F;
} }
@@ -288,11 +227,21 @@ public class BoundShovel extends ItemSpade implements IBindable {
@Override @Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
return !getActivated(stack); return !IBindable.isActive(stack);
} }
@Override @Override
public int getHarvestLevel(ItemStack stack, String toolClass) { public int getHarvestLevel(ItemStack stack, String toolClass) {
return getActivated(stack) ? super.getHarvestLevel(stack, toolClass) : -1; return IBindable.isActive(stack) ? super.getHarvestLevel(stack, toolClass) : -1;
}
@Override
public boolean isBoundTool() {
return true;
}
@Override
public int rightClickCost() {
return rightClickCost;
} }
} }
@@ -39,18 +39,13 @@ public class CheatyItem extends Item implements IBindable {
par3List.add(StatCollector.translateToLocal("tooltip.mode.creative")); par3List.add(StatCollector.translateToLocal("tooltip.mode.creative"));
par3List.add(StatCollector.translateToLocal("tooltip.cheatyitem.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.cheatyitem.desc1"));
par3List.add(StatCollector.translateToLocal("tooltip.cheatyitem.desc2")); par3List.add(StatCollector.translateToLocal("tooltip.cheatyitem.desc2"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
World world = par3EntityPlayer.worldObj; World world = par3EntityPlayer.worldObj;
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)
|| par3EntityPlayer instanceof FakePlayer) { || par3EntityPlayer instanceof FakePlayer) {
return par1ItemStack; return par1ItemStack;
} }
@@ -8,6 +8,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -27,25 +28,16 @@ public class DemonicTelepositionFocus extends TelepositionFocus {
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.demonictelepfocus.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.demonictelepfocus.desc1"));
par3List.add(StatCollector.translateToLocal("tooltip.demonictelepfocus.desc2")); par3List.add(StatCollector.translateToLocal("tooltip.demonictelepfocus.desc2"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) { NBTTagCompound itemTag = IBindable.getTag(par1ItemStack);
NBTTagCompound itemTag = par1ItemStack.getTagCompound(); par3List.add(
StatCollector.translateToLocal("tooltip.alchemy.coords") + " "
if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) { + itemTag.getInteger("xCoord")
par3List.add( + ", "
StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + itemTag.getInteger("yCoord")
+ par1ItemStack.getTagCompound().getString("ownerName")); + ", "
} + itemTag.getInteger("zCoord"));
par3List.add(StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + getDimensionID(par1ItemStack));
par3List.add(
StatCollector.translateToLocal("tooltip.alchemy.coords") + " "
+ itemTag.getInteger("xCoord")
+ ", "
+ itemTag.getInteger("yCoord")
+ ", "
+ itemTag.getInteger("zCoord"));
par3List.add(
StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + getDimensionID(par1ItemStack));
}
} }
} }
@@ -43,15 +43,11 @@ public class EnergyBattery extends Item implements ArmourUpgrade, IBindable, IBl
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.energybattery.desc")); par3List.add(StatCollector.translateToLocal("tooltip.energybattery.desc"));
if (!(par1ItemStack.getTagCompound() == null)) { addBindingInformation(par1ItemStack, par3List);
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) { if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) {
return par1ItemStack; return par1ItemStack;
} }
@@ -3,11 +3,8 @@ package WayofTime.alchemicalWizardry.common.items;
import java.util.List; import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraft.world.World; import net.minecraft.world.World;
@@ -17,30 +14,10 @@ import WayofTime.alchemicalWizardry.common.entity.projectile.EntityEnergyBazooka
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
public class EnergyBazooka extends EnergyItems { public class EnergyBazooka extends EnergyBlast {
@SideOnly(Side.CLIENT)
private IIcon activeIcon;
@SideOnly(Side.CLIENT)
private IIcon activeIconTier2;
@SideOnly(Side.CLIENT)
private IIcon activeIconTier3;
@SideOnly(Side.CLIENT)
private IIcon passiveIcon;
private int tier;
private int damage;
public EnergyBazooka(int tier) { public EnergyBazooka(int tier) {
super(); super(tier);
setMaxStackSize(1);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
setFull3D();
setMaxDamage(250);
this.tier = tier;
switch (this.tier) { switch (this.tier) {
case 1: case 1:
this.setEnergyUsed(AlchemicalWizardry.energyBazookaLPPerShot); this.setEnergyUsed(AlchemicalWizardry.energyBazookaLPPerShot);
@@ -68,134 +45,61 @@ public class EnergyBazooka extends EnergyItems {
} }
@Override @Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { public void shoot(World par2World, EntityPlayer par3EntityPlayer) {
if (stack.getTagCompound() == null) { par2World.spawnEntityInWorld(new EntityEnergyBazookaMainProjectile(par2World, par3EntityPlayer, this.damage));
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.getTagCompound();
if (tag.getBoolean("isActive")) {
switch (this.tier) {
case 1:
return this.activeIcon;
case 2:
return this.activeIconTier2;
case 3:
return this.activeIconTier3;
}
return this.activeIcon;
} else {
return this.passiveIcon;
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
int maxDelay = 1;
int maxDelayAfterActivation = 1;
switch (this.tier) {
case 1:
maxDelay = AlchemicalWizardry.energyBazookaMaxDelay;
maxDelayAfterActivation = AlchemicalWizardry.energyBazookaMaxDelayAfterActivation + 1;
break;
case 2:
maxDelay = AlchemicalWizardry.energyBazookaSecondTierMaxDelay;
maxDelayAfterActivation = AlchemicalWizardry.energyBazookaSecondTierMaxDelayAfterActivation + 1;
break;
case 3:
maxDelay = AlchemicalWizardry.energyBazookaThirdTierMaxDelay;
maxDelayAfterActivation = AlchemicalWizardry.energyBazookaThirdTierMaxDelayAfterActivation + 1;
break;
}
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
this.setActivated(par1ItemStack, !getActivated(par1ItemStack));
par1ItemStack.getTagCompound()
.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % maxDelayAfterActivation);
return par1ItemStack;
}
if (!getActivated(par1ItemStack)) {
return par1ItemStack;
}
if (this.getDelay(par1ItemStack) > 0) {
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode) {
if (!syphonBatteries(par1ItemStack, par3EntityPlayer, this.getEnergyUsed())) {
return par1ItemStack;
}
}
par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!par2World.isRemote) {
par2World.spawnEntityInWorld(
new EntityEnergyBazookaMainProjectile(par2World, par3EntityPlayer, this.damage));
this.setDelay(par1ItemStack, maxDelay);
}
Vec3 vec = par3EntityPlayer.getLookVec(); Vec3 vec = par3EntityPlayer.getLookVec();
double wantedVelocity = (double) this.tier * 2.0D; double wantedVelocity = this.tier * 2.0D;
par3EntityPlayer.motionX = -vec.xCoord * wantedVelocity; par3EntityPlayer.motionX = -vec.xCoord * wantedVelocity;
par3EntityPlayer.motionY = -vec.yCoord * wantedVelocity; par3EntityPlayer.motionY = -vec.yCoord * wantedVelocity;
par3EntityPlayer.motionZ = -vec.zCoord * wantedVelocity; par3EntityPlayer.motionZ = -vec.zCoord * wantedVelocity;
par2World.playSoundEffect( par2World.playSoundEffect(
(double) ((float) par3EntityPlayer.posX + 0.5F), par3EntityPlayer.posX + 0.5F,
(double) ((float) par3EntityPlayer.posY + 0.5F), par3EntityPlayer.posY + 0.5F,
(double) ((float) par3EntityPlayer.posZ + 0.5F), par3EntityPlayer.posZ + 0.5F,
"random.fizz", "random.fizz",
0.5F, 0.5F,
2.6F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.8F); 2.6F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.8F);
par3EntityPlayer.fallDistance = 0; par3EntityPlayer.fallDistance = 0;
return par1ItemStack;
} }
@Override @Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { public int getShotDelay() {
if (!(par3Entity instanceof EntityPlayer)) {
return;
}
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
if (par1ItemStack.getTagCompound() == null) {
par1ItemStack.setTagCompound(new NBTTagCompound());
}
int delay = this.getDelay(par1ItemStack);
if (!par2World.isRemote && delay > 0) {
this.setDelay(par1ItemStack, delay - 1);
}
int lpPerActivation = 0;
int maxDelayAfterActivation = 1;
switch (this.tier) { switch (this.tier) {
case 1: case 1:
lpPerActivation = AlchemicalWizardry.energyBazookaLPPerActivation; return AlchemicalWizardry.energyBazookaMaxDelay;
maxDelayAfterActivation = AlchemicalWizardry.energyBazookaMaxDelayAfterActivation + 1;
break;
case 2: case 2:
lpPerActivation = AlchemicalWizardry.energyBazookaSecondTierLPPerActivation; return AlchemicalWizardry.energyBazookaSecondTierMaxDelay;
maxDelayAfterActivation = AlchemicalWizardry.energyBazookaSecondTierMaxDelayAfterActivation + 1;
break;
case 3: case 3:
lpPerActivation = AlchemicalWizardry.energyBazookaThirdTierLPPerActivation; return AlchemicalWizardry.energyBazookaThirdTierMaxDelay;
maxDelayAfterActivation = AlchemicalWizardry.energyBazookaThirdTierMaxDelayAfterActivation + 1;
break;
}
if (par2World.getWorldTime() % maxDelayAfterActivation
== par1ItemStack.getTagCompound().getInteger("worldTimeDelay")
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
if (!par3EntityPlayer.capabilities.isCreativeMode) {
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, lpPerActivation)) {
this.setActivated(par1ItemStack, false);
}
}
} }
return 1;
}
par1ItemStack.setItemDamage(0); @Override
public int drainTicks() {
switch (this.tier) {
case 1:
return AlchemicalWizardry.energyBazookaMaxDelayAfterActivation;
case 2:
return AlchemicalWizardry.energyBazookaSecondTierMaxDelayAfterActivation;
case 3:
return AlchemicalWizardry.energyBazookaThirdTierMaxDelayAfterActivation;
}
return 1;
}
@Override
public int drainCost() {
switch (this.tier) {
case 1:
return AlchemicalWizardry.energyBazookaLPPerActivation;
case 2:
return AlchemicalWizardry.energyBazookaSecondTierLPPerActivation;
case 3:
return AlchemicalWizardry.energyBazookaThirdTierLPPerActivation;
}
return 0;
} }
@Override @Override
@@ -204,45 +108,6 @@ public class EnergyBazooka extends EnergyItems {
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.energybazooka.desc")); par3List.add(StatCollector.translateToLocal("tooltip.energybazooka.desc"));
par3List.add(StatCollector.translateToLocal("tooltip.alchemy.damage") + " " + this.damage); par3List.add(StatCollector.translateToLocal("tooltip.alchemy.damage") + " " + this.damage);
if (!(par1ItemStack.getTagCompound() == null)) { addBindingInformation(par1ItemStack, par3List);
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
} else {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
}
if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) {
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
}
}
public void setActivated(ItemStack par1ItemStack, boolean newActivated) {
if (par1ItemStack.getTagCompound() == null) {
par1ItemStack.setTagCompound(new NBTTagCompound());
}
par1ItemStack.getTagCompound().setBoolean("isActive", newActivated);
}
public boolean getActivated(ItemStack par1ItemStack) {
if (par1ItemStack.getTagCompound() == null) {
par1ItemStack.setTagCompound(new NBTTagCompound());
}
return par1ItemStack.getTagCompound().getBoolean("isActive");
}
public void setDelay(ItemStack par1ItemStack, int newDelay) {
if (par1ItemStack.getTagCompound() == null) {
par1ItemStack.setTagCompound(new NBTTagCompound());
}
par1ItemStack.getTagCompound().setInteger("delay", newDelay);
}
public int getDelay(ItemStack par1ItemStack) {
if (par1ItemStack.getTagCompound() == null) {
par1ItemStack.setTagCompound(new NBTTagCompound());
}
return par1ItemStack.getTagCompound().getInteger("delay");
} }
} }
@@ -6,12 +6,12 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile; import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -19,19 +19,19 @@ import cpw.mods.fml.relauncher.SideOnly;
public class EnergyBlast extends EnergyItems { public class EnergyBlast extends EnergyItems {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon activeIcon; public IIcon activeIcon;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon activeIconTier2; public IIcon activeIconTier2;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon activeIconTier3; public IIcon activeIconTier3;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon passiveIcon; public IIcon passiveIcon;
private int tier; public int tier;
private int damage; public int damage;
public EnergyBlast(int tier) { public EnergyBlast(int tier) {
super(); super();
@@ -70,13 +70,7 @@ public class EnergyBlast extends EnergyItems {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
if (stack.getTagCompound() == null) { if (IBindable.isActive(stack)) {
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.getTagCompound();
if (tag.getBoolean("isActive")) {
switch (this.tier) { switch (this.tier) {
case 1: case 1:
return this.activeIcon; return this.activeIcon;
@@ -93,53 +87,29 @@ public class EnergyBlast extends EnergyItems {
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
int maxDelay = 1; if (getDelay(par1ItemStack) > 0 && IBindable.isActive(par1ItemStack) && !par3EntityPlayer.isSneaking()) {
int maxDelayAfterActivation = 1;
switch (this.tier) {
case 1:
maxDelay = AlchemicalWizardry.energyBlastMaxDelay;
maxDelayAfterActivation = AlchemicalWizardry.energyBlastMaxDelayAfterActivation + 1;
break;
case 2:
maxDelay = AlchemicalWizardry.energyBlastSecondTierMaxDelay;
maxDelayAfterActivation = AlchemicalWizardry.energyBlastSecondTierMaxDelayAfterActivation + 1;
break;
case 3:
maxDelay = AlchemicalWizardry.energyBlastThirdTierMaxDelay;
maxDelayAfterActivation = AlchemicalWizardry.energyBlastThirdTierMaxDelayAfterActivation + 1;
break;
}
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
this.setActivated(par1ItemStack, !getActivated(par1ItemStack));
par1ItemStack.getTagCompound()
.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % maxDelayAfterActivation);
return par1ItemStack; return par1ItemStack;
} }
if (!getActivated(par1ItemStack)) { if (checkRightClick(par1ItemStack, par2World, par3EntityPlayer)) {
setDelay(par1ItemStack, drainTicks());
return par1ItemStack; return par1ItemStack;
} }
if (this.getDelay(par1ItemStack) > 0) {
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode) {
if (!syphonBatteries(par1ItemStack, par3EntityPlayer, this.getEnergyUsed())) {
return par1ItemStack;
}
}
par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!par2World.isRemote) { if (!par2World.isRemote) {
par2World.spawnEntityInWorld(new EnergyBlastProjectile(par2World, par3EntityPlayer, this.damage)); shoot(par2World, par3EntityPlayer);
this.setDelay(par1ItemStack, maxDelay); this.setDelay(par1ItemStack, getShotDelay());
} }
return par1ItemStack; return par1ItemStack;
} }
public void shoot(World par2World, EntityPlayer par3EntityPlayer) {
par2World.spawnEntityInWorld(new EnergyBlastProjectile(par2World, par3EntityPlayer, this.damage));
}
@Override @Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) {
if (!(par3Entity instanceof EntityPlayer)) { if (!(par3Entity instanceof EntityPlayer)) {
@@ -147,43 +117,66 @@ public class EnergyBlast extends EnergyItems {
} }
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity; EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
if (par1ItemStack.getTagCompound() == null) {
par1ItemStack.setTagCompound(new NBTTagCompound());
}
int delay = this.getDelay(par1ItemStack); int delay = this.getDelay(par1ItemStack);
if (!par2World.isRemote && delay > 0) { if (!par2World.isRemote && delay > 0) {
this.setDelay(par1ItemStack, delay - 1); this.setDelay(par1ItemStack, delay - 1);
} }
int lpPerActivation = 0;
int maxDelayAfterActivation = 1; checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
switch (this.tier) {
case 1:
lpPerActivation = AlchemicalWizardry.energyBlastLPPerActivation;
maxDelayAfterActivation = AlchemicalWizardry.energyBlastMaxDelayAfterActivation + 1;
break;
case 2:
lpPerActivation = AlchemicalWizardry.energyBlastSecondTierLPPerActivation;
maxDelayAfterActivation = AlchemicalWizardry.energyBlastSecondTierMaxDelayAfterActivation + 1;
break;
case 3:
lpPerActivation = AlchemicalWizardry.energyBlastThirdTierLPPerActivation;
maxDelayAfterActivation = AlchemicalWizardry.energyBlastThirdTierMaxDelayAfterActivation + 1;
break;
}
if (par2World.getWorldTime() % maxDelayAfterActivation
== par1ItemStack.getTagCompound().getInteger("worldTimeDelay")
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
if (!par3EntityPlayer.capabilities.isCreativeMode) {
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, lpPerActivation)) {
this.setActivated(par1ItemStack, false);
}
}
}
par1ItemStack.setItemDamage(0); par1ItemStack.setItemDamage(0);
} }
/**
* The delay between firing multiple shots.
*/
public int getShotDelay() {
switch (this.tier) {
case 1:
return AlchemicalWizardry.energyBlastMaxDelay;
case 2:
return AlchemicalWizardry.energyBlastSecondTierMaxDelay;
case 3:
return AlchemicalWizardry.energyBlastThirdTierMaxDelay;
}
return 1;
}
/**
* Used for the warmup delay as well as for passive draining.
*/
@Override
public int drainTicks() {
switch (this.tier) {
case 1:
return AlchemicalWizardry.energyBlastMaxDelayAfterActivation;
case 2:
return AlchemicalWizardry.energyBlastSecondTierMaxDelayAfterActivation;
case 3:
return AlchemicalWizardry.energyBlastThirdTierMaxDelayAfterActivation;
}
return 1;
}
@Override
public int drainCost() {
switch (this.tier) {
case 1:
return AlchemicalWizardry.energyBlastLPPerActivation;
case 2:
return AlchemicalWizardry.energyBlastSecondTierLPPerActivation;
case 3:
return AlchemicalWizardry.energyBlastThirdTierLPPerActivation;
}
return 0;
}
@Override
public int rightClickCost() {
return getEnergyUsed();
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@SuppressWarnings({ "unchecked", "rawtypes" }) @SuppressWarnings({ "unchecked", "rawtypes" })
@@ -191,45 +184,14 @@ public class EnergyBlast extends EnergyItems {
par3List.add(StatCollector.translateToLocal("tooltip.energyblast.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.energyblast.desc1"));
par3List.add(StatCollector.translateToLocal("tooltip.energyblast.desc2")); par3List.add(StatCollector.translateToLocal("tooltip.energyblast.desc2"));
par3List.add(StatCollector.translateToLocal("tooltip.alchemy.damage") + " " + this.damage); par3List.add(StatCollector.translateToLocal("tooltip.alchemy.damage") + " " + this.damage);
if (!(par1ItemStack.getTagCompound() == null)) { addBindingInformation(par1ItemStack, par3List);
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
} else {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
}
if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) {
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
}
} }
public void setActivated(ItemStack par1ItemStack, boolean newActivated) { public void setDelay(ItemStack par1ItemStack, int delay) {
if (par1ItemStack.getTagCompound() == null) { IBindable.getTag(par1ItemStack).setInteger("delay", delay);
par1ItemStack.setTagCompound(new NBTTagCompound());
}
par1ItemStack.getTagCompound().setBoolean("isActive", newActivated);
}
public boolean getActivated(ItemStack par1ItemStack) {
if (par1ItemStack.getTagCompound() == null) {
par1ItemStack.setTagCompound(new NBTTagCompound());
}
return par1ItemStack.getTagCompound().getBoolean("isActive");
}
public void setDelay(ItemStack par1ItemStack, int newDelay) {
if (par1ItemStack.getTagCompound() == null) {
par1ItemStack.setTagCompound(new NBTTagCompound());
}
par1ItemStack.getTagCompound().setInteger("delay", newDelay);
} }
public int getDelay(ItemStack par1ItemStack) { public int getDelay(ItemStack par1ItemStack) {
if (par1ItemStack.getTagCompound() == null) { return IBindable.getTag(par1ItemStack).getInteger("delay");
par1ItemStack.setTagCompound(new NBTTagCompound());
}
return par1ItemStack.getTagCompound().getInteger("delay");
} }
} }
@@ -3,7 +3,6 @@ package WayofTime.alchemicalWizardry.common.items;
import net.minecraft.entity.player.EntityPlayer; 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.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.world.World; import net.minecraft.world.World;
@@ -23,11 +22,16 @@ public class EnergyItems extends Item implements IBindable {
setCreativeTab(AlchemicalWizardry.tabBloodMagic); setCreativeTab(AlchemicalWizardry.tabBloodMagic);
} }
protected void setEnergyUsed(int par1int) { public void setEnergyUsed(int par1int) {
this.energyUsed = par1int; this.energyUsed = par1int;
} }
protected int getEnergyUsed() { public int getEnergyUsed() {
return this.energyUsed;
}
@Override
public int drainCost() {
return this.energyUsed; return this.energyUsed;
} }
@@ -90,9 +94,9 @@ public class EnergyItems extends Item implements IBindable {
posY, posY,
posZ); posZ);
world.playSoundEffect( world.playSoundEffect(
(double) ((float) player.posX + 0.5F), ((float) player.posX + 0.5F),
(double) ((float) player.posY + 0.5F), ((float) player.posY + 0.5F),
(double) ((float) player.posZ + 0.5F), ((float) player.posZ + 0.5F),
"random.fizz", "random.fizz",
0.5F, 0.5F,
2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F); 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
@@ -181,35 +185,28 @@ public class EnergyItems extends Item implements IBindable {
return true; return true;
} }
// Global static methods // Used by some addon mods like Blood Arsenal
@Deprecated
public static boolean checkAndSetItemOwner(ItemStack item, EntityPlayer player) { public static boolean checkAndSetItemOwner(ItemStack item, EntityPlayer player) {
return !SpellHelper.isFakePlayer(player) && SoulNetworkHandler.checkAndSetItemPlayer(item, player); return IBindable.checkAndSetItemOwner(item, player);
} }
// Used by some addon mods like Blood Arsenal
@Deprecated
public static void setItemOwner(ItemStack item, String ownerName) { public static void setItemOwner(ItemStack item, String ownerName) {
if (item.getTagCompound() == null) { IBindable.setItemOwner(item, ownerName);
item.setTagCompound(new NBTTagCompound());
}
item.getTagCompound().setString("ownerName", ownerName);
} }
// Used by some addon mods like Blood Arsenal
@Deprecated
public static void checkAndSetItemOwner(ItemStack item, String ownerName) { public static void checkAndSetItemOwner(ItemStack item, String ownerName) {
if (item.getTagCompound() == null) { IBindable.checkAndSetItemOwner(item, ownerName);
item.setTagCompound(new NBTTagCompound());
}
if (item.getTagCompound().getString("ownerName").equals("")) {
item.getTagCompound().setString("ownerName", ownerName);
}
} }
// Used by some addon mods like Blood Arsenal
@Deprecated
public static String getOwnerName(ItemStack item) { public static String getOwnerName(ItemStack item) {
if (item.getTagCompound() == null) { return IBindable.getOwnerName(item);
item.setTagCompound(new NBTTagCompound());
}
return item.getTagCompound().getString("ownerName");
} }
@Deprecated @Deprecated
@@ -19,12 +19,13 @@ import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm; import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm;
import WayofTime.alchemicalWizardry.common.omega.OmegaRegistry; import WayofTime.alchemicalWizardry.common.omega.OmegaRegistry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
public class EnergySword extends ItemSword { public class EnergySword extends ItemSword implements IBindable {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon activeIcon; private IIcon activeIcon;
@@ -51,6 +52,11 @@ public class EnergySword extends ItemSword {
return this.energyUsed; return this.energyUsed;
} }
@Override
public int drainCost() {
return this.energyUsed;
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister) { public void registerIcons(IIconRegister iconRegister) {
@@ -61,13 +67,7 @@ public class EnergySword extends ItemSword {
@Override @Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
if (stack.getTagCompound() == null) { if (IBindable.isActive(stack)) {
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.getTagCompound();
if (tag.getBoolean("isActive")) {
return this.activeIcon; return this.activeIcon;
} else { } else {
return this.passiveIcon; return this.passiveIcon;
@@ -80,7 +80,7 @@ public class EnergySword extends ItemSword {
@Override @Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
boolean isActive = getActivated(stack); boolean isActive = IBindable.isActive(stack);
if (isActive && !player.worldObj.isRemote) { if (isActive && !player.worldObj.isRemote) {
OmegaParadigm parad = this.getOmegaParadigmOfWeilder(player); OmegaParadigm parad = this.getOmegaParadigmOfWeilder(player);
@@ -97,8 +97,8 @@ public class EnergySword extends ItemSword {
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase,
EntityLivingBase par3EntityLivingBase) { EntityLivingBase par3EntityLivingBase) {
if (par3EntityLivingBase instanceof EntityPlayer) { if (par3EntityLivingBase instanceof EntityPlayer) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, (EntityPlayer) par3EntityLivingBase) || !EnergyItems if (!IBindable.checkAndSetItemOwner(par1ItemStack, (EntityPlayer) par3EntityLivingBase) || !EnergyItems
.syphonBatteries(par1ItemStack, (EntityPlayer) par3EntityLivingBase, this.getEnergyUsed())) { .syphonBatteries(par1ItemStack, (EntityPlayer) par3EntityLivingBase, this.drainCost())) {
return false; return false;
} }
} }
@@ -110,15 +110,8 @@ public class EnergySword extends ItemSword {
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer); super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer);
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
this.setActivated(par1ItemStack, !getActivated(par1ItemStack));
par1ItemStack.getTagCompound().setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 100);
return par1ItemStack;
}
if (!getActivated(par1ItemStack)) { this.toggle(par1ItemStack, par2World, par3EntityPlayer);
return par1ItemStack;
}
return par1ItemStack; return par1ItemStack;
} }
@@ -140,38 +133,11 @@ public class EnergySword extends ItemSword {
par1ItemStack.setTagCompound(new NBTTagCompound()); par1ItemStack.setTagCompound(new NBTTagCompound());
} }
if (par2World.getWorldTime() % 100 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
if (!par3EntityPlayer.capabilities.isCreativeMode) {
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, 50)) {
this.setActivated(par1ItemStack, false);
}
}
}
par1ItemStack.setItemDamage(0); par1ItemStack.setItemDamage(0);
} }
public void setActivated(ItemStack par1ItemStack, boolean newActivated) {
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
if (itemTag == null) {
par1ItemStack.setTagCompound(new NBTTagCompound());
}
itemTag.setBoolean("isActive", newActivated);
}
public boolean getActivated(ItemStack par1ItemStack) {
NBTTagCompound itemTag = par1ItemStack.getTagCompound();
if (itemTag == null) {
par1ItemStack.setTagCompound(new NBTTagCompound());
}
return itemTag.getBoolean("isActive");
}
public float func_82803_g() { public float func_82803_g() {
return 4.0F; return 4.0F;
} }
@@ -180,20 +146,7 @@ public class EnergySword extends ItemSword {
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.caution.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.caution.desc1"));
par3List.add(StatCollector.translateToLocal("tooltip.caution.desc2")); par3List.add(StatCollector.translateToLocal("tooltip.caution.desc2"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
} else {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
}
if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) {
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
}
} }
@Override @Override
@@ -8,6 +8,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -26,25 +27,16 @@ public class EnhancedTelepositionFocus extends TelepositionFocus {
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.enhancedtelepfocus.desc")); par3List.add(StatCollector.translateToLocal("tooltip.enhancedtelepfocus.desc"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) { NBTTagCompound itemTag = IBindable.getTag(par1ItemStack);
NBTTagCompound itemTag = par1ItemStack.getTagCompound(); par3List.add(
StatCollector.translateToLocal("tooltip.alchemy.coords") + " "
if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) { + itemTag.getInteger("xCoord")
par3List.add( + ", "
StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + itemTag.getInteger("yCoord")
+ par1ItemStack.getTagCompound().getString("ownerName")); + ", "
} + itemTag.getInteger("zCoord"));
par3List.add(StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + getDimensionID(par1ItemStack));
par3List.add(
StatCollector.translateToLocal("tooltip.alchemy.coords") + " "
+ itemTag.getInteger("xCoord")
+ ", "
+ itemTag.getInteger("yCoord")
+ ", "
+ itemTag.getInteger("zCoord"));
par3List.add(
StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + getDimensionID(par1ItemStack));
}
} }
} }
@@ -129,7 +129,7 @@ public class ItemBloodLetterPack extends ItemArmor implements ArmourUpgrade, IAl
return; return;
} }
if (world.getWorldTime() % tickRate == 0) { if (world.getTotalWorldTime() % tickRate == 0) {
boolean shouldExecute = player.getHealth() / player.getMaxHealth() > activationPoint boolean shouldExecute = player.getHealth() / player.getMaxHealth() > activationPoint
&& this.getStoredLP(itemStack) < maxStored; && this.getStoredLP(itemStack) < maxStored;
@@ -41,6 +41,10 @@ public class ItemBloodRuneBlock extends ItemBlock {
name = "acceleration"; name = "acceleration";
break; break;
case 6:
name = "quickness";
break;
default: default:
name = "broken"; name = "broken";
} }
@@ -12,6 +12,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.DimensionManager;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellParadigmBlock; import WayofTime.alchemicalWizardry.common.tileEntity.TESpellParadigmBlock;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -33,16 +34,11 @@ public class ItemComplexSpellCrystal extends EnergyItems {
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.complexspellcrystal.desc")); par3List.add(StatCollector.translateToLocal("tooltip.complexspellcrystal.desc"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) { if (!(par1ItemStack.getTagCompound() == null)) {
NBTTagCompound itemTag = par1ItemStack.getTagCompound(); NBTTagCompound itemTag = par1ItemStack.getTagCompound();
if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) {
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
par3List.add( par3List.add(
StatCollector.translateToLocal("tooltip.alchemy.coords") + " " StatCollector.translateToLocal("tooltip.alchemy.coords") + " "
+ itemTag.getInteger("xCoord") + itemTag.getInteger("xCoord")
@@ -57,7 +53,7 @@ public class ItemComplexSpellCrystal extends EnergyItems {
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
return par1ItemStack; return par1ItemStack;
} }
@@ -38,16 +38,12 @@ public class ItemDiabloKey extends EnergyItems {
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.diablokey.desc")); par3List.add(StatCollector.translateToLocal("tooltip.diablokey.desc"));
if (!(par1ItemStack.getTagCompound() == null)) { addBindingInformation(par1ItemStack, par3List);
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
World world = par3EntityPlayer.worldObj; World world = par3EntityPlayer.worldObj;
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)
|| par3EntityPlayer instanceof FakePlayer) { || par3EntityPlayer instanceof FakePlayer) {
return par1ItemStack; return par1ItemStack;
} }
@@ -105,7 +101,7 @@ public class ItemDiabloKey extends EnergyItems {
} }
if (item instanceof IBindable) { if (item instanceof IBindable) {
EnergyItems.checkAndSetItemOwner(itemStack, ownerName); IBindable.checkAndSetItemOwner(itemStack, ownerName);
} }
} }
par3EntityPlayer.inventoryContainer.detectAndSendChanges(); par3EntityPlayer.inventoryContainer.detectAndSendChanges();
@@ -118,7 +114,7 @@ public class ItemDiabloKey extends EnergyItems {
public void getSubItems(Item id, CreativeTabs creativeTab, List list) { public void getSubItems(Item id, CreativeTabs creativeTab, List list) {
list.add(new ItemStack(ModItems.itemKeyOfDiablo)); list.add(new ItemStack(ModItems.itemKeyOfDiablo));
ItemStack boundKey = new ItemStack(ModItems.itemKeyOfDiablo); ItemStack boundKey = new ItemStack(ModItems.itemKeyOfDiablo);
EnergyItems.checkAndSetItemOwner(boundKey, "Server-wide Soul Network"); IBindable.checkAndSetItemOwner(boundKey, "Server-wide Soul Network");
list.add(boundKey); list.add(boundKey);
} }
} }
@@ -142,6 +142,9 @@ public class ItemIncense extends Item implements IIncense {
ItemStack quartzStack = new ItemStack(Items.quartz, 1, WILDCARD); ItemStack quartzStack = new ItemStack(Items.quartz, 1, WILDCARD);
ItemStack blazePowderStack = new ItemStack(Items.blaze_powder); ItemStack blazePowderStack = new ItemStack(Items.blaze_powder);
ItemStack netherwartStack = new ItemStack(Items.nether_wart); ItemStack netherwartStack = new ItemStack(Items.nether_wart);
ItemStack blankSlateStack = new ItemStack(ModItems.blankSlate);
ItemStack reinforcedSlateStack = new ItemStack(ModItems.reinforcedSlate);
ItemStack fracturedBoneStack = new ItemStack(ModItems.baseAlchemyItems, 1, 5); ItemStack fracturedBoneStack = new ItemStack(ModItems.baseAlchemyItems, 1, 5);
ItemStack woodashStack = new ItemStack(ModItems.itemIncense, 1, 0); ItemStack woodashStack = new ItemStack(ModItems.itemIncense, 1, 0);
@@ -156,7 +159,7 @@ public class ItemIncense extends Item implements IIncense {
new ItemStack(Items.redstone), new ItemStack(Items.redstone),
leavesStack, leavesStack,
leavesStack, leavesStack,
new ItemStack(ModItems.apprenticeBloodOrb))); new ItemStack(ModItems.weakBloodOrb)));
GameRegistry.addRecipe( GameRegistry.addRecipe(
new ShapelessBloodOrbRecipe( new ShapelessBloodOrbRecipe(
new ItemStack(ModItems.itemIncense, 1, 2), new ItemStack(ModItems.itemIncense, 1, 2),
@@ -168,7 +171,7 @@ public class ItemIncense extends Item implements IIncense {
glowstoneStack, glowstoneStack,
stringStack, stringStack,
stringStack, stringStack,
new ItemStack(ModItems.magicianBloodOrb))); new ItemStack(ModItems.apprenticeBloodOrb)));
GameRegistry.addRecipe( GameRegistry.addRecipe(
new ShapelessBloodOrbRecipe( new ShapelessBloodOrbRecipe(
new ItemStack(ModItems.itemIncense, 1, 3), new ItemStack(ModItems.itemIncense, 1, 3),
@@ -178,7 +181,8 @@ public class ItemIncense extends Item implements IIncense {
soulSandStack, soulSandStack,
gunpowderStack, gunpowderStack,
fermentedEyeStack, fermentedEyeStack,
new ItemStack(ModItems.masterBloodOrb))); blankSlateStack,
new ItemStack(ModItems.apprenticeBloodOrb)));
GameRegistry.addRecipe( GameRegistry.addRecipe(
new ShapelessBloodOrbRecipe( new ShapelessBloodOrbRecipe(
new ItemStack(ModItems.itemIncense, 1, 4), new ItemStack(ModItems.itemIncense, 1, 4),
@@ -189,17 +193,17 @@ public class ItemIncense extends Item implements IIncense {
netherwartStack, netherwartStack,
blazePowderStack, blazePowderStack,
fracturedBoneStack, fracturedBoneStack,
goldNuggetStack, reinforcedSlateStack,
new ItemStack(ModItems.archmageBloodOrb))); new ItemStack(ModItems.magicianBloodOrb)));
} }
public enum EnumIncense { public enum EnumIncense {
WOODASH(0, 200, 1.0f, 1000, 0.937f, 0.898f, 0.820f), WOODASH(0, 400, 1.0f, 2000, 0.937f, 0.898f, 0.820f),
RED(200, 600, 1.5f, 1000, 1.0f, 0, 0), RED(400, 800, 1.5f, 2000, 1.0f, 0, 0),
BLUE(600, 1200, 3.0f, 1000, 0, 0, 1.0f), BLUE(800, 1500, 3.0f, 2000, 0, 0, 1.0f),
GREEN(1200, 2000, 4.0f, 1000, 0, 1.0f, 0), GREEN(1500, 2400, 4.0f, 2000, 0, 1.0f, 0),
PURPLE(2000, 3000, 5.0f, 1000, 1.0f, 0, 1.0f); PURPLE(2400, 3500, 5.0f, 2000, 1.0f, 0, 1.0f);
public final int minValue; public final int minValue;
public final int maxValue; public final int maxValue;
@@ -12,6 +12,7 @@ import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks; import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.Rituals; import WayofTime.alchemicalWizardry.api.rituals.Rituals;
import WayofTime.alchemicalWizardry.common.block.RitualStone; import WayofTime.alchemicalWizardry.common.block.RitualStone;
@@ -36,15 +37,13 @@ public class ItemRitualDismantler extends EnergyItems {
@Override @Override
public void addInformation(ItemStack stack, EntityPlayer player, List par3List, boolean x) { public void addInformation(ItemStack stack, EntityPlayer player, List par3List, boolean x) {
par3List.add(StatCollector.translateToLocal("tooltip.dismatler.desc")); par3List.add(StatCollector.translateToLocal("tooltip.dismatler.desc"));
if (stack.hasTagCompound()) par3List.add( addBindingInformation(stack, par3List);
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ stack.getTagCompound().getString("ownerName"));
} }
@Override @Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7,
float par8, float par9, float par10) { float par8, float par9, float par10) {
return EnergyItems.checkAndSetItemOwner(stack, player) return IBindable.checkAndSetItemOwner(stack, player)
&& breakRitualStoneAtMasterStone(stack, player, world, x, y, z); && breakRitualStoneAtMasterStone(stack, player, world, x, y, z);
} }
@@ -23,6 +23,7 @@ import org.lwjgl.input.Keyboard;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks; import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.api.Int3; import WayofTime.alchemicalWizardry.api.Int3;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.IRitualDiviner; import WayofTime.alchemicalWizardry.api.items.interfaces.IRitualDiviner;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.IRitualStone; import WayofTime.alchemicalWizardry.api.rituals.IRitualStone;
@@ -74,9 +75,7 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner {
if (!(stack.getTagCompound() == null)) { if (!(stack.getTagCompound() == null)) {
String ritualID = this.getCurrentRitual(stack); String ritualID = this.getCurrentRitual(stack);
// TODO // TODO
par3List.add( addBindingInformation(stack, par3List);
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ stack.getTagCompound().getString("ownerName"));
par3List.add(StatCollector.translateToLocal("tooltip.alchemy.ritualid") + " " + ritualID); par3List.add(StatCollector.translateToLocal("tooltip.alchemy.ritualid") + " " + ritualID);
List<RitualComponent> ritualList = Rituals.getRitualList(this.getCurrentRitual(stack)); List<RitualComponent> ritualList = Rituals.getRitualList(this.getCurrentRitual(stack));
if (ritualList == null) { if (ritualList == null) {
@@ -191,7 +190,7 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner {
@Override @Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7,
float par8, float par9, float par10) { float par8, float par9, float par10) {
if (!EnergyItems.checkAndSetItemOwner(stack, player)) return false; if (!IBindable.checkAndSetItemOwner(stack, player)) return false;
if (placeRitualStoneAtMasterStone(stack, player, world, x, y, z)) { if (placeRitualStoneAtMasterStone(stack, player, world, x, y, z)) {
this.setStoredLocation(stack, new Int3(x, y, z)); this.setStoredLocation(stack, new Int3(x, y, z));
@@ -304,7 +303,7 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner {
@Override @Override
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) { public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) {
if (entity instanceof EntityPlayer && hasStoredLocation(stack) && world.getWorldTime() % 5 == 0) { if (entity instanceof EntityPlayer && hasStoredLocation(stack) && world.getTotalWorldTime() % 5 == 0) {
Int3 loc = getStoredLocation(stack); Int3 loc = getStoredLocation(stack);
int x = loc.xCoord; int x = loc.xCoord;
@@ -369,7 +368,7 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner {
@Override @Override
public ItemStack onItemRightClick(ItemStack stack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack stack, World par2World, EntityPlayer par3EntityPlayer) {
if (EnergyItems.checkAndSetItemOwner(stack, par3EntityPlayer) && par3EntityPlayer.isSneaking()) { if (IBindable.checkAndSetItemOwner(stack, par3EntityPlayer) && par3EntityPlayer.isSneaking()) {
rotateRituals(par2World, par3EntityPlayer, stack, true); rotateRituals(par2World, par3EntityPlayer, stack, true);
} }
@@ -381,7 +380,7 @@ public class ItemRitualDiviner extends EnergyItems implements IRitualDiviner {
if (entityLiving instanceof EntityPlayer) { if (entityLiving instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entityLiving; EntityPlayer player = (EntityPlayer) entityLiving;
if (!EnergyItems.checkAndSetItemOwner(stack, player)) return true; if (!IBindable.checkAndSetItemOwner(stack, player)) return true;
if (!player.isSwingInProgress) { if (!player.isSwingInProgress) {
if (player.isSneaking()) { if (player.isSneaking()) {
@@ -5,14 +5,15 @@ import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldProvider; import net.minecraft.world.WorldProvider;
import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.DimensionManager;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork; import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -52,7 +53,7 @@ public class LavaCrystal extends EnergyItems {
} }
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
return par1ItemStack; return par1ItemStack;
} }
@@ -60,19 +61,14 @@ public class LavaCrystal extends EnergyItems {
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.lavacrystal.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.lavacrystal.desc1"));
par3List.add(StatCollector.translateToLocal("tooltip.lavacrystal.desc2")); par3List.add(StatCollector.translateToLocal("tooltip.lavacrystal.desc2"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
public boolean hasEnoughEssence(ItemStack itemStack) { public boolean hasEnoughEssence(ItemStack itemStack) {
if (itemStack.getTagCompound() != null && !(itemStack.getTagCompound().getString("ownerName").equals(""))) { if (itemStack.getTagCompound() != null && !(itemStack.getTagCompound().getString("ownerName").equals(""))) {
String ownerName = itemStack.getTagCompound().getString("ownerName"); String ownerName = itemStack.getTagCompound().getString("ownerName");
if (MinecraftServer.getServer() == null) { if (FMLCommonHandler.instance().getMinecraftServerInstance() == null) {
return false; return false;
} }
@@ -8,6 +8,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -27,25 +28,16 @@ public class ReinforcedTelepositionFocus extends TelepositionFocus {
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.reinforcedtelepfocus.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.reinforcedtelepfocus.desc1"));
par3List.add(StatCollector.translateToLocal("tooltip.reinforcedtelepfocus.desc2")); par3List.add(StatCollector.translateToLocal("tooltip.reinforcedtelepfocus.desc2"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) { NBTTagCompound itemTag = IBindable.getTag(par1ItemStack);
NBTTagCompound itemTag = par1ItemStack.getTagCompound(); par3List.add(
StatCollector.translateToLocal("tooltip.alchemy.coords") + " "
if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) { + itemTag.getInteger("xCoord")
par3List.add( + ", "
StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + itemTag.getInteger("yCoord")
+ par1ItemStack.getTagCompound().getString("ownerName")); + ", "
} + itemTag.getInteger("zCoord"));
par3List.add(StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + getDimensionID(par1ItemStack));
par3List.add(
StatCollector.translateToLocal("tooltip.alchemy.coords") + " "
+ itemTag.getInteger("xCoord")
+ ", "
+ itemTag.getInteger("yCoord")
+ ", "
+ itemTag.getInteger("zCoord"));
par3List.add(
StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + getDimensionID(par1ItemStack));
}
} }
} }
@@ -8,6 +8,7 @@ import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
public class ScribeTool extends EnergyItems { public class ScribeTool extends EnergyItems {
@@ -25,17 +26,12 @@ public class ScribeTool extends EnergyItems {
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.scribetool.desc")); par3List.add(StatCollector.translateToLocal("tooltip.scribetool.desc"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) { if (IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) {
if (par1ItemStack.getItemDamage() > 0) { if (par1ItemStack.getItemDamage() > 0) {
par1ItemStack.setItemDamage(par1ItemStack.getItemDamage() - 1); par1ItemStack.setItemDamage(par1ItemStack.getItemDamage() - 1);
} }
@@ -8,9 +8,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -34,31 +35,22 @@ public class TelepositionFocus extends EnergyItems {
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.telepositionfocus.desc")); par3List.add(StatCollector.translateToLocal("tooltip.telepositionfocus.desc"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) { NBTTagCompound itemTag = IBindable.getTag(par1ItemStack);
NBTTagCompound itemTag = par1ItemStack.getTagCompound(); par3List.add(
StatCollector.translateToLocal("tooltip.alchemy.coords") + " "
if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) { + itemTag.getInteger("xCoord")
par3List.add( + ", "
StatCollector.translateToLocal("tooltip.owner.currentowner") + " " + itemTag.getInteger("yCoord")
+ par1ItemStack.getTagCompound().getString("ownerName")); + ", "
} + itemTag.getInteger("zCoord"));
par3List.add(StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + getDimensionID(par1ItemStack));
par3List.add(
StatCollector.translateToLocal("tooltip.alchemy.coords") + " "
+ itemTag.getInteger("xCoord")
+ ", "
+ itemTag.getInteger("yCoord")
+ ", "
+ itemTag.getInteger("zCoord"));
par3List.add(
StatCollector.translateToLocal("tooltip.alchemy.dimension") + " " + getDimensionID(par1ItemStack));
}
} }
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) { if (IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) {
if (par3EntityPlayer.isSneaking()) { if (par3EntityPlayer.isSneaking()) {
return par1ItemStack; return par1ItemStack;
} }
@@ -75,7 +67,8 @@ public class TelepositionFocus extends EnergyItems {
} }
public World getWorld(ItemStack itemStack) { public World getWorld(ItemStack itemStack) {
return DimensionManager.getWorld(getDimensionID(itemStack)); return FMLCommonHandler.instance().getMinecraftServerInstance()
.worldServerForDimension(getDimensionID(itemStack));
} }
public int xCoord(ItemStack itemStack) { public int xCoord(ItemStack itemStack) {
@@ -262,7 +262,7 @@ public class BoundArmour extends ItemArmor
@Override @Override
public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {
if (entity instanceof EntityPlayer) { if (entity instanceof EntityPlayer) {
EnergyItems.checkAndSetItemOwner(stack, (EntityPlayer) entity); IBindable.checkAndSetItemOwner(stack, (EntityPlayer) entity);
if (((EntityPlayer) entity).capabilities.isCreativeMode) { if (((EntityPlayer) entity).capabilities.isCreativeMode) {
return; return;
@@ -275,14 +275,9 @@ public class BoundArmour extends ItemArmor
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.boundarmor.devprotect")); par3List.add(StatCollector.translateToLocal("tooltip.boundarmor.devprotect"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) { if (!(par1ItemStack.getTagCompound() == null)) {
if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) {
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
ItemStack[] inv = getInternalInventory(par1ItemStack); ItemStack[] inv = getInternalInventory(par1ItemStack);
if (inv == null) { if (inv == null) {
@@ -332,7 +327,7 @@ public class BoundArmour extends ItemArmor
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
return super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer); return super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer);
} }
@@ -353,7 +348,7 @@ public class BoundArmour extends ItemArmor
public void repairArmour(World world, EntityPlayer player, ItemStack itemStack) { public void repairArmour(World world, EntityPlayer player, ItemStack itemStack) {
if (itemStack.getItemDamage() > 0) { if (itemStack.getItemDamage() > 0) {
EnergyItems.checkAndSetItemOwner(itemStack, player); IBindable.checkAndSetItemOwner(itemStack, player);
if (!player.capabilities.isCreativeMode) { if (!player.capabilities.isCreativeMode) {
if (EnergyItems.syphonBatteries(itemStack, player, itemStack.getItemDamage() * 75)) { if (EnergyItems.syphonBatteries(itemStack, player, itemStack.getItemDamage() * 75)) {
@@ -383,7 +378,7 @@ public class BoundArmour extends ItemArmor
blood--; blood--;
} }
if (par2World.getWorldTime() % 200 == 0) { if (par2World.getTotalWorldTime() % 200 == 0) {
if (getUpgradeCostMultiplier(par1ItemStack) > 0.02f) { if (getUpgradeCostMultiplier(par1ItemStack) > 0.02f) {
EnergyItems.syphonBatteries( EnergyItems.syphonBatteries(
par1ItemStack, par1ItemStack,
@@ -24,6 +24,7 @@ import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.api.spell.APISpellHelper; import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.items.EnergyItems;
@@ -79,7 +80,7 @@ public abstract class OmegaArmour extends BoundArmour {
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
super.onArmorTick(world, player, itemStack); super.onArmorTick(world, player, itemStack);
if (world.getWorldTime() % 50 == 0) { if (world.getTotalWorldTime() % 50 == 0) {
if (this.storeBiomeID()) { if (this.storeBiomeID()) {
int xCoord = (int) Math.floor(player.posX); int xCoord = (int) Math.floor(player.posX);
int zCoord = (int) Math.floor(player.posZ); int zCoord = (int) Math.floor(player.posZ);
@@ -137,7 +138,7 @@ public abstract class OmegaArmour extends BoundArmour {
omegaStack.setTagCompound(tag); omegaStack.setTagCompound(tag);
} }
this.setContainedArmourStack(omegaStack, boundStack); this.setContainedArmourStack(omegaStack, boundStack);
SoulNetworkHandler.checkAndSetItemOwner(omegaStack, SoulNetworkHandler.getOwnerName(boundStack)); IBindable.checkAndSetItemOwner(omegaStack, SoulNetworkHandler.getOwnerName(boundStack));
this.setItemEnchantability(omegaStack, Math.min(enchantability, 70)); this.setItemEnchantability(omegaStack, Math.min(enchantability, 70));
EnchantmentHelper.setEnchantments(new HashMap(), omegaStack); EnchantmentHelper.setEnchantments(new HashMap(), omegaStack);
@@ -19,7 +19,11 @@ import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.Int3; import WayofTime.alchemicalWizardry.api.Int3;
import WayofTime.alchemicalWizardry.api.alchemy.energy.*; import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack;
import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator; import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator;
import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit; import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@@ -17,7 +17,11 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.*; import WayofTime.alchemicalWizardry.api.alchemy.energy.ISegmentedReagentHandler;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack;
import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator; import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -1,5 +1,7 @@
package WayofTime.alchemicalWizardry.common.items.potion; package WayofTime.alchemicalWizardry.common.items.potion;
import static WayofTime.alchemicalWizardry.AlchemicalWizardry.allowPotionRepair;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@@ -347,4 +349,10 @@ public class AlchemyFlask extends Item {
potionStack.getTagCompound().setTag("CustomPotionEffects", nbttaglist); potionStack.getTagCompound().setTag("CustomPotionEffects", nbttaglist);
return new EntityPotion(worldObj, entityLivingBase, potionStack); return new EntityPotion(worldObj, entityLivingBase, potionStack);
} }
@Override
public boolean isRepairable() {
if (allowPotionRepair) return super.isRepairable();
return false;
}
} }
@@ -12,6 +12,7 @@ import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@@ -30,12 +31,7 @@ public class SigilAir extends EnergyItems implements ArmourUpgrade, ISigil {
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.airsigil.desc")); par3List.add(StatCollector.translateToLocal("tooltip.airsigil.desc"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
@Override @Override
@@ -46,7 +42,7 @@ public class SigilAir extends EnergyItems implements ArmourUpgrade, ISigil {
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
return par1ItemStack; return par1ItemStack;
} }
@@ -14,6 +14,7 @@ import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks; import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding; import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityBloodLightProjectile; import WayofTime.alchemicalWizardry.common.entity.projectile.EntityBloodLightProjectile;
@@ -33,12 +34,7 @@ public class SigilBloodLight extends EnergyItems implements IHolding, ArmourUpgr
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.bloodlightsigil.desc")); par3List.add(StatCollector.translateToLocal("tooltip.bloodlightsigil.desc"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
@Override @Override
@@ -50,7 +46,7 @@ public class SigilBloodLight extends EnergyItems implements IHolding, ArmourUpgr
@Override @Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4,
int par5, int par6, int par7, float par8, float par9, float par10) { int par5, int par6, int par7, float par8, float par9, float par10) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer) if (!IBindable.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer)
|| !EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, getEnergyUsed())) { || !EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, getEnergyUsed())) {
return true; return true;
} }
@@ -88,7 +84,7 @@ public class SigilBloodLight extends EnergyItems implements IHolding, ArmourUpgr
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
return par1ItemStack; return par1ItemStack;
} }
@@ -6,7 +6,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; 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.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentText;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
@@ -45,19 +44,14 @@ public class SigilDivination extends Item implements ArmourUpgrade, IReagentMani
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.divinationsigil.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.divinationsigil.desc1"));
par3List.add(StatCollector.translateToLocal("tooltip.divinationsigil.desc2")); par3List.add(StatCollector.translateToLocal("tooltip.divinationsigil.desc2"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.worldObj.isRemote) { if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.worldObj.isRemote) {
return par1ItemStack; return par1ItemStack;
} }
@@ -65,24 +59,13 @@ public class SigilDivination extends Item implements ArmourUpgrade, IReagentMani
return par1ItemStack; return par1ItemStack;
} }
NBTTagCompound itemTag = par1ItemStack.getTagCompound(); String ownerName = IBindable.getOwnerName(par1ItemStack);
if (itemTag == null || itemTag.getString("ownerName").equals("")) {
return par1ItemStack;
}
String ownerName = itemTag.getString("ownerName");
MovingObjectPosition movingobjectposition = this MovingObjectPosition movingobjectposition = this
.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, false); .getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, false);
if (movingobjectposition == null) { if (movingobjectposition == null) {
par3EntityPlayer.addChatMessage( tellEssence(par3EntityPlayer, ownerName);
new ChatComponentText(
StatCollector.translateToLocal("message.divinationsigil.currentessence") + " "
+ SoulNetworkHandler.getCurrentEssence(ownerName)
+ "LP"));
return par1ItemStack; return par1ItemStack;
} else { } else {
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
@@ -93,12 +76,7 @@ public class SigilDivination extends Item implements ArmourUpgrade, IReagentMani
TileEntity tile = par2World.getTileEntity(x, y, z); TileEntity tile = par2World.getTileEntity(x, y, z);
if (!(tile instanceof IReagentHandler)) { if (!(tile instanceof IReagentHandler)) {
par3EntityPlayer.addChatMessage( tellEssence(par3EntityPlayer, ownerName);
new ChatComponentText(
StatCollector.translateToLocal("message.divinationsigil.currentessence") + " "
+ SoulNetworkHandler.getCurrentEssence(ownerName)
+ "LP"));
return par1ItemStack; return par1ItemStack;
} }
@@ -108,14 +86,7 @@ public class SigilDivination extends Item implements ArmourUpgrade, IReagentMani
if (infoList != null) { if (infoList != null) {
for (ReagentContainerInfo info : infoList) { for (ReagentContainerInfo info : infoList) {
if (info != null && info.reagent != null && info.reagent.reagent != null) { if (info != null && info.reagent != null && info.reagent.reagent != null) {
par3EntityPlayer.addChatComponentMessage( tellReagent(par3EntityPlayer, info);
new ChatComponentText(
StatCollector.translateToLocal("message.divinationsigil.reagent") + " "
+ ReagentRegistry.getKeyForReagent(info.reagent.reagent)
+ ","
+ StatCollector.translateToLocal("message.divinationsigil.amount")
+ " "
+ info.reagent.amount));
} }
} }
} }
@@ -125,6 +96,26 @@ public class SigilDivination extends Item implements ArmourUpgrade, IReagentMani
return par1ItemStack; return par1ItemStack;
} }
private static void tellReagent(EntityPlayer par3EntityPlayer, ReagentContainerInfo info) {
par3EntityPlayer.addChatComponentMessage(
new ChatComponentText(
StatCollector.translateToLocalFormatted(
"message.divinationsigil.reagent",
ReagentRegistry.getKeyForReagent(info.reagent.reagent))));
par3EntityPlayer.addChatComponentMessage(
new ChatComponentText(
StatCollector
.translateToLocalFormatted("message.divinationsigil.amount", info.reagent.amount)));
}
private static void tellEssence(EntityPlayer par3EntityPlayer, String ownerName) {
par3EntityPlayer.addChatMessage(
new ChatComponentText(
StatCollector.translateToLocalFormatted(
"message.divinationsigil.currentessence",
SoulNetworkHandler.getCurrentEssence(ownerName))));
}
@Override @Override
public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) {} public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) {}
@@ -17,7 +17,11 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.*; import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
import net.minecraftforge.fluids.IFluidHandler;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.Int3; import WayofTime.alchemicalWizardry.api.Int3;
@@ -14,6 +14,7 @@ import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.harvest.HarvestRegistry; import WayofTime.alchemicalWizardry.api.harvest.HarvestRegistry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding; import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.items.EnergyItems;
@@ -38,18 +39,7 @@ public class SigilHarvest extends EnergyItems implements IHolding, ArmourUpgrade
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.harvestsigil.desc")); par3List.add(StatCollector.translateToLocal("tooltip.harvestsigil.desc"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
} else {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
}
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
@Override @Override
@@ -62,13 +52,7 @@ public class SigilHarvest extends EnergyItems implements IHolding, ArmourUpgrade
@Override @Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
if (stack.getTagCompound() == null) { if (IBindable.isActive(stack)) {
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.getTagCompound();
if (tag.getBoolean("isActive")) {
return this.activeIcon; return this.activeIcon;
} else { } else {
return this.passiveIcon; return this.passiveIcon;
@@ -87,29 +71,11 @@ public class SigilHarvest extends EnergyItems implements IHolding, ArmourUpgrade
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
return par1ItemStack; return par1ItemStack;
} }
if (par1ItemStack.getTagCompound() == null) { toggleSigil(par1ItemStack, par2World, par3EntityPlayer);
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = par1ItemStack.getTagCompound();
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
if (tag.getBoolean("isActive")) {
par1ItemStack.setItemDamage(1);
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
if (!par3EntityPlayer.capabilities.isCreativeMode) {
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
tag.setBoolean("isActive", false);
}
}
} else {
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
}
return par1ItemStack; return par1ItemStack;
} }
@@ -126,7 +92,7 @@ public class SigilHarvest extends EnergyItems implements IHolding, ArmourUpgrade
par1ItemStack.setTagCompound(new NBTTagCompound()); par1ItemStack.setTagCompound(new NBTTagCompound());
} }
if (par1ItemStack.getTagCompound().getBoolean("isActive")) { if (IBindable.isActive(par1ItemStack)) {
int range = 3; int range = 3;
int verticalRange = 1; int verticalRange = 1;
int posX = (int) Math.round(par3Entity.posX - 0.5f); int posX = (int) Math.round(par3Entity.posX - 0.5f);
@@ -141,14 +107,8 @@ public class SigilHarvest extends EnergyItems implements IHolding, ArmourUpgrade
} }
} }
} }
if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")
&& par1ItemStack.getTagCompound().getBoolean("isActive")) { checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
if (!par3EntityPlayer.capabilities.isCreativeMode) {
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
par1ItemStack.getTagCompound().setBoolean("isActive", false);
}
}
}
} }
@Override @Override
@@ -21,6 +21,7 @@ import net.minecraftforge.fluids.IFluidHandler;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyBattery; import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.items.EnergyItems;
@@ -62,12 +63,7 @@ public class SigilLava extends ItemBucket implements ArmourUpgrade, ISigil {
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.lavasigil.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.lavasigil.desc1"));
par3List.add(StatCollector.translateToLocal("tooltip.lavasigil.desc2")); par3List.add(StatCollector.translateToLocal("tooltip.lavasigil.desc2"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
/** /**
@@ -80,7 +76,7 @@ public class SigilLava extends ItemBucket implements ArmourUpgrade, ISigil {
@Override @Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
float hitX, float hitY, float hitZ) { float hitX, float hitY, float hitZ) {
if (world.isRemote || !EnergyItems.checkAndSetItemOwner(stack, player) || player.isSneaking()) { if (world.isRemote || !IBindable.checkAndSetItemOwner(stack, player) || player.isSneaking()) {
return false; return false;
} }
@@ -14,6 +14,7 @@ import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@@ -38,18 +39,7 @@ public class SigilOfElementalAffinity extends EnergyItems implements ISigil {
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.sigilofelementalaffinity.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.sigilofelementalaffinity.desc1"));
par3List.add(StatCollector.translateToLocal("tooltip.sigilofelementalaffinity.desc2")); par3List.add(StatCollector.translateToLocal("tooltip.sigilofelementalaffinity.desc2"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
} else {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
}
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
@Override @Override
@@ -62,13 +52,7 @@ public class SigilOfElementalAffinity extends EnergyItems implements ISigil {
@Override @Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
if (stack.getTagCompound() == null) { if (IBindable.isActive(stack)) {
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.getTagCompound();
if (tag.getBoolean("isActive")) {
return this.activeIcon; return this.activeIcon;
} else { } else {
return this.passiveIcon; return this.passiveIcon;
@@ -87,25 +71,13 @@ public class SigilOfElementalAffinity extends EnergyItems implements ISigil {
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
return par1ItemStack; return par1ItemStack;
} }
if (par1ItemStack.getTagCompound() == null) { if (toggleSigil(par1ItemStack, par2World, par3EntityPlayer)) {
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = par1ItemStack.getTagCompound();
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
if (tag.getBoolean("isActive")
&& EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
par1ItemStack.setItemDamage(1);
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 2, 0, true)); par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 2, 0, true));
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 2, 0, true)); par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 2, 0, true));
} else {
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
} }
return par1ItemStack; return par1ItemStack;
@@ -123,19 +95,12 @@ public class SigilOfElementalAffinity extends EnergyItems implements ISigil {
par1ItemStack.setTagCompound(new NBTTagCompound()); par1ItemStack.setTagCompound(new NBTTagCompound());
} }
if (par1ItemStack.getTagCompound().getBoolean("isActive")) { if (IBindable.isActive(par1ItemStack)) {
par3EntityPlayer.fallDistance = 0; par3EntityPlayer.fallDistance = 0;
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 2, 0, true)); par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 2, 0, true));
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 2, 0, true)); par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 2, 0, true));
} }
if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
if (!par3EntityPlayer.capabilities.isCreativeMode) {
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
par1ItemStack.getTagCompound().setBoolean("isActive", false);
}
}
}
} }
} }
@@ -14,6 +14,7 @@ import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding; import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.items.EnergyItems;
@@ -39,18 +40,7 @@ public class SigilOfEnderSeverance extends EnergyItems implements IHolding, ISig
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.sigilofenderseverance.desc")); par3List.add(StatCollector.translateToLocal("tooltip.sigilofenderseverance.desc"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
} else {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
}
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
@Override @Override
@@ -63,13 +53,7 @@ public class SigilOfEnderSeverance extends EnergyItems implements IHolding, ISig
@Override @Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
if (stack.getTagCompound() == null) { if (IBindable.isActive(stack)) {
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.getTagCompound();
if (tag.getBoolean("isActive")) {
return this.activeIcon; return this.activeIcon;
} else { } else {
return this.passiveIcon; return this.passiveIcon;
@@ -88,29 +72,11 @@ public class SigilOfEnderSeverance extends EnergyItems implements IHolding, ISig
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
return par1ItemStack; return par1ItemStack;
} }
if (par1ItemStack.getTagCompound() == null) { toggleSigil(par1ItemStack, par2World, par3EntityPlayer);
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = par1ItemStack.getTagCompound();
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
if (tag.getBoolean("isActive")) {
par1ItemStack.setItemDamage(1);
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
if (!par3EntityPlayer.capabilities.isCreativeMode) {
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
tag.setBoolean("isActive", false);
}
}
} else {
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
}
return par1ItemStack; return par1ItemStack;
} }
@@ -127,7 +93,7 @@ public class SigilOfEnderSeverance extends EnergyItems implements IHolding, ISig
par1ItemStack.setTagCompound(new NBTTagCompound()); par1ItemStack.setTagCompound(new NBTTagCompound());
} }
if (par1ItemStack.getTagCompound().getBoolean("isActive")) { if (IBindable.isActive(par1ItemStack)) {
List<Entity> list = SpellHelper List<Entity> list = SpellHelper
.getEntitiesInRange(par2World, par3Entity.posX, par3Entity.posY, par3Entity.posZ, 4.5, 4.5); .getEntitiesInRange(par2World, par3Entity.posX, par3Entity.posY, par3Entity.posZ, 4.5, 4.5);
for (Entity entity : list) { for (Entity entity : list) {
@@ -137,15 +103,7 @@ public class SigilOfEnderSeverance extends EnergyItems implements IHolding, ISig
} }
} }
} }
if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
if (!par3EntityPlayer.capabilities.isCreativeMode) {
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
par1ItemStack.getTagCompound().setBoolean("isActive", false);
}
}
}
return; checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
} }
} }
@@ -18,6 +18,7 @@ import net.minecraftforge.event.entity.player.BonemealEvent;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.common.eventhandler.Event.Result; import cpw.mods.fml.common.eventhandler.Event.Result;
@@ -32,8 +33,6 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon passiveIcon; private IIcon passiveIcon;
private int tickDelay = 100;
public SigilOfGrowth() { public SigilOfGrowth() {
super(); super();
this.maxStackSize = 1; this.maxStackSize = 1;
@@ -45,18 +44,7 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.sigilofgrowth.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.sigilofgrowth.desc1"));
par3List.add(StatCollector.translateToLocal("tooltip.sigilofgrowth.desc2")); par3List.add(StatCollector.translateToLocal("tooltip.sigilofgrowth.desc2"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
} else {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
}
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
@Override @Override
@@ -69,13 +57,7 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil
@Override @Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
if (stack.getTagCompound() == null) { if (IBindable.isActive(stack)) {
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.getTagCompound();
if (tag.getBoolean("isActive")) {
return this.activeIcon; return this.activeIcon;
} else { } else {
return this.passiveIcon; return this.passiveIcon;
@@ -95,7 +77,7 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil
@Override @Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4,
int par5, int par6, int par7, float par8, float par9, float par10) { int par5, int par6, int par7, float par8, float par9, float par10) {
if (EnergyItems.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer)) { if (IBindable.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer)) {
if (applyBonemeal(par1ItemStack, par3World, par4, par5, par6, par2EntityPlayer)) { if (applyBonemeal(par1ItemStack, par3World, par4, par5, par6, par2EntityPlayer)) {
EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, getEnergyUsed()); EnergyItems.syphonBatteries(par1ItemStack, par2EntityPlayer, getEnergyUsed());
@@ -112,7 +94,7 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
return par1ItemStack; return par1ItemStack;
} }
@@ -120,20 +102,7 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil
return par1ItemStack; return par1ItemStack;
} }
if (par1ItemStack.getTagCompound() == null) { toggleSigil(par1ItemStack, par2World, par3EntityPlayer);
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = par1ItemStack.getTagCompound();
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
if (tag.getBoolean("isActive")
&& EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
par1ItemStack.setItemDamage(1);
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % tickDelay);
} else {
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
}
return par1ItemStack; return par1ItemStack;
} }
@@ -148,12 +117,9 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil
par1ItemStack.setTagCompound(new NBTTagCompound()); par1ItemStack.setTagCompound(new NBTTagCompound());
} }
if (par1ItemStack.getTagCompound().getBoolean("isActive")) { if (IBindable.isActive(par1ItemStack)) {
if (par2World.getWorldTime() % tickDelay == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")) {
if (!EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par3Entity, getEnergyUsed())) { checkPassiveDrain(par1ItemStack, par2World, (EntityPlayer) par3Entity);
par1ItemStack.getTagCompound().setBoolean("isActive", false);
}
}
int range = 3; int range = 3;
int verticalRange = 2; int verticalRange = 2;
int posX = (int) Math.round(par3Entity.posX - 0.5f); int posX = (int) Math.round(par3Entity.posX - 0.5f);
@@ -206,6 +172,11 @@ public class SigilOfGrowth extends EnergyItems implements ArmourUpgrade, ISigil
return false; return false;
} }
@Override
public int drainTicks() {
return 100;
}
@Override @Override
public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) { public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) {
if (world.isRemote) { if (world.isRemote) {
@@ -14,6 +14,7 @@ import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@@ -37,18 +38,7 @@ public class SigilOfHaste extends EnergyItems implements ArmourUpgrade, ISigil {
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.sigilofhaste.desc")); par3List.add(StatCollector.translateToLocal("tooltip.sigilofhaste.desc"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
} else {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
}
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
@Override @Override
@@ -61,13 +51,7 @@ public class SigilOfHaste extends EnergyItems implements ArmourUpgrade, ISigil {
@Override @Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
if (stack.getTagCompound() == null) { if (IBindable.isActive(stack)) {
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.getTagCompound();
if (tag.getBoolean("isActive")) {
return this.activeIcon; return this.activeIcon;
} else { } else {
return this.passiveIcon; return this.passiveIcon;
@@ -86,24 +70,12 @@ public class SigilOfHaste extends EnergyItems implements ArmourUpgrade, ISigil {
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
return par1ItemStack; return par1ItemStack;
} }
if (par1ItemStack.getTagCompound() == null) { if (toggleSigil(par1ItemStack, par2World, par3EntityPlayer)) {
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = par1ItemStack.getTagCompound();
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
if (tag.getBoolean("isActive")
&& EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
par1ItemStack.setItemDamage(1);
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionBoost.id, 3, 1)); par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionBoost.id, 3, 1));
} else {
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
} }
return par1ItemStack; return par1ItemStack;
@@ -121,18 +93,11 @@ public class SigilOfHaste extends EnergyItems implements ArmourUpgrade, ISigil {
par1ItemStack.setTagCompound(new NBTTagCompound()); par1ItemStack.setTagCompound(new NBTTagCompound());
} }
if (par1ItemStack.getTagCompound().getBoolean("isActive")) { if (IBindable.isActive(par1ItemStack)) {
par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionBoost.id, 3, 1)); par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionBoost.id, 3, 1));
} }
if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
if (!par3EntityPlayer.capabilities.isCreativeMode) {
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
par1ItemStack.getTagCompound().setBoolean("isActive", false);
}
}
}
} }
@Override @Override
@@ -16,6 +16,7 @@ import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding; import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.items.EnergyItems;
@@ -30,8 +31,6 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon passiveIcon; private IIcon passiveIcon;
private int tickDelay = 300;
public SigilOfMagnetism() { public SigilOfMagnetism() {
super(); super();
this.maxStackSize = 1; this.maxStackSize = 1;
@@ -42,18 +41,7 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.sigilofmagnetism.desc")); par3List.add(StatCollector.translateToLocal("tooltip.sigilofmagnetism.desc"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
} else {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
}
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
@Override @Override
@@ -66,13 +54,7 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol
@Override @Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
if (stack.getTagCompound() == null) { if (IBindable.isActive(stack)) {
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.getTagCompound();
if (tag.getBoolean("isActive")) {
return this.activeIcon; return this.activeIcon;
} else { } else {
return this.passiveIcon; return this.passiveIcon;
@@ -91,24 +73,11 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
return par1ItemStack; return par1ItemStack;
} }
if (par1ItemStack.getTagCompound() == null) { toggleSigil(par1ItemStack, par2World, par3EntityPlayer);
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = par1ItemStack.getTagCompound();
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
if (tag.getBoolean("isActive")
&& EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
par1ItemStack.setItemDamage(1);
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % tickDelay);
} else {
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
}
return par1ItemStack; return par1ItemStack;
} }
@@ -125,12 +94,9 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol
par1ItemStack.setTagCompound(new NBTTagCompound()); par1ItemStack.setTagCompound(new NBTTagCompound());
} }
if (par1ItemStack.getTagCompound().getBoolean("isActive")) { if (IBindable.isActive(par1ItemStack)) {
if (par2World.getWorldTime() % tickDelay == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")) {
if (!EnergyItems.syphonBatteries(par1ItemStack, (EntityPlayer) par3Entity, getEnergyUsed())) { checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
par1ItemStack.getTagCompound().setBoolean("isActive", false);
}
}
int range = 5; int range = 5;
int verticalRange = 5; int verticalRange = 5;
@@ -170,6 +136,11 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol
} }
} }
@Override
public int drainTicks() {
return 300;
}
@Override @Override
public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) { public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) {
int range = 5; int range = 5;
@@ -16,6 +16,7 @@ import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
@@ -44,18 +45,7 @@ public class SigilOfSupression extends EnergyItems implements ArmourUpgrade, ISi
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.sigilofsupression.desc")); par3List.add(StatCollector.translateToLocal("tooltip.sigilofsupression.desc"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
} else {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
}
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
@Override @Override
@@ -68,16 +58,10 @@ public class SigilOfSupression extends EnergyItems implements ArmourUpgrade, ISi
@Override @Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
if (stack.getTagCompound() == null) { if (IBindable.isActive(stack)) {
stack.setTagCompound(new NBTTagCompound()); return this.activeIcon;
}
NBTTagCompound tag = stack.getTagCompound();
if (tag.getBoolean("isActive")) {
return activeIcon;
} else { } else {
return passiveIcon; return this.passiveIcon;
} }
} }
@@ -93,9 +77,7 @@ public class SigilOfSupression extends EnergyItems implements ArmourUpgrade, ISi
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
int tickDelay = 200; if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)
|| SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) { || SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) {
return par1ItemStack; return par1ItemStack;
} }
@@ -104,25 +86,7 @@ public class SigilOfSupression extends EnergyItems implements ArmourUpgrade, ISi
return par1ItemStack; return par1ItemStack;
} }
if (par1ItemStack.getTagCompound() == null) { toggleSigil(par1ItemStack, par2World, par3EntityPlayer);
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = par1ItemStack.getTagCompound();
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
if (tag.getBoolean("isActive")) {
par1ItemStack.setItemDamage(1);
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % tickDelay);
if (!par3EntityPlayer.capabilities.isCreativeMode) {
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
tag.setBoolean("isActive", false);
}
}
} else {
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
}
return par1ItemStack; return par1ItemStack;
} }
@@ -143,7 +107,7 @@ public class SigilOfSupression extends EnergyItems implements ArmourUpgrade, ISi
par1ItemStack.setTagCompound(new NBTTagCompound()); par1ItemStack.setTagCompound(new NBTTagCompound());
} }
if (par1ItemStack.getTagCompound().getBoolean("isActive") && (!par2World.isRemote)) { if (IBindable.isActive(par1ItemStack) && (!par2World.isRemote)) {
Vec3 blockVec = SpellHelper.getEntityBlockVector(par3EntityPlayer); Vec3 blockVec = SpellHelper.getEntityBlockVector(par3EntityPlayer);
int x = (int) blockVec.xCoord; int x = (int) blockVec.xCoord;
int y = (int) blockVec.yCoord; int y = (int) blockVec.yCoord;
@@ -173,15 +137,7 @@ public class SigilOfSupression extends EnergyItems implements ArmourUpgrade, ISi
} }
} }
} }
checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
if (!par3EntityPlayer.capabilities.isCreativeMode) {
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
par1ItemStack.getTagCompound().setBoolean("isActive", false);
}
}
}
} }
@Override @Override
@@ -22,6 +22,7 @@ import net.minecraftforge.event.entity.living.EnderTeleportEvent;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
@@ -62,19 +63,14 @@ public class SigilOfTheAssassin extends EnergyItems implements ArmourUpgrade, IS
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.sigiloftheassassin.desc")); par3List.add(StatCollector.translateToLocal("tooltip.sigiloftheassassin.desc"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
/** /**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/ */
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
return par1ItemStack; return par1ItemStack;
} }
@@ -16,6 +16,7 @@ import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks; import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralBlock; import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralBlock;
@@ -30,8 +31,6 @@ public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade, ISig
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon passiveIcon; private IIcon passiveIcon;
private int tickDelay = 200;
public SigilOfTheBridge() { public SigilOfTheBridge() {
super(); super();
this.maxStackSize = 1; this.maxStackSize = 1;
@@ -43,18 +42,7 @@ public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade, ISig
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.sigilofthebridge.desc1")); par3List.add(StatCollector.translateToLocal("tooltip.sigilofthebridge.desc1"));
par3List.add(StatCollector.translateToLocal("tooltip.sigilofthebridge.desc2")); par3List.add(StatCollector.translateToLocal("tooltip.sigilofthebridge.desc2"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
} else {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
}
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
@Override @Override
@@ -67,13 +55,7 @@ public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade, ISig
@Override @Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
if (stack.getTagCompound() == null) { if (IBindable.isActive(stack)) {
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.getTagCompound();
if (tag.getBoolean("isActive")) {
return this.activeIcon; return this.activeIcon;
} else { } else {
return this.passiveIcon; return this.passiveIcon;
@@ -92,24 +74,11 @@ public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade, ISig
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
return par1ItemStack; return par1ItemStack;
} }
if (par1ItemStack.getTagCompound() == null) { toggleSigil(par1ItemStack, par2World, par3EntityPlayer);
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = par1ItemStack.getTagCompound();
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
if (tag.getBoolean("isActive")
&& EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
par1ItemStack.setItemDamage(1);
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % tickDelay);
} else {
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
}
return par1ItemStack; return par1ItemStack;
} }
@@ -126,15 +95,8 @@ public class SigilOfTheBridge extends EnergyItems implements ArmourUpgrade, ISig
par1ItemStack.setTagCompound(new NBTTagCompound()); par1ItemStack.setTagCompound(new NBTTagCompound());
} }
if (par1ItemStack.getTagCompound().getBoolean("isActive")) { if (IBindable.isActive(par1ItemStack)) {
if (par2World.getWorldTime() % tickDelay == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")) { checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
if (EnergyItems
.syphonBatteries(par1ItemStack, (EntityPlayer) par3Entity, this.getLPUsed(par1ItemStack))) {
this.setLPUsed(par1ItemStack, 0);
} else {
par1ItemStack.getTagCompound().setBoolean("isActive", false);
}
}
if (!par3EntityPlayer.onGround && !par3EntityPlayer.isSneaking()) { if (!par3EntityPlayer.onGround && !par3EntityPlayer.isSneaking()) {
return; return;
} }
@@ -15,6 +15,7 @@ import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@@ -38,18 +39,7 @@ public class SigilOfTheFastMiner extends EnergyItems implements ArmourUpgrade, I
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.sigilofthefastminer.desc")); par3List.add(StatCollector.translateToLocal("tooltip.sigilofthefastminer.desc"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
} else {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
}
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
@Override @Override
@@ -62,13 +52,7 @@ public class SigilOfTheFastMiner extends EnergyItems implements ArmourUpgrade, I
@Override @Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
if (stack.getTagCompound() == null) { if (IBindable.isActive(stack)) {
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.getTagCompound();
if (tag.getBoolean("isActive")) {
return this.activeIcon; return this.activeIcon;
} else { } else {
return this.passiveIcon; return this.passiveIcon;
@@ -87,24 +71,12 @@ public class SigilOfTheFastMiner extends EnergyItems implements ArmourUpgrade, I
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
return par1ItemStack; return par1ItemStack;
} }
if (par1ItemStack.getTagCompound() == null) { if (toggleSigil(par1ItemStack, par2World, par3EntityPlayer)) {
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = par1ItemStack.getTagCompound();
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
if (tag.getBoolean("isActive")
&& EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
par1ItemStack.setItemDamage(1);
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 2, 1, true)); par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 2, 1, true));
} else {
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
} }
return par1ItemStack; return par1ItemStack;
@@ -122,18 +94,11 @@ public class SigilOfTheFastMiner extends EnergyItems implements ArmourUpgrade, I
par1ItemStack.setTagCompound(new NBTTagCompound()); par1ItemStack.setTagCompound(new NBTTagCompound());
} }
if (par1ItemStack.getTagCompound().getBoolean("isActive")) { if (IBindable.isActive(par1ItemStack)) {
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 2, 1, true)); par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 2, 1, true));
} }
if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
if (!par3EntityPlayer.capabilities.isCreativeMode) {
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
par1ItemStack.getTagCompound().setBoolean("isActive", false);
}
}
}
} }
@Override @Override
@@ -14,6 +14,7 @@ import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@@ -37,18 +38,7 @@ public class SigilOfWind extends EnergyItems implements ArmourUpgrade, ISigil {
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.sigilofwind.desc")); par3List.add(StatCollector.translateToLocal("tooltip.sigilofwind.desc"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
} else {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
}
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
@Override @Override
@@ -61,13 +51,7 @@ public class SigilOfWind extends EnergyItems implements ArmourUpgrade, ISigil {
@Override @Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
if (stack.getTagCompound() == null) { if (IBindable.isActive(stack)) {
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.getTagCompound();
if (tag.getBoolean("isActive")) {
return this.activeIcon; return this.activeIcon;
} else { } else {
return this.passiveIcon; return this.passiveIcon;
@@ -86,24 +70,12 @@ public class SigilOfWind extends EnergyItems implements ArmourUpgrade, ISigil {
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
return par1ItemStack; return par1ItemStack;
} }
if (par1ItemStack.getTagCompound() == null) { if (toggleSigil(par1ItemStack, par2World, par3EntityPlayer)) {
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = par1ItemStack.getTagCompound();
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
if (tag.getBoolean("isActive")
&& EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
par1ItemStack.setItemDamage(1);
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionProjProt.id, 2, 1)); par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionProjProt.id, 2, 1));
} else {
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
} }
return par1ItemStack; return par1ItemStack;
@@ -121,18 +93,11 @@ public class SigilOfWind extends EnergyItems implements ArmourUpgrade, ISigil {
par1ItemStack.setTagCompound(new NBTTagCompound()); par1ItemStack.setTagCompound(new NBTTagCompound());
} }
if (par1ItemStack.getTagCompound().getBoolean("isActive")) { if (IBindable.isActive(par1ItemStack)) {
par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionProjProt.id, 2, 1)); par3EntityPlayer.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionProjProt.id, 2, 1));
} }
if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay") checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
&& par1ItemStack.getTagCompound().getBoolean("isActive")) {
if (!par3EntityPlayer.capabilities.isCreativeMode) {
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
par1ItemStack.getTagCompound().setBoolean("isActive", false);
}
}
}
} }
@Override @Override
@@ -15,6 +15,7 @@ import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.compress.CompressionRegistry; import WayofTime.alchemicalWizardry.api.compress.CompressionRegistry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding; import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.items.EnergyItems;
@@ -39,18 +40,7 @@ public class SigilPackRat extends EnergyItems implements IHolding, ArmourUpgrade
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.packratsigil.desc")); par3List.add(StatCollector.translateToLocal("tooltip.packratsigil.desc"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
if (par1ItemStack.getTagCompound().getBoolean("isActive")) {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.activated"));
} else {
par3List.add(StatCollector.translateToLocal("tooltip.sigil.state.deactivated"));
}
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
@Override @Override
@@ -63,13 +53,7 @@ public class SigilPackRat extends EnergyItems implements IHolding, ArmourUpgrade
@Override @Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
if (stack.getTagCompound() == null) { if (IBindable.isActive(stack)) {
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.getTagCompound();
if (tag.getBoolean("isActive")) {
return this.activeIcon; return this.activeIcon;
} else { } else {
return this.passiveIcon; return this.passiveIcon;
@@ -88,29 +72,11 @@ public class SigilPackRat extends EnergyItems implements IHolding, ArmourUpgrade
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) { if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.isSneaking()) {
return par1ItemStack; return par1ItemStack;
} }
if (par1ItemStack.getTagCompound() == null) { toggleSigil(par1ItemStack, par2World, par3EntityPlayer);
par1ItemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = par1ItemStack.getTagCompound();
tag.setBoolean("isActive", !(tag.getBoolean("isActive")));
if (tag.getBoolean("isActive")) {
par1ItemStack.setItemDamage(1);
tag.setInteger("worldTimeDelay", (int) (par2World.getWorldTime() - 1) % 200);
if (!par3EntityPlayer.capabilities.isCreativeMode) {
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
tag.setBoolean("isActive", false);
}
}
} else {
par1ItemStack.setItemDamage(par1ItemStack.getMaxDamage());
}
return par1ItemStack; return par1ItemStack;
} }
@@ -127,7 +93,7 @@ public class SigilPackRat extends EnergyItems implements IHolding, ArmourUpgrade
par1ItemStack.setTagCompound(new NBTTagCompound()); par1ItemStack.setTagCompound(new NBTTagCompound());
} }
if (par1ItemStack.getTagCompound().getBoolean("isActive")) { if (IBindable.isActive(par1ItemStack)) {
ItemStack stack = CompressionRegistry ItemStack stack = CompressionRegistry
.compressInventory(par3EntityPlayer.inventory.mainInventory, par2World); .compressInventory(par3EntityPlayer.inventory.mainInventory, par2World);
if (stack != null) { if (stack != null) {
@@ -140,14 +106,8 @@ public class SigilPackRat extends EnergyItems implements IHolding, ArmourUpgrade
par2World.spawnEntityInWorld(entityItem); par2World.spawnEntityInWorld(entityItem);
} }
} }
if (par2World.getWorldTime() % 200 == par1ItemStack.getTagCompound().getInteger("worldTimeDelay")
&& par1ItemStack.getTagCompound().getBoolean("isActive")) { checkPassiveDrain(par1ItemStack, par2World, par3EntityPlayer);
if (!par3EntityPlayer.capabilities.isCreativeMode) {
if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) {
par1ItemStack.getTagCompound().setBoolean("isActive", false);
}
}
}
} }
@Override @Override
@@ -12,9 +12,9 @@ import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding; import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -35,17 +35,12 @@ public class SigilSeer extends Item implements IHolding, ArmourUpgrade, ISigil {
@Override @Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.seersigil.desc")); par3List.add(StatCollector.translateToLocal("tooltip.seersigil.desc"));
addBindingInformation(par1ItemStack, par3List);
if (!(par1ItemStack.getTagCompound() == null)) {
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
}
} }
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.worldObj.isRemote) { if (!IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer) || par3EntityPlayer.worldObj.isRemote) {
return par1ItemStack; return par1ItemStack;
} }
@@ -15,6 +15,7 @@ import net.minecraftforge.fluids.IFluidHandler;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
@@ -43,12 +44,7 @@ public class SigilVoid extends ItemBucket implements ArmourUpgrade, ISigil {
@Override @Override
public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.voidsigil.desc")); par3List.add(StatCollector.translateToLocal("tooltip.voidsigil.desc"));
addBindingInformation(stack, par3List);
if (!(stack.getTagCompound() == null)) {
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ stack.getTagCompound().getString("ownerName"));
}
} }
@Override @Override
@@ -74,7 +70,7 @@ public class SigilVoid extends ItemBucket implements ArmourUpgrade, ISigil {
@Override @Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
float hitX, float hitY, float hitZ) { float hitX, float hitY, float hitZ) {
if (world.isRemote || !EnergyItems.checkAndSetItemOwner(stack, player) || player.isSneaking()) { if (world.isRemote || !IBindable.checkAndSetItemOwner(stack, player) || player.isSneaking()) {
return false; return false;
} }
@@ -21,6 +21,7 @@ import net.minecraftforge.fluids.IFluidHandler;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.tileEntity.TESocket; import WayofTime.alchemicalWizardry.common.tileEntity.TESocket;
@@ -60,12 +61,7 @@ public class SigilWater extends ItemBucket implements ArmourUpgrade, ISigil {
@Override @Override
public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add(StatCollector.translateToLocal("tooltip.watersigil.desc")); par3List.add(StatCollector.translateToLocal("tooltip.watersigil.desc"));
addBindingInformation(stack, par3List);
if (!(stack.getTagCompound() == null)) {
par3List.add(
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ stack.getTagCompound().getString("ownerName"));
}
} }
/** /**
@@ -78,7 +74,7 @@ public class SigilWater extends ItemBucket implements ArmourUpgrade, ISigil {
@Override @Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
float hitX, float hitY, float hitZ) { float hitX, float hitY, float hitZ) {
if (world.isRemote || !EnergyItems.checkAndSetItemOwner(stack, player) || player.isSneaking()) { if (world.isRemote || !IBindable.checkAndSetItemOwner(stack, player) || player.isSneaking()) {
return false; return false;
} }
@@ -153,7 +153,7 @@ public class InventoryHolding implements IInventory {
@Override @Override
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) { public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) {
return itemStack.getItem() instanceof ISigil; return itemStack.getItem() instanceof ISigil && ((ISigil) itemStack.getItem()).canBeStored();
} }
public void readFromNBT(NBTTagCompound nbtTagCompound) { public void readFromNBT(NBTTagCompound nbtTagCompound) {
@@ -14,11 +14,13 @@ import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
public class SigilOfHolding extends EnergyItems { public class SigilOfHolding extends EnergyItems implements ISigil {
private static int invSize = 5; private static int invSize = 5;
@@ -60,9 +62,8 @@ public class SigilOfHolding extends EnergyItems {
par3List.add(StatCollector.translateToLocal("tooltip.sigilofholding.desc")); par3List.add(StatCollector.translateToLocal("tooltip.sigilofholding.desc"));
if (!(par1ItemStack.getTagCompound() == null)) { if (!(par1ItemStack.getTagCompound() == null)) {
par3List.add( addBindingInformation(par1ItemStack, par3List);
StatCollector.translateToLocal("tooltip.owner.currentowner") + " "
+ par1ItemStack.getTagCompound().getString("ownerName"));
ItemStack[] inv = getInternalInventory(par1ItemStack); ItemStack[] inv = getInternalInventory(par1ItemStack);
if (inv == null) { if (inv == null) {
@@ -91,7 +92,7 @@ public class SigilOfHolding extends EnergyItems {
@Override @Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4,
int par5, int par6, int par7, float par8, float par9, float par10) { int par5, int par6, int par7, float par8, float par9, float par10) {
if (checkAndSetItemOwner(par1ItemStack, par2EntityPlayer)) { if (IBindable.checkAndSetItemOwner(par1ItemStack, par2EntityPlayer)) {
int currentSlot = getCurrentItem(par1ItemStack); int currentSlot = getCurrentItem(par1ItemStack);
ItemStack[] inv = getInternalInventory(par1ItemStack); ItemStack[] inv = getInternalInventory(par1ItemStack);
@@ -118,7 +119,7 @@ public class SigilOfHolding extends EnergyItems {
@Override @Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) { if (IBindable.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer)) {
if (par3EntityPlayer.isSneaking()) { if (par3EntityPlayer.isSneaking()) {
InventoryHolding.setUUID(par1ItemStack); InventoryHolding.setUUID(par1ItemStack);
par3EntityPlayer.openGui( par3EntityPlayer.openGui(
@@ -153,7 +154,7 @@ public class SigilOfHolding extends EnergyItems {
@Override @Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
float hitX, float hitY, float hitZ) { float hitX, float hitY, float hitZ) {
if (checkAndSetItemOwner(stack, player)) { if (IBindable.checkAndSetItemOwner(stack, player)) {
int currentSlot = getCurrentItem(stack); int currentSlot = getCurrentItem(stack);
ItemStack[] inv = getInternalInventory(stack); ItemStack[] inv = getInternalInventory(stack);
@@ -305,4 +306,9 @@ public class SigilOfHolding extends EnergyItems {
inv[i].getItem().onUpdate(inv[i], par2World, par3Entity, par4, par5); inv[i].getItem().onUpdate(inv[i], par2World, par3Entity, par4, par5);
} }
} }
@Override
public boolean canBeStored() {
return false;
}
} }
@@ -5,7 +5,13 @@ import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import WayofTime.alchemicalWizardry.common.entity.mob.*; import WayofTime.alchemicalWizardry.common.entity.mob.EntityAirElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityEarthElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityFireElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityHolyElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityShadeElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityWaterElemental;
public class RenderElemental extends RenderLiving { public class RenderElemental extends RenderLiving {
@@ -9,7 +9,14 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12; import org.lwjgl.opengl.GL12;
import WayofTime.alchemicalWizardry.common.entity.projectile.*; import WayofTime.alchemicalWizardry.common.entity.projectile.ExplosionProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.FireProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.HolyProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.IceProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.LightningBoltProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.MudProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.WaterProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.WindGustProjectile;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -31,7 +31,7 @@ public class RitualEffectAlphaPact extends RitualEffect {
int y = ritualStone.getYCoord(); int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord(); int z = ritualStone.getZCoord();
if (world.getWorldTime() % 20 != 0) { if (world.getTotalWorldTime() % 20 != 0) {
return; return;
} }
@@ -34,7 +34,7 @@ public class RitualEffectAnimalGrowth extends RitualEffect {
int y = ritualStone.getYCoord(); int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord(); int z = ritualStone.getZCoord();
if (world.getWorldTime() % 20 != 0) { if (world.getTotalWorldTime() % 20 != 0) {
return; return;
} }
@@ -208,7 +208,7 @@ public class RitualEffectAutoAlchemy extends RitualEffect {
} }
} }
if (world.getWorldTime() % 10 == 0) { if (world.getTotalWorldTime() % 10 == 0) {
if (flag == 0 && inputInv1 != null) { if (flag == 0 && inputInv1 != null) {
for (int i = 0; i < recipe.length; i++) { for (int i = 0; i < recipe.length; i++) {
ItemStack recItem = recipe[i]; ItemStack recItem = recipe[i];
@@ -1,7 +1,11 @@
package WayofTime.alchemicalWizardry.common.rituals; package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayDeque;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.BitSet;
import java.util.List; import java.util.List;
import java.util.Queue;
import java.util.function.BiConsumer;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.effect.EntityLightningBolt;
@@ -24,6 +28,7 @@ import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth; import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth;
@@ -75,61 +80,38 @@ public class RitualEffectBiomeChanger extends RitualEffect {
} }
boolList[range][range] = true; boolList[range][range] = true;
boolean isReady = false;
while (!isReady) { Queue<Integer> BFSqueue = new ArrayDeque<>();
isReady = true; BFSqueue.add(x);
BFSqueue.add(z);
for (int i = 0; i < 2 * range + 1; i++) { BiConsumer<Integer, Integer> tryEnqueue = (nextX, nextZ) -> {
for (int j = 0; j < 2 * range + 1; j++) { if (Math.abs(nextX - x) > range || Math.abs(nextZ - z) > range) return;
if (boolList[i][j]) { if (boolList[nextX - (x - range)][nextZ - (z - range)]) return;
if (i - 1 >= 0 && !boolList[i - 1][j]) {
Block block = world.getBlock(x - range + i - 1, y + 1, z - range + j);
if (!ModBlocks.largeBloodStoneBrick.equals(block) Block block = world.getBlock(nextX, y + 1, nextZ);
&& !ModBlocks.bloodStoneBrick.equals(block)) { if (block == null || block.equals(ModBlocks.bloodStoneBrick)
boolList[i - 1][j] = true; || block.equals(ModBlocks.largeBloodStoneBrick))
isReady = false; return;
}
}
if (j - 1 >= 0 && !boolList[i][j - 1]) { boolList[nextX - (x - range)][nextZ - (z - range)] = true;
Block block = world.getBlock(x - range + i, y + 1, z - range + j - 1); BFSqueue.add(nextX);
BFSqueue.add(nextZ);
};
if (!ModBlocks.largeBloodStoneBrick.equals(block) while (!BFSqueue.isEmpty()) {
&& !ModBlocks.bloodStoneBrick.equals(block)) { Integer curX = BFSqueue.remove();
boolList[i][j - 1] = true; Integer curZ = BFSqueue.remove();
isReady = false;
}
}
if (i + 1 <= 2 * range && !boolList[i + 1][j]) { tryEnqueue.accept(curX + 1, curZ);
Block block = world.getBlock(x - range + i + 1, y + 1, z - range + j); tryEnqueue.accept(curX, curZ + 1);
tryEnqueue.accept(curX - 1, curZ);
if (!ModBlocks.largeBloodStoneBrick.equals(block) tryEnqueue.accept(curX, curZ - 1);
&& !ModBlocks.bloodStoneBrick.equals(block)) {
boolList[i + 1][j] = true;
isReady = false;
}
}
if (j + 1 <= 2 * range && !boolList[i][j + 1]) {
Block block = world.getBlock(x - range + i, y + 1, z - range + j + 1);
if (!ModBlocks.largeBloodStoneBrick.equals(block)
&& !ModBlocks.bloodStoneBrick.equals(block)) {
boolList[i][j + 1] = true;
isReady = false;
}
}
}
}
}
} }
float temperature = 0.5f; float temperature = 0.5f;
float humidity = 0.5f; float humidity = 0.5f;
float acceptableRange = 0.1f; float acceptableRange = 0.0999f;
int biomeSkip = 0; int biomeSkip = 0;
for (int i = -1; i <= 1; i++) { for (int i = -1; i <= 1; i++) {
@@ -240,26 +222,42 @@ public class RitualEffectBiomeChanger extends RitualEffect {
biomeID = 1; biomeID = 1;
} }
for (int i = 0; i < 2 * range + 1; i++) { List<Chunk> chunkList = new ArrayList<>();
for (int j = 0; j < 2 * range + 1; j++) {
if (boolList[i][j]) {
Chunk chunk = world.getChunkFromBlockCoords(x - range + i, z - range + j);
byte[] byteArray = chunk.getBiomeArray();
int moduX = (x - range + i) % 16;
int moduZ = (z - range + j) % 16;
if (moduX < 0) { for (int chunkX = (x - range) >> 4; chunkX <= (x + range) >> 4; ++chunkX) {
moduX = moduX + 16; for (int chunkZ = (z - range) >> 4; chunkZ <= (z + range) >> 4; ++chunkZ) {
chunkList.add(world.getChunkFromChunkCoords(chunkX, chunkZ));
}
}
for (Chunk chunk : chunkList) {
byte[] byteArray = chunk.getBiomeArray();
BitSet mask = new BitSet();
boolean changed = false;
for (int cZ = 0; cZ < 16; ++cZ) {
int offsetZ = (chunk.zPosition << 4 | cZ) - (z - range);
if (0 <= offsetZ && offsetZ < 2 * range + 1) {
for (int cX = 0; cX < 16; ++cX) {
int offsetX = (chunk.xPosition << 4 | cX) - (x - range);
if (0 <= offsetX && offsetX < 2 * range + 1) {
if (boolList[offsetX][offsetZ]) {
mask.set(cZ << 4 | cX, true);
byteArray[cZ << 4 | cX] = (byte) biomeID;
changed = true;
}
}
} }
if (moduZ < 0) {
moduZ = moduZ + 16;
}
byteArray[moduZ * 16 + moduX] = (byte) biomeID;
chunk.setBiomeArray(byteArray);
} }
} }
if (changed) {
chunk.setBiomeArray(byteArray);
NewPacketHandler.INSTANCE.sendToDimension(
NewPacketHandler
.getGaiaBiomeChangePacket(chunk.xPosition, chunk.zPosition, (byte) biomeID, mask),
world.provider.dimensionId);
}
} }
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh()); SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
@@ -90,7 +90,7 @@ public class RitualEffectContainment extends RitualEffect {
} }
} }
if (world.getWorldTime() % 2 == 0 && flag) { if (world.getTotalWorldTime() % 2 == 0 && flag) {
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh()); SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
} }
} }
Loaded 100 of 159 files, more files were not shown because too many files have changed in this diff. Show more