Compare commits

...
55 Commits
Author SHA1 Message Date
ah-OOG-ah 06b69e1183 Remove DE globe 2025-03-28 08:12:09 -04:00
Maya 18cda6a4ee update 2025-03-08 14:28:23 -06:00
YamiKami_Sama 565fc72d24 Fix OpenComputers component not properly loaded for Particle Generator (and probably other components) (#63) 2025-03-08 14:28:07 -06:00
Maya e039519acf update 2025-01-22 18:58:37 -06:00
Shadow1590 bf5f0bcb5b Add Dislocator Inhibitor (#60) 2025-01-22 18:56:34 -06:00
Martin Robertz 7bca3009b6 update 2025-01-17 12:10:15 +01:00
Ruling-0 f7cac98ad5 Fix Magnet pulling fake item entities (#59) 2025-01-17 00:08:37 -06:00
Dream Master 07ed88515e update 2025-01-15 12:29:22 +01:00
Kogepan229andMartin Robertz 46e5d8a785 More configurable Magnet (#57)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
2025-01-13 07:08:24 +00:00
Martin Robertz 2835b7a54e update 2024-12-31 14:46:23 +01:00
glowredman 2331e33ebb Add Localizations (#58) 2024-12-30 17:42:21 -06:00
Martin Robertz 1fa9420ec2 update 2024-12-27 10:07:48 +01:00
Wilhelm SchusterandMartin Robertz ee65279d0b Broaden support for mouse button keybinds (#56)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
2024-12-26 21:35:47 -06:00
Martin Robertz 8efee8630a update 2024-11-22 21:34:10 +01:00
Martin Robertz 740ceb9857 update 2024-10-25 16:06:36 +02:00
Alexdoru 041fefe81a remove bugged PlacedItem tile entities properly (#55) 2024-10-24 20:09:15 +02:00
Martin Robertz d829c2f95f update 2024-10-21 21:52:23 +02:00
Alexdoru 101a1d46a8 prevent creating a placed item tile entity if the associated item is null (#54) 2024-10-21 21:21:41 +02:00
Martin Robertz ab82b92ae2 update 2024-10-02 15:00:00 +02:00
Martin Robertz 7e69b4b728 Update dependencies.gradle 2024-10-02 06:40:34 +02:00
Alexdoru 69115e24dc Update baubles dep to the baubles extended mod (#53)
* move the Loader.ismoloaded call out of the References class to avoid class loading issues if that class is referenced too early

* update baubles dep to the new baubles mod
2024-10-01 21:34:47 +02:00
Martin Robertz 3e062858c8 update 2024-09-10 17:24:06 +02:00
Alexdoru ea03519563 rename GT reflected classes (#52) 2024-09-09 02:20:31 +02:00
Martin Robertz 9a0231257c update 2024-09-01 22:38:13 +02:00
Caedis 0b4a807bea Remove RenderHelper.disableStandardItemLighting() from RenderParticleGen (#51) 2024-09-01 16:17:02 +02:00
Dream Master 9780cd92b4 update
(cherry picked from commit 24166293d6)
2024-08-28 22:49:48 +02:00
Fabboz 8e8a3b2f64 Render Placed Item Fix (#50) 2024-08-27 18:34:40 +02:00
Dream Master 7691b37d60 update 2024-07-08 13:17:59 +07:00
meonester f0d331970f Magnet client-server desync fix. (#49)
While toggling magnet - item stack wasn't effectively updated in MagnetToggleAckPacket.Handler (only copy - i assume needed for GUI notification purpose - was synced with current state).
2024-07-06 12:57:11 +07:00
Martin Robertz 41b0e600fa update 2024-04-28 12:45:47 +02:00
Raven Szewczyk 8858c596fd Add a dimension whitelist setting for draconic ore (#48)
* Add a dimension whitelist setting for draconic ore

* Fix typo
2024-04-28 12:44:52 +02:00
Martin Robertz 6c48064031 update 2024-04-13 12:56:07 +02:00
NealDeal34 0bf760cca3 redirect the source URL to load images normally (#46) 2024-04-13 12:46:48 +02:00
Martin Robertz 76406d2d78 update 2024-03-23 12:21:47 +01:00
Quetz4l d71e388119 Item Dislocators will work from baubles slots (#47)
* Item Dislocators will work from baubles slots

* fix typo

* optional baubles
2024-03-23 10:53:14 +01:00
Martin Robertz 5252678a45 update 2024-02-18 12:57:44 +01:00
ghostflyby c4a653f187 Fix wrong encode in manual translation in manual-zh_CN.json (#45)
* Fix wrong encode in manual translation in manual-zh_CN.json
* Update manual-zh_CN.json
2024-02-18 19:43:24 +08:00
Raven Szewczyk 04cf0c0239 [ci skip] upgraded build system 2024-02-04 19:58:04 +00:00
Martin Robertz 565de0de03 update bs+deps 2024-01-28 21:40:45 +01:00
kamenskyi cac90210c3 Update manual-ru_RU.json (#44)
* Update manual-ru_RU.json

add ru manual lang file

* Update manual-ru_RU.json

fix ru mistakes
2024-01-28 21:37:22 +01:00
Martin Robertz c0a58239a5 update deps+bs 2024-01-12 00:18:23 +01:00
Raven Szewczyk a534ca2432 [ci skip] upgraded build system 2024-01-08 21:25:11 +00:00
Martin Robertz c7e5643fcd update gradle + deps + bs 2023-12-23 23:55:28 +01:00
kamenskyi 1d54fb5779 Update ru_RU.lang (#43)
* Update ru_RU.lang

add ru lang file

* Update ru_RU.lang

fix mistakes
2023-12-23 22:54:17 +01:00
Martin Robertz b2bc93ec18 update bs+deps 2023-11-11 12:13:39 +01:00
Pelotrio 2aad40ebe0 Make randomEntity a local field to prevent leaking the world also minor refactor 2023-11-10 18:12:41 -08:00
Martin Robertz 398786a179 sa+celanup wci 2023-10-24 13:03:11 +02:00
Martin Robertz 1ed0354744 update bs+deps+gradle 2023-10-24 12:43:56 +02:00
Spacebuilder2020 17c352895c Add Missing helper methods... 2023-10-23 19:52:21 -07:00
Spacebuilder2020 65490f6c83 Attempt to fix build error by copying updated gradle script from https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/master/build.gradle#L629 2023-10-23 19:52:21 -07:00
Spacebuilder2020 0da29db9be Replace all references of blockType with getBlockType to fix NPE downstream 2023-10-23 19:52:21 -07:00
miozune f54c69738e Minor cleanup (#40)
* Remove WorldGenChaosIsland

* Update dependencies to use NH variant of BrandonsCore

* Remove update checker
2023-06-15 22:46:41 +02:00
Alexander Anishin adf73c81f4 Code cleanup (#39)
* Updated build script and dependencies

* Optimized Energy Pylon

* Changed names of few variables

* Started optimizing Energy Storage Core

* Optimized Invisible Multiblock

* Fixed Energy Pylon state update logic

* Round 2 of Energy Storage Core optimization

* Finished optimization of Energy Storage Core

* Cleared method from duplicate code

* Cleaned up Particle Generator code

* Optimized Dislocator Receptacle

* Cleaned up Portal code

* Cleaned up code of PortalHelper

* Changed Reactor Part interface

* Optimized Reactor Energy Injector

* Optimized Reactor Stabilizer

* Stage 1 of Reactor Core refactoring

* Cleaned up Reactor Container code

Fixed bug that allowed to dupe awakened draconium and chaos shards

* Cleaned up Reactor GUI code

* Removed unnecessary checks in GUI Handler

* Removed unnecessary revalidation of reactor structure

* Migrate Reactor Energy Injector to Forge Direction

* Migrate Reactor Stabilizer to Forge Direction

* Introduced Comparator Mode enumeration

* Migrated Reactor Energy Injector and Stabilizer to use ComparatorMode

* Migrated Reactor Core to use ReactorState enumeration

* Clean up Particle Reactor Beam

* Remove stale todo lists

* Renamed several member for clarity

* Cleaned code of Energy Pylon render

* Cleaned up code of Player Detector

* Cleaned up code of Advanced Player Detector

* Cleaned up GUI and Container of Advanced Player Detector

* Removed unnecessary block update

* Removed unnecessary block updates from Creative Keystone and other blocks

* Changed naming style of fields of Particle Generator to camel case

* Cleaned up code of Particle Generator GUI

* Updated build script

* Implemented missing interface for Tile Entity providers

* Fixed range of property of Particle Generator

* Addressed pull request issues

* Added missing localization items for Particle Generator

* And this one too

* Updated switch statements to use new syntax
2023-06-15 19:09:42 +02:00
Martin Robertz 276b17fc9d update dep 2023-05-08 18:23:44 +02:00
Martin Robertz 7ab6b187c1 update bs+sa 2023-05-08 18:22:07 +02:00
158 changed files with 7251 additions and 52964 deletions

No files matched your search

+1
View File
@@ -29,3 +29,4 @@ src/main/resources/mixins.*.json
*.bat
*.DS_Store
!gradlew.bat
layout.json
+2 -1259
View File
File diff suppressed because it is too large. Load diff
+10 -25
View File
@@ -1,31 +1,16 @@
// Add your dependencies here
dependencies {
compile("curse.maven:brandons-core-231382:2297163")
api("com.github.GTNewHorizons:BrandonsCore:1.2.0-GTNH:dev")
api("curse.maven:cofh-lib-220333:2388748")
compileOnly("com.github.GTNewHorizons:ForestryMC:4.4.5:api") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:OpenComputers:1.7.5.20-GTNH:api") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.2.3-GTNH:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:CodeChickenLib:1.1.5.1:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:inventory-tweaks:1.5.13:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:ForestryMC:4.10.3:api") {transitive = false}
compileOnly("com.github.GTNewHorizons:OpenComputers:1.11.10-GTNH:api") {transitive = false}
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.7.29-GTNH:dev") {transitive = false}
compileOnly("com.github.GTNewHorizons:CodeChickenLib:1.3.0:dev") {transitive = false}
compileOnly("com.github.GTNewHorizons:inventory-tweaks:1.7.1:dev") {transitive = false}
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.1.6-GTNH:dev') {transitive = false}
compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") {
transitive = false
}
compileOnly("curse.maven:computercraft-67504:2269339") {
transitive = false
}
compileOnly("curse.maven:cofh-lib-220333:2388748") {
transitive = false
}
compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") {transitive = false}
compileOnly("curse.maven:computercraft-67504:2269339") {transitive = false}
}
+162 -23
View File
@@ -1,64 +1,203 @@
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
# LOCAL to test local config updates.
gtnh.settings.blowdryerTag = 0.2.0
# Human-readable mod name, available for mcmod.info population.
modName = Draconic Evolution
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
# Conventionally lowercase.
modId = DraconicEvolution
# Root package of the mod, used to find various classes in other properties,
# mcmod.info substitution, enabling assertions in run tasks, etc.
modGroup = com.brandon3055.draconicevolution
# WHY is there no version field?
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
# Whether to use modGroup as the maven publishing group.
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
useModGroupForPublishing = false
# Will update your build.gradle automatically whenever an update is available
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
autoUpdateBuildScript = false
# Version of Minecraft to target
minecraftVersion = 1.7.10
# Version of Minecraft Forge to target
forgeVersion = 10.13.4.1614
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
# restart Minecraft in development. Choose this dependent on your mod:
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
channel = stable
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
mappingsVersion = 12
# Defines other MCP mappings for dependency deobfuscation.
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
# Select a default username for testing your mod. You can always override this per-run by running
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
developmentEnvironmentUserName = Developer
# Define a source file of your project with:
# 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 = false
# Generate a class with a String field for the mod version named as defined below.
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
generateGradleTokenClass =
# Name of the token containing the project's current version to generate/replace.
gradleTokenVersion = GRADLETOKEN_VERSION
# [DEPRECATED] Mod ID replacement token.
gradleTokenModId =
# [DEPRECATED] Mod name replacement token.
gradleTokenModName =
# [DEPRECATED] Mod Group replacement token.
gradleTokenGroupName =
# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...])
# Leave these properties empty to skip individual token replacements
# version in @Mod([...], version = VERSION, [...]).
# Leave these properties empty to skip individual token replacements.
replaceGradleTokenInFile = VersionHandler.java
gradleTokenModId =
gradleTokenModName =
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenGroupName =
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
apiPackage = api
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
# Example value: mymodid_at.cfg
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# There can be multiple files in a space-separated list.
# Example value: mymodid_at.cfg nei_at.cfg
accessTransformersFile =
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
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.
mixinPlugin =
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatibility only
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
coreModClass =
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly = false
# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required.
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
forceEnableMixins = false
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
# responsibility to check the license and request permission for distribution if required.
usesShadowedDependencies = false
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
# their own classes, making the minimization unreliable.
minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true
# Adds 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.
customArchiveBaseName = Draconic-Evolution
# 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
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+20 -13
View File
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# 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.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -83,10 +85,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || 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"'
# 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
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -133,10 +133,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
@@ -144,7 +147,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -152,7 +155,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# 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" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -197,11 +200,15 @@ if "$cygwin" || "$msys" ; then
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Vendored
+12 -10
View File
@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
-10
View File
@@ -1,14 +1,4 @@
// Add any additional repositories for your dependencies here
repositories {
maven {
name = "GTNH Maven"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
}
maven {
url "https://cursemaven.com"
}
maven {
url = "https://jitpack.io"
}
}
+5 -10
View File
@@ -4,10 +4,10 @@ pluginManagement {
maven {
// RetroFuturaGradle
name "GTNH Maven"
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
allowInsecureProtocol = true
url "https://nexus.gtnewhorizons.com/repository/public/"
mavenContent {
includeGroup("com.gtnewhorizons.retrofuturagradle")
includeGroup("com.gtnewhorizons")
includeGroupByRegex("com\\.gtnewhorizons\\..+")
}
}
gradlePluginPortal()
@@ -17,12 +17,7 @@ pluginManagement {
}
plugins {
id 'com.diffplug.blowdryerSetup' version '1.6.0'
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.36'
}
blowdryerSetup {
repoSubfolder 'gtnhShared'
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
//devLocal '.' // Use this when testing config updates locally
}
@@ -1,14 +1,5 @@
package com.brandon3055.draconicevolution.client;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.ISound;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.handler.ClientEventHandler;
import com.brandon3055.draconicevolution.client.handler.HudHandler;
@@ -17,32 +8,78 @@ import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.client.keybinding.KeyBindings;
import com.brandon3055.draconicevolution.client.keybinding.KeyInputHandler;
import com.brandon3055.draconicevolution.client.render.IRenderTweak;
import com.brandon3055.draconicevolution.client.render.block.*;
import com.brandon3055.draconicevolution.client.render.entity.*;
import com.brandon3055.draconicevolution.client.render.item.*;
import com.brandon3055.draconicevolution.client.render.block.RenderCrystal;
import com.brandon3055.draconicevolution.client.render.block.RenderDraconiumChest;
import com.brandon3055.draconicevolution.client.render.block.RenderEnergyInfuser;
import com.brandon3055.draconicevolution.client.render.block.RenderParticleGen;
import com.brandon3055.draconicevolution.client.render.block.RenderPortal;
import com.brandon3055.draconicevolution.client.render.block.RenderReactorCore;
import com.brandon3055.draconicevolution.client.render.block.RenderReactorEnergyInjector;
import com.brandon3055.draconicevolution.client.render.block.RenderReactorStabilizer;
import com.brandon3055.draconicevolution.client.render.block.RenderTeleporterStand;
import com.brandon3055.draconicevolution.client.render.block.RenderUpgradeModifier;
import com.brandon3055.draconicevolution.client.render.entity.RenderChaosCrystal;
import com.brandon3055.draconicevolution.client.render.entity.RenderDragon;
import com.brandon3055.draconicevolution.client.render.entity.RenderDragonHeart;
import com.brandon3055.draconicevolution.client.render.entity.RenderDragonProjectile;
import com.brandon3055.draconicevolution.client.render.entity.RenderEntityChaosVortex;
import com.brandon3055.draconicevolution.client.render.entity.RenderEntityCustomArrow;
import com.brandon3055.draconicevolution.client.render.item.RenderArmor;
import com.brandon3055.draconicevolution.client.render.item.RenderBow;
import com.brandon3055.draconicevolution.client.render.item.RenderBowModel;
import com.brandon3055.draconicevolution.client.render.item.RenderChaosFragment;
import com.brandon3055.draconicevolution.client.render.item.RenderChaosShard;
import com.brandon3055.draconicevolution.client.render.item.RenderMobSoul;
import com.brandon3055.draconicevolution.client.render.item.RenderStabilizerPart;
import com.brandon3055.draconicevolution.client.render.item.RenderTool;
import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyBeam;
import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyField;
import com.brandon3055.draconicevolution.client.render.particle.ParticleReactorBeam;
import com.brandon3055.draconicevolution.client.render.tile.*;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileChaosShard;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileCrystal;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileCustomSpawner;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileDissEnchanter;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileDraconiumChest;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileEnergyInfiser;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileEnergyPylon;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileEnergyStorageCore;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileParticleGen;
import com.brandon3055.draconicevolution.client.render.tile.RenderTilePlacedItem;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileReactorCore;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileReactorEnergyInjector;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileReactorStabilizer;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileTeleporterStand;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileUpgradeModifier;
import com.brandon3055.draconicevolution.common.CommonProxy;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart;
import com.brandon3055.draconicevolution.common.entity.*;
import com.brandon3055.draconicevolution.common.entity.EntityChaosCrystal;
import com.brandon3055.draconicevolution.common.entity.EntityChaosGuardian;
import com.brandon3055.draconicevolution.common.entity.EntityChaosVortex;
import com.brandon3055.draconicevolution.common.entity.EntityCustomArrow;
import com.brandon3055.draconicevolution.common.entity.EntityCustomDragon;
import com.brandon3055.draconicevolution.common.entity.EntityDragonHeart;
import com.brandon3055.draconicevolution.common.entity.EntityDragonProjectile;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.*;
import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard;
import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner;
import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter;
import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest;
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator;
import com.brandon3055.draconicevolution.common.tileentities.TilePlacedItem;
import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand;
import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyRelay;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyTransceiver;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileWirelessEnergyTransceiver;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEarth;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyPylon;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorEnergyInjector;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorStabilizer;
import com.brandon3055.draconicevolution.common.utills.UpdateChecker;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
@@ -50,6 +87,14 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.ISound;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge;
public class ClientProxy extends CommonProxy {
@@ -117,7 +162,6 @@ public class ClientProxy extends CommonProxy {
super.init(event);
FMLCommonHandler.instance().bus().register(new KeyInputHandler());
FMLCommonHandler.instance().bus().register(new ClientEventHandler());
if (ConfigHandler.enableVersionChecker) FMLCommonHandler.instance().bus().register(new UpdateChecker());
MinecraftForge.EVENT_BUS.register(new HudHandler());
MinecraftForge.EVENT_BUS.register(new ClientEventHandler());
KeyBindings.init();
@@ -226,7 +270,6 @@ public class ClientProxy extends CommonProxy {
new RenderReactorEnergyInjector());
MinecraftForgeClient
.registerItemRenderer(Item.getItemFromBlock(ModBlocks.reactorCore), new RenderReactorCore());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.earthBlock), new RenderEarthItem());
MinecraftForgeClient
.registerItemRenderer(Item.getItemFromBlock(ModBlocks.chaosCrystal), new RenderChaosShard());
MinecraftForgeClient
@@ -242,7 +285,6 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileCustomSpawner.class, new RenderTileCustomSpawner());
// ClientRegistry.bindTileEntitySpecialRenderer(TileTestBlock.class, new RenderTileCrystal());
ClientRegistry.bindTileEntitySpecialRenderer(TileEnergyStorageCore.class, new RenderTileEnergyStorageCore());
ClientRegistry.bindTileEntitySpecialRenderer(TileEarth.class, new RenderTileEarth());
ClientRegistry.bindTileEntitySpecialRenderer(TileEnergyPylon.class, new RenderTileEnergyPylon());
ClientRegistry.bindTileEntitySpecialRenderer(TilePlacedItem.class, new RenderTilePlacedItem());
ClientRegistry.bindTileEntitySpecialRenderer(TileDissEnchanter.class, new RenderTileDissEnchanter());
@@ -333,7 +375,7 @@ public class ClientProxy extends CommonProxy {
beam.setDead();
return null;
} else {
beam.update(render);
beam.update();
}
return beam;
}
@@ -12,52 +12,44 @@ import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.rea
*/
public class ReactorSound extends PositionedSound implements ITickableSound {
private static ResourceLocation sound = new ResourceLocation(References.RESOURCESPREFIX + "coreSound");
public boolean donePlaying = false;
private TileReactorCore tile;
private static final ResourceLocation sound = new ResourceLocation(References.RESOURCESPREFIX + "coreSound");
public boolean isDonePlaying = false;
private final TileReactorCore core;
public ReactorSound(TileReactorCore tile) {
public ReactorSound(TileReactorCore core) {
super(sound);
this.tile = tile;
this.xPosF = (float) tile.xCoord + 0.5F;
this.yPosF = (float) tile.yCoord + 0.5F;
this.zPosF = (float) tile.zCoord + 0.5F;
this.core = core;
this.xPosF = (float) core.xCoord + 0.5F;
this.yPosF = (float) core.yCoord + 0.5F;
this.zPosF = (float) core.zCoord + 0.5F;
this.repeat = true;
this.volume = 1.5F;
}
@Override
public boolean isDonePlaying() {
return donePlaying;
return isDonePlaying;
}
@Override
public void update() {
volume = (tile.renderSpeed - 0.5F) * 2F;
if (tile.reactionTemperature > 8000) {
volume += (float) ((tile.reactionTemperature - 8000D) / 1000D);
volume = (core.renderSpeed - 0.5F) * 2F;
if (core.reactionTemperature > 8000) {
volume += (float) ((core.reactionTemperature - 8000D) / 1000D);
}
if (tile.reactionTemperature > 2000 && tile.maxFieldCharge > 0
&& tile.fieldCharge < (tile.maxFieldCharge * 0.2D)) {
volume += 2D - ((tile.fieldCharge / tile.maxFieldCharge) * 10D);
if (core.reactionTemperature > 2000 && core.maxFieldCharge > 0
&& core.fieldCharge < (core.maxFieldCharge * 0.2D)) {
volume += 2D - ((core.fieldCharge / core.maxFieldCharge) * 10D);
}
if (tile.reactionTemperature > 2000 && tile.reactorFuel + tile.convertedFuel > 0
&& tile.reactorFuel < (double) (tile.reactorFuel + tile.convertedFuel) * 0.2D) {
volume += 2D - ((tile.reactorFuel / (tile.reactorFuel + tile.convertedFuel)) * 10D);
if (core.reactionTemperature > 2000 && core.reactorFuel + core.convertedFuel > 0
&& core.reactorFuel < (double) (core.reactorFuel + core.convertedFuel) * 0.2D) {
volume += 2D - ((float) core.reactorFuel / (core.reactorFuel + core.convertedFuel)) * 10D;
}
field_147663_c = 0.5F + volume / 2F;
if (tile.isInvalid() || !tile.getWorldObj().getChunkFromBlockCoords(tile.xCoord, tile.zCoord).isChunkLoaded) { // ||
// player
// ==
// null
// ||
// tile.getDistanceFrom(player.posX,
// player.posY,
// player.posZ) > 512){
donePlaying = true;
if (core.isInvalid() || !core.getWorldObj().getChunkFromBlockCoords(core.xCoord, core.zCoord).isChunkLoaded) {
isDonePlaying = true;
repeat = false;
}
}
@@ -6,6 +6,7 @@ import net.minecraftforge.common.config.Configuration;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import cpw.mods.fml.client.config.GuiConfig;
/**
@@ -17,10 +17,6 @@ import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import com.brandon3055.brandonscore.client.utills.GuiHelper;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
@@ -29,6 +25,9 @@ import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.network.ButtonPacket;
import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -14,13 +14,12 @@ import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.brandonscore.client.utills.GuiHelper;
import com.brandon3055.draconicevolution.common.container.ContainerEnergyInfuser;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
import cofh.api.energy.IEnergyContainerItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
File diff suppressed because it is too large. Load diff
@@ -1,12 +1,12 @@
package com.brandon3055.draconicevolution.client.gui;
import java.util.ArrayList;
import java.util.Arrays;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
@@ -25,78 +25,76 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GUIPlayerDetector extends GuiContainer {
public EntityPlayer player;
private TilePlayerDetectorAdvanced detector;
public boolean showInvSlots = true;
private boolean editMode = false;
private int range = 0;
private int maxRange = 20;
private boolean whitelist = false;
private boolean initScedualed = false;
private int initTick = 0;
private String[] names = new String[42];
private GuiTextField selectedNameText;
private int selected = -1;
private boolean outputInverted = false;
public GUIPlayerDetector(InventoryPlayer invPlayer, TilePlayerDetectorAdvanced detector) {
super(detector.getGuiContainer(invPlayer));
this.inventorySlots = new ContainerPlayerDetector(invPlayer, detector, this);
for (int i = 0; i < names.length; i++) names[i] = "";
xSize = 176;
ySize = 198;
this.detector = detector;
this.player = invPlayer.player;
syncWithServer();
}
private static final ResourceLocation texture = new ResourceLocation(
References.MODID.toLowerCase(),
"textures/gui/PlayerDetector.png");
private final ContainerPlayerDetector container;
private boolean isInEditMode = false;
private int range = 0;
private boolean isInWhitelistMode = false;
private boolean isOutputInverted = false;
private boolean isInitScheduled = false;
private int initTick = 0;
private final String[] names = new String[42];
private GuiTextField selectedNameText;
private int selectedMameIndex = -1;
public GUIPlayerDetector(InventoryPlayer playerInventory, TilePlayerDetectorAdvanced detector) {
super(detector.getGuiContainer(playerInventory));
container = (ContainerPlayerDetector) inventorySlots;
Arrays.fill(names, "");
xSize = 176;
ySize = 198;
syncWithServer();
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
protected void drawGuiContainerBackgroundLayer(float partialTicks, int x, int y) {
GL11.glColor4f(1, 1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
if (editMode) {
if (isInEditMode) {
drawTexturedModalRect(guiLeft + 3, guiTop + ySize / 2, 3, 3, xSize - 6, (ySize / 2) - 3);
drawNameChart(x, y);
}
if (showInvSlots) drawTexturedModalRect(guiLeft + 142, guiTop + 19, xSize, 0, 23, 41);
if (container.shouldShowInventory()) {
drawTexturedModalRect(guiLeft + 142, guiTop + 19, xSize, 0, 23, 41);
}
}
@Override
protected void drawGuiContainerForegroundLayer(int x, int y) {
drawGuiText(x, y);
drawGuiText();
}
@Override
public void drawScreen(int x, int y, float p_73863_3_) {
super.drawScreen(x, y, p_73863_3_);
ArrayList<String> lines = new ArrayList<String>();
public void drawScreen(int x, int y, float partialTicks) {
super.drawScreen(x, y, partialTicks);
ArrayList<String> lines = new ArrayList<>();
lines.add("Camouflage");
if ((x - guiLeft > 142 && x - guiLeft < 160) && (y - guiTop > 19 && y - guiTop < 37) && showInvSlots)
if ((x - guiLeft > 142 && x - guiLeft < 160) && (y - guiTop > 19 && y - guiTop < 37)
&& container.shouldShowInventory()) {
drawHoveringText(lines, x, y, fontRendererObj);
}
}
@Override
@SuppressWarnings("unchecked")
public void initGui() {
super.initGui();
buttonList.clear();
if (!editMode) {
String wt = whitelist ? "White List" : "Black List";
int centre = width / 2;
buttonList.add(new GuiButton(0, centre - 20 - 20, guiTop + 20, 20, 20, "+"));
buttonList.add(new GuiButton(1, centre + 20, guiTop + 20, 20, 20, "-"));
buttonList.add(new GuiButton(3, centre - 40, guiTop + 45, 60, 20, wt));
buttonList.add(new GuiButton(4, centre + 20, guiTop + 45, 20, 20, "!"));
buttonList.add(new GuiButton(6, centre - 40, guiTop + 70, 80, 20, "Invert Output"));
if (!isInEditMode) {
String mode = isInWhitelistMode ? "White List" : "Black List";
int center = width / 2;
buttonList.add(new GuiButton(0, center - 20 - 20, guiTop + 20, 20, 20, "+"));
buttonList.add(new GuiButton(1, center + 20, guiTop + 20, 20, 20, "-"));
buttonList.add(new GuiButton(3, center - 40, guiTop + 45, 60, 20, mode));
buttonList.add(new GuiButton(4, center + 20, guiTop + 45, 20, 20, "!"));
buttonList.add(new GuiButton(6, center - 40, guiTop + 70, 80, 20, "Invert Output"));
} else {
buttonList.add(new GuiButton(5, guiLeft - 40, guiTop + ySize - 20, 40, 20, "Back"));
}
@@ -106,112 +104,108 @@ public class GUIPlayerDetector extends GuiContainer {
selectedNameText.setDisabledTextColour(-1);
selectedNameText.setEnableBackgroundDrawing(true);
selectedNameText.setMaxStringLength(40);
selectedNameText.setVisible(editMode);
// ID
// buttonList.add(new GuiButton(0, guiLeft + 85, guiTop , 85, 20, "sgASGgs"));
// syncWithServer();
selectedNameText.setVisible(isInEditMode);
}
@Override
protected void actionPerformed(GuiButton button) {
switch (button.id) {
case 0: // Range +
range = (range < maxRange) ? range + 1 : maxRange;
case 0 -> { // Range +
range = Math.min(range + 1, TilePlayerDetectorAdvanced.MAXIMUM_RANGE);
DraconicEvolution.network.sendToServer(new PlayerDetectorButtonPacket((byte) 0, (byte) range));
break;
case 1: // Range -
range = (range > 1) ? range - 1 : 1;
}
case 1 -> { // Range -
range = Math.max(range - 1, TilePlayerDetectorAdvanced.MINIMUM_RANGE);
DraconicEvolution.network.sendToServer(new PlayerDetectorButtonPacket((byte) 0, (byte) range));
break;
case 3: // White List -
initScedualed = true;
editMode = true;
showInvSlots = false;
((ContainerPlayerDetector) this.inventorySlots).updateContainerSlots();
break;
case 4: // Toggle White List -
whitelist = !whitelist;
initScedualed = true;
byte val = (byte) (whitelist ? 1 : 0);
DraconicEvolution.network.sendToServer(new PlayerDetectorButtonPacket((byte) 1, val));
break;
case 5: // Back -
editMode = false;
showInvSlots = true;
((ContainerPlayerDetector) this.inventorySlots).updateContainerSlots();
initScedualed = true;
break;
case 6: // Back -
outputInverted = !outputInverted;
initScedualed = true;
byte val2 = (byte) (outputInverted ? 1 : 0);
DraconicEvolution.network.sendToServer(new PlayerDetectorButtonPacket((byte) 2, val2));
break;
}
case 3 -> { // Edit Whitelist/Blacklist
isInitScheduled = true;
isInEditMode = true;
container.setShouldShowInventory(false);
}
case 4 -> { // Toggle Whitelist/Blacklist mode
isInitScheduled = true;
isInWhitelistMode = !isInWhitelistMode;
byte whitelistMode = (byte) (isInWhitelistMode ? 1 : 0);
DraconicEvolution.network.sendToServer(new PlayerDetectorButtonPacket((byte) 1, whitelistMode));
}
case 5 -> { // Back
isInitScheduled = true;
isInEditMode = false;
container.setShouldShowInventory(true);
}
case 6 -> { // Invert Output
isInitScheduled = true;
isOutputInverted = !isOutputInverted;
byte outputMode = (byte) (isOutputInverted ? 1 : 0);
DraconicEvolution.network.sendToServer(new PlayerDetectorButtonPacket((byte) 2, outputMode));
}
}
// DraconicEvolution.channelHandler.sendToServer(new ButtonPacket((byte) 0, true));
}
@Override
protected void keyTyped(char par1, int par2) {
if (this.selectedNameText.textboxKeyTyped(par1, par2)) return;
else if (par2 == 28) {
protected void keyTyped(char typedChar, int keyCode) {
if (this.selectedNameText.textboxKeyTyped(typedChar, keyCode)) {
return;
}
if (keyCode == 28) {
if (selectedNameText.isFocused()) {
names[selected] = selectedNameText.getText();
names[selectedMameIndex] = selectedNameText.getText();
selectedNameText.setText("");
selectedNameText.setFocused(false);
DraconicEvolution.network
.sendToServer(new PlayerDetectorStringPacket((byte) selected, names[selected]));
selected = -1;
DraconicEvolution.network.sendToServer(
new PlayerDetectorStringPacket((byte) selectedMameIndex, names[selectedMameIndex]));
selectedMameIndex = -1;
}
} else super.keyTyped(par1, par2);
} else {
super.keyTyped(typedChar, keyCode);
}
}
@Override
public void updateScreen() {
if (initScedualed) initTick++;
if (isInitScheduled) {
initTick++;
}
if (initTick > 1) {
initTick = 0;
initScedualed = false;
isInitScheduled = false;
initGui();
}
super.updateScreen();
}
@Override
protected void mouseClicked(int x, int y, int par3) {
super.mouseClicked(x, y, par3);
if (editMode) selectName(x - guiLeft, y - guiTop);
// this.selectedNameText.mouseClicked(x - guiLeft, y - guiTop, par3);
protected void mouseClicked(int x, int y, int mouseButton) {
super.mouseClicked(x, y, mouseButton);
if (isInEditMode) {
selectName(x - guiLeft, y - guiTop);
}
}
private void drawGuiText(int rawX, int rawY) {
if (!editMode) {
drawCenteredString(fontRendererObj, "Advanced Player Detector", xSize / 2, 5, 0x00FFFF);
fontRendererObj.drawString("Range:", 73, 21, 0x000000, false);
fontRendererObj.drawString("Output Inverted: " + String.valueOf(outputInverted), 33, 97, 0x000000, false);
if (range < 10) fontRendererObj.drawString("" + range, 85, 31, 0x000000, false);
else fontRendererObj.drawString("" + range, 82, 31, 0x000000, false);
} else {
if (selected != -1) drawCenteredString(fontRendererObj, "Press Enter to save", xSize / 2, -22, 0xFF0000);
for (int i = 0; i < 21; i++) {
for (int j = 0; j < 2; j++) {
if (i + j * 21 != selected) {
String s = names[i + j * 21];
if (s.length() > 13) s = s.substring(0, 13) + "...";
fontRendererObj.drawString(s, 5 + j * 84, 6 + i * 9, 0x980000);
private void drawGuiText() {
if (isInEditMode) {
if (selectedMameIndex != -1) {
drawCenteredString(fontRendererObj, "Press Enter to save", xSize / 2, -22, 0xFF0000);
}
for (int row = 0; row < 21; row++) {
for (int column = 0; column < 2; column++) {
if (row + column * 21 != selectedMameIndex) {
String name = names[row + column * 21];
if (name.length() > 13) {
name = name.substring(0, 13) + "...";
}
fontRendererObj.drawString(name, 5 + column * 84, 6 + row * 9, 0x980000);
}
}
}
}
} else {
drawCenteredString(fontRendererObj, "Advanced Player Detector", xSize / 2, 5, 0x00FFFF);
fontRendererObj.drawString("Range:", 73, 21, 0x000000, false);
fontRendererObj.drawString("Output Inverted: " + isOutputInverted, 33, 97, 0x000000, false);
fontRendererObj.drawString(String.valueOf(range), range < 10 ? 85 : 82, 31, 0x000000, false);
}
selectedNameText.drawTextBox();
}
@@ -219,39 +213,46 @@ public class GUIPlayerDetector extends GuiContainer {
int x = rawX - guiLeft;
int y = rawY - guiTop;
for (int i = 0; i < 21; i++) {
drawTexturedModalRect(guiLeft + 4, guiTop + 4 + i * 9, 0, ySize, 186, 10);
for (int row = 0; row < 21; row++) {
drawTexturedModalRect(guiLeft + 4, guiTop + 4 + row * 9, 0, ySize, 186, 10);
}
for (int i = 0; i < 21; i++) {
for (int j = 0; j < 2; j++) {
if ((x > 4 + j * 84 && x < (xSize / 2) - 1 + j * 82) && (y > 4 + i * 9 && y < 13 + i * 9)
|| i + j * 21 == selected)
drawTexturedModalRect(guiLeft + 5 + j * 84, guiTop + 5 + i * 9, 0, ySize + 10, 82, 8);
for (int row = 0; row < 21; row++) {
for (int column = 0; column < 2; column++) {
if ((x > 4 + column * 84 && x < (xSize / 2) - 1 + column * 82) && (y > 4 + row * 9 && y < 13 + row * 9)
|| row + column * 21 == selectedMameIndex)
drawTexturedModalRect(guiLeft + 5 + column * 84, guiTop + 5 + row * 9, 0, ySize + 10, 82, 8);
}
}
}
public void selectName(int x, int y) {
if (initScedualed) return;
if (isInitScheduled) {
return;
}
for (int i = 0; i < 21; i++) {
for (int j = 0; j < 2; j++) {
if ((x > 4 + j * 84 && x < (xSize / 2) - 1 + j * 82) && (y > 4 + i * 9 && y < 13 + i * 9)) {
selected = i + j * 21;
selectedNameText.setText(names[i + j * 21]);
for (int row = 0; row < 21; row++) {
for (int column = 0; column < 2; column++) {
if ((x > 4 + column * 84 && x < (xSize / 2) - 1 + column * 82)
&& (y > 4 + row * 9 && y < 13 + row * 9)) {
selectedMameIndex = row + column * 21;
selectedNameText.setText(names[row + column * 21]);
selectedNameText.setFocused(true);
return;
}
}
}
}
private void syncWithServer() {
this.whitelist = detector.whiteList;
TilePlayerDetectorAdvanced detector = container.getDetector();
isInWhitelistMode = detector.isInWhiteListMode;
for (int i = 0; i < detector.names.length; i++) {
if (detector.names[i] != null) names[i] = detector.names[i];
if (detector.names[i] != null) {
names[i] = detector.names[i];
}
}
range = detector.range;
outputInverted = detector.outputInverted;
isOutputInverted = detector.isOutputInverted;
}
}
@@ -8,9 +8,28 @@ import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.gui.componentguis.GUIManual;
import com.brandon3055.draconicevolution.client.gui.componentguis.GUIReactor;
import com.brandon3055.draconicevolution.client.gui.componentguis.GUIToolConfig;
import com.brandon3055.draconicevolution.common.container.*;
import com.brandon3055.draconicevolution.common.container.ContainerAdvTool;
import com.brandon3055.draconicevolution.common.container.ContainerDissEnchanter;
import com.brandon3055.draconicevolution.common.container.ContainerDraconiumChest;
import com.brandon3055.draconicevolution.common.container.ContainerEnergyInfuser;
import com.brandon3055.draconicevolution.common.container.ContainerGenerator;
import com.brandon3055.draconicevolution.common.container.ContainerGrinder;
import com.brandon3055.draconicevolution.common.container.ContainerPlayerDetector;
import com.brandon3055.draconicevolution.common.container.ContainerReactor;
import com.brandon3055.draconicevolution.common.container.ContainerSunDial;
import com.brandon3055.draconicevolution.common.container.ContainerUpgradeModifier;
import com.brandon3055.draconicevolution.common.container.ContainerWeatherController;
import com.brandon3055.draconicevolution.common.inventory.InventoryTool;
import com.brandon3055.draconicevolution.common.tileentities.*;
import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter;
import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest;
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
import com.brandon3055.draconicevolution.common.tileentities.TileGenerator;
import com.brandon3055.draconicevolution.common.tileentities.TileGrinder;
import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator;
import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetectorAdvanced;
import com.brandon3055.draconicevolution.common.tileentities.TileSunDial;
import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier;
import com.brandon3055.draconicevolution.common.tileentities.TileWeatherController;
import com.brandon3055.draconicevolution.common.tileentities.gates.TileGate;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
@@ -41,175 +60,145 @@ public class GuiHandler implements IGuiHandler {
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
switch (ID) {
case GUIID_WEATHER_CONTROLLER:
TileEntity te = world.getTileEntity(x, y, z);
if (te != null && te instanceof TileWeatherController) {
return new ContainerWeatherController(player.inventory, (TileWeatherController) te);
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
switch (id) {
case GUIID_WEATHER_CONTROLLER -> {
if (tile instanceof TileWeatherController weatherController) {
return new ContainerWeatherController(player.inventory, weatherController);
}
break;
case GUIID_SUN_DIAL:
TileEntity te1 = world.getTileEntity(x, y, z);
if (te1 != null && te1 instanceof TileSunDial) {
return new ContainerSunDial(player.inventory, (TileSunDial) te1);
}
case GUIID_SUN_DIAL -> {
if (tile instanceof TileSunDial sunDial) {
return new ContainerSunDial(player.inventory, sunDial);
}
break;
case GUIID_GRINDER:
TileEntity te2 = world.getTileEntity(x, y, z);
if (te2 != null && te2 instanceof TileGrinder) {
return new ContainerGrinder(player.inventory, (TileGrinder) te2);
}
case GUIID_GRINDER -> {
if (tile instanceof TileGrinder grinder) {
return new ContainerGrinder(player.inventory, grinder);
}
break;
case GUIID_PLAYERDETECTOR:
TileEntity detector = world.getTileEntity(x, y, z);
if (detector != null && detector instanceof TilePlayerDetectorAdvanced) {
return new ContainerPlayerDetector(player.inventory, (TilePlayerDetectorAdvanced) detector);
}
case GUIID_PLAYERDETECTOR -> {
if (tile instanceof TilePlayerDetectorAdvanced detector) {
return new ContainerPlayerDetector(player.inventory, detector);
}
break;
case GUIID_ENERGY_INFUSER:
TileEntity infuser = world.getTileEntity(x, y, z);
if (infuser != null && infuser instanceof TileEnergyInfuser) {
return new ContainerEnergyInfuser(player.inventory, (TileEnergyInfuser) infuser);
}
case GUIID_ENERGY_INFUSER -> {
if (tile instanceof TileEnergyInfuser infuser) {
return new ContainerEnergyInfuser(player.inventory, infuser);
}
break;
case GUIID_GENERATOR:
TileEntity generator = world.getTileEntity(x, y, z);
if (generator != null && generator instanceof TileGenerator) {
return new ContainerGenerator(player.inventory, (TileGenerator) generator);
}
case GUIID_GENERATOR -> {
if (tile instanceof TileGenerator generator) {
return new ContainerGenerator(player.inventory, generator);
}
break;
case GUIID_DISSENCHANTER:
TileEntity dissenchanter = world.getTileEntity(x, y, z);
if (dissenchanter != null && dissenchanter instanceof TileDissEnchanter) {
return new ContainerDissEnchanter(player.inventory, (TileDissEnchanter) dissenchanter);
}
case GUIID_DISSENCHANTER -> {
if (tile instanceof TileDissEnchanter dissenchanter) {
return new ContainerDissEnchanter(player.inventory, dissenchanter);
}
break;
case GUIID_DRACONIC_CHEST:
TileEntity containerChest = world.getTileEntity(x, y, z);
if (containerChest != null && containerChest instanceof TileDraconiumChest) {
return new ContainerDraconiumChest(player.inventory, (TileDraconiumChest) containerChest);
}
case GUIID_DRACONIC_CHEST -> {
if (tile instanceof TileDraconiumChest draconiumChest) {
return new ContainerDraconiumChest(player.inventory, draconiumChest);
}
break;
case GUIID_REACTOR:
TileEntity reactor = world.getTileEntity(x, y, z);
if (reactor != null && reactor instanceof TileReactorCore) {
return new ContainerReactor(player, (TileReactorCore) reactor);
}
case GUIID_REACTOR -> {
if (tile instanceof TileReactorCore reactorCore) {
return new ContainerReactor(player, reactorCore);
}
break;
case GUIID_TOOL_CONFIG:
}
case GUIID_TOOL_CONFIG -> {
return new ContainerAdvTool(player.inventory, new InventoryTool(player, null));
case GUIID_UPGRADE_MODIFIER:
TileEntity containerTemp = world.getTileEntity(x, y, z);
if (containerTemp != null && containerTemp instanceof TileUpgradeModifier) {
return new ContainerUpgradeModifier(player.inventory, (TileUpgradeModifier) containerTemp);
}
case GUIID_UPGRADE_MODIFIER -> {
if (tile instanceof TileUpgradeModifier upgradeModifier) {
return new ContainerUpgradeModifier(player.inventory, upgradeModifier);
}
break;
// case GUIID_CONTAINER_TEMPLATE:
// TileEntity containerTemp = world.getTileEntity(x, y, z);
// if (containerTemp != null && containerTemp instanceof TileContainerTemplate) {
// return new ContainerTemplate(player.inventory, (TileContainerTemplate) containerTemp);
// }
// break;
}
}
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
switch (ID) {
case GUIID_WEATHER_CONTROLLER:
TileEntity te = world.getTileEntity(x, y, z);
if (te != null && te instanceof TileWeatherController) {
return new GUIWeatherController(player.inventory, (TileWeatherController) te);
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
switch (id) {
case GUIID_WEATHER_CONTROLLER -> {
if (tile instanceof TileWeatherController weatherController) {
return new GUIWeatherController(player.inventory, weatherController);
}
break;
case GUIID_SUN_DIAL:
TileEntity te1 = world.getTileEntity(x, y, z);
if (te1 != null && te1 instanceof TileSunDial) {
return new GUISunDial(player.inventory, (TileSunDial) te1);
}
case GUIID_SUN_DIAL -> {
if (tile instanceof TileSunDial sunDial) {
return new GUISunDial(player.inventory, sunDial);
}
break;
case GUIID_TELEPORTER:
}
case GUIID_TELEPORTER -> {
return new GUITeleporter(player);
case GUIID_GRINDER:
TileEntity te2 = world.getTileEntity(x, y, z);
if (te2 != null && te2 instanceof TileGrinder) {
return new GUIGrinder(player.inventory, (TileGrinder) te2);
}
case GUIID_GRINDER -> {
if (tile instanceof TileGrinder grinder) {
return new GUIGrinder(player.inventory, grinder);
}
break;
case GUIID_PARTICLEGEN:
TileEntity gen = world.getTileEntity(x, y, z);
return (gen != null && gen instanceof TileParticleGenerator)
? new GUIParticleGenerator((TileParticleGenerator) gen, player)
: null;
case GUIID_PLAYERDETECTOR:
TileEntity detector = world.getTileEntity(x, y, z);
if (detector != null && detector instanceof TilePlayerDetectorAdvanced) {
return new GUIPlayerDetector(player.inventory, (TilePlayerDetectorAdvanced) detector);
}
case GUIID_PARTICLEGEN -> {
if (tile instanceof TileParticleGenerator particleGenerator) {
return new GUIParticleGenerator(particleGenerator);
}
break;
case GUIID_ENERGY_INFUSER:
TileEntity infuser = world.getTileEntity(x, y, z);
if (infuser != null && infuser instanceof TileEnergyInfuser) {
return new GUIEnergyInfuser(player.inventory, (TileEnergyInfuser) infuser);
}
case GUIID_PLAYERDETECTOR -> {
if (tile instanceof TilePlayerDetectorAdvanced detector) {
return new GUIPlayerDetector(player.inventory, detector);
}
break;
case GUIID_GENERATOR:
TileEntity generator = world.getTileEntity(x, y, z);
if (generator != null && generator instanceof TileGenerator) {
return new GUIGenerator(player.inventory, (TileGenerator) generator);
}
case GUIID_ENERGY_INFUSER -> {
if (tile instanceof TileEnergyInfuser infuser) {
return new GUIEnergyInfuser(player.inventory, infuser);
}
break;
case GUIID_MANUAL:
}
case GUIID_GENERATOR -> {
if (tile instanceof TileGenerator generator) {
return new GUIGenerator(player.inventory, generator);
}
}
case GUIID_MANUAL -> {
return new GUIManual();
case GUIID_DISSENCHANTER:
TileEntity dissenchanter = world.getTileEntity(x, y, z);
if (dissenchanter != null && dissenchanter instanceof TileDissEnchanter) {
return new GUIDissEnchanter(player.inventory, (TileDissEnchanter) dissenchanter);
}
case GUIID_DISSENCHANTER -> {
if (tile instanceof TileDissEnchanter dissenchanter) {
return new GUIDissEnchanter(player.inventory, dissenchanter);
}
break;
case GUIID_DRACONIC_CHEST:
TileEntity containerChest = world.getTileEntity(x, y, z);
if (containerChest != null && containerChest instanceof TileDraconiumChest) {
return new GUIDraconiumChest(player.inventory, (TileDraconiumChest) containerChest);
}
case GUIID_DRACONIC_CHEST -> {
if (tile instanceof TileDraconiumChest draconiumChest) {
return new GUIDraconiumChest(player.inventory, draconiumChest);
}
break;
case GUIID_REACTOR:
TileEntity reactor = world.getTileEntity(x, y, z);
if (reactor != null && reactor instanceof TileReactorCore) {
return new GUIReactor(
player,
(TileReactorCore) reactor,
new ContainerReactor(player, (TileReactorCore) reactor));
}
case GUIID_REACTOR -> {
if (tile instanceof TileReactorCore reactorCore) {
return new GUIReactor(reactorCore, new ContainerReactor(player, reactorCore));
}
break;
case GUIID_TOOL_CONFIG:
}
case GUIID_TOOL_CONFIG -> {
return new GUIToolConfig(
player,
new ContainerAdvTool(player.inventory, new InventoryTool(player, null)));
case GUIID_FLOW_GATE:
return world.getTileEntity(x, y, z) instanceof TileGate
? new GUIFlowGate((TileGate) world.getTileEntity(x, y, z))
: null;
case GUIID_UPGRADE_MODIFIER:
TileEntity containerTemp = world.getTileEntity(x, y, z);
if (containerTemp != null && containerTemp instanceof TileUpgradeModifier) {
}
case GUIID_FLOW_GATE -> {
if (tile instanceof TileGate gate) {
return new GUIFlowGate(gate);
}
}
case GUIID_UPGRADE_MODIFIER -> {
if (tile instanceof TileUpgradeModifier upgradeModifier) {
return new GUIUpgradeModifier(
player.inventory,
(TileUpgradeModifier) containerTemp,
new ContainerUpgradeModifier(player.inventory, (TileUpgradeModifier) containerTemp));
upgradeModifier,
new ContainerUpgradeModifier(player.inventory, upgradeModifier));
}
break;
// case GUIID_CONTAINER_TEMPLATE:
// TileEntity containerTemp = world.getTileEntity(x, y, z);
// if (containerTemp != null && containerTemp instanceof TileContainerTemplate) {
// return new GUIContainerTemplate(player.inventory, (TileContainerTemplate) containerTemp);
// }
// break;
}
}
return null;
@@ -1,6 +1,13 @@
package com.brandon3055.draconicevolution.client.gui.componentguis;
import java.io.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
@@ -18,7 +25,12 @@ import org.apache.commons.io.IOUtils;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.client.gui.guicomponents.*;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentBase;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentButton;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentCollection;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentTextureButton;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentTexturedRect;
import com.brandon3055.brandonscore.client.gui.guicomponents.GUIScrollingBase;
import com.brandon3055.brandonscore.client.utills.ClientUtills;
import com.brandon3055.brandonscore.common.utills.InfoHelper;
import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentContributorsPage;
@@ -5,36 +5,42 @@ import java.util.List;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.client.gui.guicomponents.*;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentButton;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentCollection;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentTextureButton;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentTexturedRect;
import com.brandon3055.brandonscore.client.gui.guicomponents.GUIBase;
import com.brandon3055.brandonscore.client.utills.GuiHelper;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.common.container.ContainerReactor;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore.ReactorState;
/**
* Created by brandon3055 on 30/7/2015.
*/
public class GUIReactor extends GUIBase {
private TileReactorCore reactor;
private ContainerReactor container;
private static boolean showStats = false;
private static boolean showStatistics = false;
private final TileReactorCore core;
private final ContainerReactor container;
public GUIReactor(EntityPlayer player, TileReactorCore reactor, ContainerReactor container) {
public GUIReactor(TileReactorCore core, ContainerReactor container) {
super(container, 248, 222);
this.reactor = reactor;
this.core = core;
this.container = container;
}
@Override
protected ComponentCollection assembleComponents() {
final ResourceLocation widgets = ResourceHandler.getResource("textures/gui/Widgets.png");
collection = new ComponentCollection(0, 0, 248, 222, this);
collection.addComponent(
new ComponentTexturedRect(0, 0, xSize, ySize, ResourceHandler.getResource("textures/gui/Reactor.png")));
@@ -50,7 +56,7 @@ public class GUIReactor extends GUIBase {
this,
"",
StatCollector.translateToLocal("button.de.reactorCharge.txt"),
ResourceHandler.getResource("textures/gui/Widgets.png")))
widgets))
.setName("CHARGE");
collection.addComponent(
new ComponentTextureButton(
@@ -64,7 +70,7 @@ public class GUIReactor extends GUIBase {
this,
"",
StatCollector.translateToLocal("button.de.reactorStart.txt"),
ResourceHandler.getResource("textures/gui/Widgets.png")))
widgets))
.setName("ACTIVATE");
collection.addComponent(
new ComponentTextureButton(
@@ -78,7 +84,7 @@ public class GUIReactor extends GUIBase {
this,
"",
StatCollector.translateToLocal("button.de.reactorStop.txt"),
ResourceHandler.getResource("textures/gui/Widgets.png")))
widgets))
.setName("DEACTIVATE");
collection.addComponent(
new ComponentButton(
@@ -95,10 +101,10 @@ public class GUIReactor extends GUIBase {
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
// Draw I/O Slots
if (reactor.reactorState == TileReactorCore.STATE_OFFLINE) {
if (core.reactorState == ReactorState.OFFLINE) {
RenderHelper.enableGUIStandardItemLighting();
drawTexturedModalRect(guiLeft + 14, guiTop + 139, 14, ySize, 18, 18);
drawTexturedModalRect(guiLeft + 216, guiTop + 139, 32, ySize, 18, 18);
@@ -123,96 +129,86 @@ public class GUIReactor extends GUIBase {
GL11.glColor4f(1f, 1f, 1f, 1f);
// Draw Indicators
double value = Math.min(reactor.reactionTemperature, reactor.maxReactTemperature) / reactor.maxReactTemperature;
double value = Math.min(core.reactionTemperature, core.maxReactTemperature) / core.maxReactTemperature;
int pixOffset = (int) (value * 108);
drawTexturedModalRect(11, 112 - pixOffset, 0, 222, 14, 5);
value = reactor.fieldCharge / reactor.maxFieldCharge;
value = core.fieldCharge / core.maxFieldCharge;
pixOffset = (int) (value * 108);
drawTexturedModalRect(35, 112 - pixOffset, 0, 222, 14, 5);
value = (double) reactor.energySaturation / (double) reactor.maxEnergySaturation;
value = (double) core.energySaturation / (double) core.maxEnergySaturation;
pixOffset = (int) (value * 108);
drawTexturedModalRect(199, 112 - pixOffset, 0, 222, 14, 5);
value = ((double) reactor.convertedFuel) / ((double) reactor.reactorFuel + (double) reactor.convertedFuel);
value = ((double) core.convertedFuel) / ((double) core.reactorFuel + (double) core.convertedFuel);
pixOffset = (int) (value * 108);
drawTexturedModalRect(223, 112 - pixOffset, 0, 222, 14, 5);
GL11.glColor4f(1F, 1F, 1F, 1F);
if (!showStats) {
if (showStatistics) {
ResourceHandler.bindResource("textures/gui/Reactor.png");
for (int i = 1; i <= 10; i++) {
drawTexturedModalRect(63, i * 12, 0, 240, 122, 16);
}
drawStatistics();
} else {
GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
GL11.glTranslated(124, 71, 100);
double scale = 100 / (reactor.getCoreDiameter());
double scale = 100 / (core.getCoreDiameter());
GL11.glScaled(scale, scale, scale);
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glDisable(GL11.GL_CULL_FACE);
TileEntityRendererDispatcher.instance.renderTileEntityAt(reactor, -0.5D, -0.5D, -0.5D, 0.0F);
TileEntityRendererDispatcher.instance.renderTileEntityAt(core, -0.5D, -0.5D, -0.5D, 0.0F);
GL11.glPopAttrib();
GL11.glPopMatrix();
} else {
ResourceHandler.bindResource("textures/gui/Reactor.png");
for (int i = 1; i <= 10; i++) drawTexturedModalRect(63, i * 12, 0, 240, 122, 16);
drawStats();
drawStatus();
}
String status = StatCollector.translateToLocal("gui.de.status.txt") + ": "
+ (reactor.reactorState == 0 ? EnumChatFormatting.DARK_GRAY
: reactor.reactorState == 1 ? EnumChatFormatting.RED
: reactor.reactorState == 2 ? EnumChatFormatting.DARK_GREEN : EnumChatFormatting.RED)
+ StatCollector.translateToLocal("gui.de.status" + reactor.reactorState + ".txt");
if (reactor.reactorState == 1 && reactor.canStart())
status = StatCollector.translateToLocal("gui.de.status.txt") + ": "
+ EnumChatFormatting.DARK_GREEN
+ StatCollector.translateToLocal("gui.de.status1_5.txt");
if (!showStats) fontRendererObj.drawString(status, xSize - 5 - fontRendererObj.getStringWidth(status), 125, 0);
}
@Override
public void drawScreen(int mouseX, int mouseY, float par3) {
super.drawScreen(mouseX, mouseY, par3);
List<String> text = new ArrayList<String>();
@SuppressWarnings("unchecked")
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
super.drawScreen(mouseX, mouseY, partialTicks);
List<String> text = new ArrayList<>();
if (GuiHelper.isInRect(9, 4, 18, 114, mouseX - guiLeft, mouseY - guiTop)) {
text.add(StatCollector.translateToLocal("gui.de.reactionTemp.txt"));
text.add((int) reactor.reactionTemperature + "C");
text.add((int) core.reactionTemperature + "C");
drawHoveringText(text, mouseX, mouseY, fontRendererObj);
} else if (GuiHelper.isInRect(33, 4, 18, 114, mouseX - guiLeft, mouseY - guiTop)) {
text.add(StatCollector.translateToLocal("gui.de.fieldStrength.txt"));
if (reactor.maxFieldCharge > 0)
text.add(Utills.round(reactor.fieldCharge / reactor.maxFieldCharge * 100D, 100D) + "%");
text.add(
Utills.addCommas((int) reactor.fieldCharge) + " / "
+ Utills.addCommas((int) reactor.maxFieldCharge)); // todo refine or remove
if (core.maxFieldCharge > 0) {
text.add(Utills.round(core.fieldCharge / core.maxFieldCharge * 100D, 100D) + "%");
}
text.add(Utills.addCommas((int) core.fieldCharge) + " / " + Utills.addCommas((int) core.maxFieldCharge));
drawHoveringText(text, mouseX, mouseY, fontRendererObj);
} else if (GuiHelper.isInRect(197, 4, 18, 114, mouseX - guiLeft, mouseY - guiTop)) {
text.add(StatCollector.translateToLocal("gui.de.energySaturation.txt"));
if (reactor.maxEnergySaturation > 0) text.add(
Utills.round((double) reactor.energySaturation / (double) reactor.maxEnergySaturation * 100D, 100D)
+ "%");
text.add(
Utills.addCommas(reactor.energySaturation) + " / " + Utills.addCommas(reactor.maxEnergySaturation)); // todo
// refine
// or
// remove
if (core.maxEnergySaturation > 0) {
text.add(
Utills.round((double) core.energySaturation / (double) core.maxEnergySaturation * 100D, 100D)
+ "%");
}
text.add(Utills.addCommas(core.energySaturation) + " / " + Utills.addCommas(core.maxEnergySaturation));
drawHoveringText(text, mouseX, mouseY, fontRendererObj);
} else if (GuiHelper.isInRect(221, 4, 18, 114, mouseX - guiLeft, mouseY - guiTop)) {
text.add(StatCollector.translateToLocal("gui.de.fuelConversion.txt"));
if (reactor.reactorFuel + reactor.convertedFuel > 0) text.add(
Utills.round(
((double) reactor.convertedFuel + reactor.conversionUnit)
/ ((double) reactor.convertedFuel + (double) reactor.reactorFuel)
* 100D,
100D) + "%");
text.add(reactor.convertedFuel + " / " + (reactor.convertedFuel + reactor.reactorFuel)); // todo refine or
// remove
if (core.reactorFuel + core.convertedFuel > 0) {
text.add(
Utills.round(
((double) core.convertedFuel + core.conversionUnit)
/ ((double) core.convertedFuel + (double) core.reactorFuel)
* 100D,
100D) + "%");
}
text.add(core.convertedFuel + " / " + (core.convertedFuel + core.reactorFuel));
drawHoveringText(text, mouseX, mouseY, fontRendererObj);
}
if (showStats) {
if (showStatistics) {
if (GuiHelper.isInRect(53, 15, 140, 18, mouseX - guiLeft, mouseY - guiTop)) {
text.addAll(
fontRendererObj.listFormattedStringToWidth(
@@ -247,19 +243,18 @@ public class GUIReactor extends GUIBase {
}
}
private void drawStats() {
double inputRate = reactor.fieldDrain / (1D - (reactor.fieldCharge / reactor.maxFieldCharge));
private void drawStatistics() {
double inputRate = core.fieldDrain / (1D - (core.fieldCharge / core.maxFieldCharge));
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.tempLoad.name"), 55, 16, 0x0000FF);
fontRendererObj.drawString(Utills.round(reactor.tempDrainFactor * 100D, 1D) + "%", 60, 2 + 24, 0);
fontRendererObj.drawString(Utills.round(core.tempDrainFactor * 100D, 1D) + "%", 60, 2 + 24, 0);
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.mass.name"), 55, 16 + 24, 0x0000FF);
fontRendererObj.drawString(
Utills.round((reactor.reactorFuel + reactor.convertedFuel) / 1296D, 100) + "m^3",
Utills.round((core.reactorFuel + core.convertedFuel) / 1296D, 100) + "m^3",
60,
2 + 2 * 24,
0);
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.genRate.name"), 55, 16 + 2 * 24, 0x0000FF);
fontRendererObj.drawString(Utills.addCommas((int) reactor.generationRate) + "RF/t", 60, 2 + 3 * 24, 0);
fontRendererObj.drawString(Utills.addCommas((int) core.generationRate) + "RF/t", 60, 2 + 3 * 24, 0);
fontRendererObj
.drawString(StatCollector.translateToLocal("gui.de.fieldInputRate.name"), 55, 16 + 3 * 24, 0x0000FF);
fontRendererObj
@@ -267,38 +262,45 @@ public class GUIReactor extends GUIBase {
fontRendererObj
.drawString(StatCollector.translateToLocal("gui.de.fuelConversion.name"), 55, 16 + 4 * 24, 0x0000FF);
fontRendererObj.drawString(
Utills.addCommas((int) Math.round(reactor.fuelUseRate * 1000000D)) + "nb/t",
Utills.addCommas((int) Math.round(core.fuelUseRate * 1000000D)) + "nb/t",
60,
2 + 5 * 24,
0);
}
private void drawStatus() {
String status = StatCollector.translateToLocal("gui.de.status.txt") + ": ";
switch (core.reactorState) {
case OFFLINE -> status += EnumChatFormatting.DARK_GRAY;
case STARTING, STOPPING -> status += EnumChatFormatting.RED;
case ONLINE -> status += EnumChatFormatting.DARK_GREEN;
case INVALID -> status += EnumChatFormatting.DARK_RED;
}
status += core.reactorState.toLocalizedString(core.canStart());
fontRendererObj.drawString(status, xSize - 5 - fontRendererObj.getStringWidth(status), 125, 0);
}
@Override
public void updateScreen() {
if (reactor.reactorState == TileReactorCore.STATE_INVALID
|| reactor.reactorState == TileReactorCore.STATE_OFFLINE
|| reactor.reactorState == TileReactorCore.STATE_STOP)
collection.getComponent("DEACTIVATE").setEnabled(false);
else collection.getComponent("DEACTIVATE").setEnabled(true);
if ((reactor.reactorState == TileReactorCore.STATE_OFFLINE
|| (reactor.reactorState == TileReactorCore.STATE_STOP && !reactor.canStart())) && reactor.canCharge())
collection.getComponent("CHARGE").setEnabled(true);
else collection.getComponent("CHARGE").setEnabled(false);
if ((reactor.reactorState == TileReactorCore.STATE_START || reactor.reactorState == TileReactorCore.STATE_STOP)
&& reactor.canStart())
collection.getComponent("ACTIVATE").setEnabled(true);
else collection.getComponent("ACTIVATE").setEnabled(false);
collection.getComponent("DEACTIVATE")
.setEnabled(core.reactorState == ReactorState.STARTING || core.reactorState == ReactorState.ONLINE);
collection.getComponent("CHARGE").setEnabled(
(core.reactorState == ReactorState.OFFLINE
|| (core.reactorState == ReactorState.STOPPING && !core.canStart())) && core.canCharge());
collection.getComponent("ACTIVATE").setEnabled(
(core.reactorState == ReactorState.STARTING || core.reactorState == ReactorState.STOPPING)
&& core.canStart());
super.updateScreen();
}
@Override
public void buttonClicked(int id, int button) {
super.buttonClicked(id, button);
if (id < 3) container.sendObjectToServer(null, 20, id);
else if (id == 3) {
showStats = !showStats;
((ComponentButton) collection.getComponent("STATS")).hoverText = showStats
if (id < 3) {
container.sendObjectToServer(null, 20, id);
} else if (id == 3) {
showStatistics = !showStatistics;
((ComponentButton) collection.getComponent("STATS")).hoverText = showStatistics
? StatCollector.translateToLocal("button.de.statsHide.txt")
: StatCollector.translateToLocal("button.de.statsShow.txt");
}
@@ -11,7 +11,13 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.util.StringUtils;
import com.brandon3055.brandonscore.client.gui.guicomponents.*;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentBase;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentButton;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentCollection;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentItemRenderer;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentTextField;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentTexturedRect;
import com.brandon3055.brandonscore.client.gui.guicomponents.GUIBase;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.DraconicEvolution;
@@ -6,7 +6,12 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.client.gui.guicomponents.*;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentButton;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentCollection;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentItemRenderer;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentSlotBackground;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentTexturedRect;
import com.brandon3055.brandonscore.client.gui.guicomponents.GUIBase;
import com.brandon3055.draconicevolution.common.container.ContainerAdvTool;
import com.brandon3055.draconicevolution.common.lib.References;
@@ -9,7 +9,11 @@ import java.util.Map;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.*;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
@@ -1,11 +1,20 @@
package com.brandon3055.draconicevolution.client.handler;
import java.awt.image.BufferedImage;
import java.io.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.imageio.ImageIO;
@@ -1,9 +1,13 @@
package com.brandon3055.draconicevolution.client.keybinding;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nonnull;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
@@ -12,12 +16,14 @@ import org.lwjgl.input.Mouse;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.items.tools.Magnet;
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHandler;
import com.brandon3055.draconicevolution.common.network.ButtonPacket;
import com.brandon3055.draconicevolution.common.network.MagnetTogglePacket;
import com.brandon3055.draconicevolution.common.network.PlacedItemPacket;
import com.brandon3055.draconicevolution.common.network.TeleporterPacket;
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utills.InventoryUtils;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent;
@@ -32,43 +38,56 @@ public class KeyInputHandler {
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
if (KeyBindings.placeItem.isPressed()) {
handlePlaceItemKey();
} else if (KeyBindings.toolConfig.isPressed()) {
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOLCONFIG, false));
} else if (KeyBindings.toolProfileChange.isPressed() && Minecraft.getMinecraft().thePlayer != null
&& Minecraft.getMinecraft().thePlayer.getItemInUse() == null) {
DraconicEvolution.network
.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOL_PROFILE_CHANGE, false));
handleToolConfigKey();
} else if (KeyBindings.toolProfileChange.isPressed() && player != null && player.getItemInUse() == null) {
handleToolProfileChangeKey(player);
} else if (KeyBindings.toggleFlight.isPressed() && player != null) {
handleToggleFlightKey(player);
} else if (KeyBindings.toggleMagnet.isPressed()) {
handleToggleMagnetKey(player);
}
}
ItemStack stack = Minecraft.getMinecraft().thePlayer.getHeldItem();
if (stack != null && stack.getItem() instanceof IConfigurableItem
&& ((IConfigurableItem) stack.getItem()).hasProfiles()) {
int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0);
if (++preset >= 5) preset = 0;
ItemNBTHelper.setInteger(stack, "ConfigProfile", preset);
}
} else
if (KeyBindings.toggleFlight.isPressed()) {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (player.capabilities.allowFlying) {
if (player.capabilities.isFlying) {
player.capabilities.isFlying = false;
} else {
player.capabilities.isFlying = true;
if (player.onGround) {
player.setPosition(player.posX, player.posY + 0.05D, player.posZ);
player.motionY = 0;
}
}
player.sendPlayerAbilities();
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onMouseInput(InputEvent.MouseInputEvent event) {
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
if (KeyBindings.placeItem.isPressed()) {
handlePlaceItemKey();
} else if (KeyBindings.toolConfig.isPressed()) {
handleToolConfigKey();
} else if (KeyBindings.toolProfileChange.isPressed() && player != null) {
handleToolProfileChangeKey(player);
} else if (KeyBindings.toggleFlight.isPressed() && player != null) {
handleToggleFlightKey(player);
} else if (KeyBindings.toggleMagnet.isPressed()) {
handleToggleMagnetKey(player);
}
if (player != null) {
int change = Mouse.getEventDWheel();
if (change == 0 || !player.isSneaking()) return;
if (change > 0) {
ItemStack item = player.inventory.getStackInSlot(previousSlot(1, player.inventory.currentItem));
if (item != null && Objects.equals(item.getItem(), ModItems.teleporterMKII)) {
player.inventory.currentItem = previousSlot(1, player.inventory.currentItem);
DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.SCROLL, -1, false));
}
} else if (KeyBindings.toggleMagnet.isPressed()) {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (player.inventory.hasItem(ModItems.magnet)) {
DraconicEvolution.network.sendToServer(new MagnetTogglePacket());
} else {
ItemStack item = player.inventory.getStackInSlot(previousSlot(-1, player.inventory.currentItem));
if (item != null && Objects.equals(item.getItem(), ModItems.teleporterMKII)) {
player.inventory.currentItem = previousSlot(-1, player.inventory.currentItem);
DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.SCROLL, 1, false));
}
}
}
}
private void handlePlaceItemKey() {
@@ -81,45 +100,46 @@ public class KeyInputHandler {
}
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onMouseInput(InputEvent.MouseInputEvent event) {
if (KeyBindings.placeItem.isPressed()) {
handlePlaceItemKey();
} else if (KeyBindings.toolConfig.isPressed()) {
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOLCONFIG, false));
} else if (KeyBindings.toolProfileChange.isPressed() && Minecraft.getMinecraft().thePlayer != null) {
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOL_PROFILE_CHANGE, false));
private void handleToolConfigKey() {
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOLCONFIG, false));
}
ItemStack stack = Minecraft.getMinecraft().thePlayer.getHeldItem();
if (stack != null && stack.getItem() instanceof IConfigurableItem
&& ((IConfigurableItem) stack.getItem()).hasProfiles()) {
int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0);
if (++preset >= 5) preset = 0;
ItemNBTHelper.setInteger(stack, "ConfigProfile", preset);
}
}
private void handleToolProfileChangeKey(@Nonnull EntityClientPlayerMP player) {
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOL_PROFILE_CHANGE, false));
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
int change = Mouse.getEventDWheel();
if (change == 0 || !player.isSneaking()) return;
if (change > 0) {
ItemStack item = player.inventory.getStackInSlot(previouseSlot(1, player.inventory.currentItem));
if (item != null && item.getItem().equals(ModItems.teleporterMKII)) {
player.inventory.currentItem = previouseSlot(1, player.inventory.currentItem);
DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.SCROLL, -1, false));
}
} else {
ItemStack item = player.inventory.getStackInSlot(previouseSlot(-1, player.inventory.currentItem));
if (item != null && item.getItem().equals(ModItems.teleporterMKII)) {
player.inventory.currentItem = previouseSlot(-1, player.inventory.currentItem);
DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.SCROLL, 1, false));
}
ItemStack stack = player.getHeldItem();
if (stack != null && stack.getItem() instanceof IConfigurableItem
&& ((IConfigurableItem) stack.getItem()).hasProfiles()) {
int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0);
if (++preset >= 5) preset = 0;
ItemNBTHelper.setInteger(stack, "ConfigProfile", preset);
}
}
private int previouseSlot(int i, int c) {
private void handleToggleFlightKey(@Nonnull EntityClientPlayerMP player) {
if (player.capabilities.allowFlying) {
if (player.capabilities.isFlying) {
player.capabilities.isFlying = false;
} else {
player.capabilities.isFlying = true;
if (player.onGround) {
player.setPosition(player.posX, player.posY + 0.05D, player.posZ);
player.motionY = 0;
}
}
player.sendPlayerAbilities();
}
}
private void handleToggleMagnetKey(EntityClientPlayerMP player) {
Optional<ItemStack> magnetOptional = InventoryUtils.getItemInAnyPlayerInventory(player, Magnet.class);
if (magnetOptional.isPresent()) {
DraconicEvolution.network.sendToServer(new MagnetTogglePacket());
}
}
private int previousSlot(int i, int c) {
if (c > 0 && c < 8) return c + i;
if (c == 0 && i < 0) return 8;
if (c == 8 && i > 0) return 0;
@@ -1,45 +0,0 @@
package com.brandon3055.draconicevolution.client.render.block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileEarth;
/**
* Created by brandon3055 on 30/7/2015.
*/
public class RenderEarthItem implements IItemRenderer {
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
GL11.glPushMatrix();
if (type == ItemRenderType.INVENTORY) GL11.glRotated(180, 0, 1, 0);
else if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
GL11.glTranslated(0.5, 0.5, 0.5);
if (type == ItemRenderType.EQUIPPED) GL11.glRotated(90, 0, 1, 0);
}
ResourceHandler.bindResource("textures/models/Earth.png");
GL11.glScaled(0.01, 0.01, 0.01);
GL11.glRotatef(-180, 1F, 0F, 1F);
GL11.glRotatef(90, 1F, 0F, 0F);
GL11.glRotatef((System.currentTimeMillis() / 64) % 360, 0F, 0F, 1F);
RenderTileEarth.modelCustom.renderAll();
GL11.glPopMatrix();
}
}
@@ -1,6 +1,5 @@
package com.brandon3055.draconicevolution.client.render.block;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -34,7 +33,6 @@ public class RenderParticleGen implements IItemRenderer {
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
if (type == IItemRenderer.ItemRenderType.ENTITY) GL11.glTranslatef(-0.5F, 0.0F, -0.5F);
TileEntityRendererDispatcher.instance.renderTileEntityAt(tile, 0.0D, 0.0D, 0.0D, 0.0F);
RenderHelper.disableStandardItemLighting();
GL11.glPopAttrib();
GL11.glPopMatrix();
}
@@ -9,6 +9,7 @@ import net.minecraft.world.IBlockAccess;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.lib.References;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
/**
@@ -9,6 +9,7 @@ import org.lwjgl.opengl.GL11;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
/**
@@ -15,11 +15,10 @@ import com.brandon3055.draconicevolution.common.utills.LogHelper;
public class RenderMobSoul implements IItemRenderer {
private Minecraft mc;
private Entity randomEntity = null;
private String[] randomEntitys = new String[] { "Pig", "Sheep", "Enderman", "Zombie", "Creeper", "Cow", "Chicken",
"Ozelot", "Witch", "Wolf", "MushroomCow", "Squid", "EntityHorse", "Spider", "Skeleton", "Blaze", "Bat",
"Villager", "Silverfish" };
private final Minecraft mc;
private final String[] randomEntities = new String[] { "Pig", "Sheep", "Enderman", "Zombie", "Creeper", "Cow",
"Chicken", "Ozelot", "Witch", "Wolf", "MushroomCow", "Squid", "EntityHorse", "Spider", "Skeleton", "Blaze",
"Bat", "Villager", "Silverfish" };
public RenderMobSoul() {
this.mc = Minecraft.getMinecraft();
@@ -40,8 +39,8 @@ public class RenderMobSoul implements IItemRenderer {
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
Entity mob = EntityList.createEntityByName(ItemNBTHelper.getString(item, "Name", "Pig"), mc.theWorld);
randomEntity = EntityList
.createEntityByName(randomEntitys[(int) ((Minecraft.getSystemTime() / 1000) % 18)], mc.theWorld);
Entity randomEntity = EntityList
.createEntityByName(randomEntities[(int) ((Minecraft.getSystemTime() / 1000) % 18)], mc.theWorld);
if (ItemNBTHelper.getString(item, "Name", "Pig").equals("Any")) mob = randomEntity;
if (mob instanceof EntitySkeleton)
((EntitySkeleton) mob).setSkeletonType(ItemNBTHelper.getInteger(item, "SkeletonType", 0));
@@ -3,7 +3,6 @@ package com.brandon3055.draconicevolution.client.render.particle;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import org.lwjgl.opengl.GL11;
@@ -11,7 +10,6 @@ import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart;
import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorEnergyInjector;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorStabilizer;
import cpw.mods.fml.relauncher.Side;
@@ -23,16 +21,10 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleReactorBeam extends EntityFX {
/**
* Particle Type 0 = Energy Ring, 1 = single particle
*/
private boolean renderParticle = true;
private TileEntity tile;
private boolean isInjectorBeam = false;
private final TileEntity tile;
public ParticleReactorBeam(TileEntity tile) {
super(tile.getWorldObj(), tile.xCoord + 0.5, tile.yCoord + 0.5, tile.zCoord + 0.5, 0.0D, 0.0D, 0.0D);
super(tile.getWorldObj(), tile.xCoord + 0.5, tile.yCoord + 0.5, tile.zCoord + 0.5, 0.0, 0.0, 0.0);
this.tile = tile;
this.particleRed = 1F;
this.particleGreen = 1F;
@@ -43,16 +35,16 @@ public class ParticleReactorBeam extends EntityFX {
this.motionZ = 0.0D;
this.particleMaxAge = 4;
this.setSize(1F, 1F);
isInjectorBeam = tile instanceof TileReactorEnergyInjector;
}
public void update(boolean render) {
for (this.renderParticle = render; this.particleMaxAge - this.particleAge < 4; ++this.particleMaxAge) {}
public void update() {
if (this.particleMaxAge - this.particleAge < 4) {
this.particleMaxAge = this.particleAge + 4;
}
}
@Override
public void onUpdate() {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
@@ -65,137 +57,102 @@ public class ParticleReactorBeam extends EntityFX {
@Override
public void renderParticle(Tessellator tessellator, float partialTick, float rotX, float rotXZ, float rotZ,
float rotYZ, float rotXY) {
if (!((IReactorPart) tile).isActive()) return;
if (!((IReactorPart) tile).isActive()) {
return;
}
tessellator.draw();
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.0F);
float xx = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) partialTick - interpPosX);
float yy = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) partialTick - interpPosY);
float zz = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) partialTick - interpPosZ);
GL11.glTranslated((double) xx, (double) yy, (double) zz);
double shiftX = this.prevPosX + (this.posX - this.prevPosX) * partialTick - interpPosX;
double shiftY = this.prevPosY + (this.posY - this.prevPosY) * partialTick - interpPosY;
double shiftZ = this.prevPosZ + (this.posZ - this.prevPosZ) * partialTick - interpPosZ;
GL11.glTranslated(shiftX, shiftY, shiftZ);
// Common Fields
MultiblockHelper.TileLocation master = ((IReactorPart) tile).getMaster();
float offsetX = (float) (master.posX - tile.xCoord);
float offsetY = (float) ((double) master.posY - tile.yCoord);
float offsetZ = (float) (master.posZ - tile.zCoord);
float length = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ);
MultiblockHelper.TileLocation master = ((IReactorPart) tile).getMasterLocation();
double offsetX = master.posX - tile.xCoord;
double offsetY = master.posY - tile.yCoord;
double offsetZ = master.posZ - tile.zCoord;
double offsetLength = Math.sqrt(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ);
double diagonalLength = Math.sqrt(offsetX * offsetX + offsetZ * offsetZ);
// Rotate beam to face target
float f7 = MathHelper.sqrt_float(offsetX * offsetX + offsetZ * offsetZ);
GL11.glRotatef(
(float) (-Math.atan2((double) offsetZ, (double) offsetX)) * 180.0F / (float) Math.PI - 90.0F,
0.0F,
1.0F,
0.0F);
GL11.glRotatef(
(float) (-Math.atan2((double) f7, (double) offsetY)) * 180.0F / (float) Math.PI - 90.0F,
1.0F,
0.0F,
0.0F);
GL11.glRotated(Math.toDegrees(-Math.atan2(offsetZ, offsetX)) - 90.0, 0.0, 1.0, 0.0);
GL11.glRotated(Math.toDegrees(-Math.atan2(diagonalLength, offsetY)) - 90.0, 1.0, 0.0, 0.0);
TileReactorCore reactor = ((IReactorPart) tile).getMaster().getTileEntity(worldObj) instanceof TileReactorCore
? (TileReactorCore) ((IReactorPart) tile).getMaster().getTileEntity(worldObj)
: null;
if (tile instanceof TileReactorStabilizer && reactor != null)
renderStabilizerEffect(tessellator, reactor, offsetX, offsetY, offsetZ, length, partialTick);
else if (reactor != null) {
TileReactorCore core = ((IReactorPart) tile).getMaster();
if (tile instanceof TileReactorStabilizer && core != null)
renderStabilizerEffect(tessellator, core, offsetLength, partialTick);
else if (core != null) {
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glTranslated(0, 0, 0.3);
// GL11.glPushMatrix();
GL11.glRotatef(((float) particleAge + partialTick) * 20F, 0, 0, 1);
GL11.glTranslated(0.0, 0.0, 0.3);
GL11.glRotatef(((float) particleAge + partialTick) * 20F, 0F, 0F, 1F);
ResourceHandler.bindResource("textures/particle/reactorEnergyBeam.png");
// float sizeOrigin = 0.5F;
// float sizeTarget = 0.2F;
float sizeOrigin = 0.5F;
double sizeOrigin = 0.5;
int color = 0xFF2200;
int alpha = (int) (200D * reactor.renderSpeed);
int alpha = (int) (200.0 * core.renderSpeed);
float speed = 20F;
float texV2 = 0.0F + ((float) particleAge + partialTick) * 0.01F * speed;
float texV1 = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ)
+ ((float) particleAge + partialTick) * 0.01F * speed;
double speed = 20.0;
double texV2 = ((double) particleAge + partialTick) * 0.01 * speed;
double texV1 = offsetLength + texV2;
tessellator.startDrawing(5);
tessellator.startDrawing(GL11.GL_TRIANGLE_STRIP);
tessellator.setBrightness(200);
float sizeTarget = 0.1F;
double sizeTarget = 0.1;
byte b0 = 16;
length = 0F;
for (int i = 0; i <= b0; ++i) {
float verX = MathHelper.sin((float) (i % b0) * (float) Math.PI * 2.3F / (float) b0) * sizeTarget;
float verY = MathHelper.cos((float) (i % b0) * (float) Math.PI * 2.3F / (float) b0) * sizeTarget;
float texU = (float) (i % b0) * 1.0F / (float) b0;
tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0);
final int raysCount = 16;
for (int ray = 0; ray <= raysCount; ++ray) {
double texU = (double) ray / raysCount;
double verX = Math.sin(texU * Math.PI * 2.3) * sizeTarget;
double verY = Math.cos(texU * Math.PI * 2.3) * sizeTarget;
tessellator.addVertexWithUV(
(double) (verX * sizeOrigin),
(double) (verY * sizeOrigin),
-0.55D,
(double) texU,
(double) texV1);
tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha);
tessellator
.addVertexWithUV((double) verX, (double) verY, (double) length, (double) texU, (double) texV2);
tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, color & 0xFF, 0);
tessellator.addVertexWithUV(verX * sizeOrigin, verY * sizeOrigin, -0.55, texU, texV1);
tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, color & 0xFF, alpha);
tessellator.addVertexWithUV(verX, verY, offsetLength, texU, texV2);
}
length = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ)
- (float) (reactor.getCoreDiameter() / 2D)
- 0.3F;
sizeTarget = (float) (reactor.getCoreDiameter() / 2 * 0.2D);
sizeOrigin = 0.1F / sizeTarget;
offsetLength -= core.getCoreRadius() + 0.3;
sizeTarget = core.getCoreRadius() * 0.2;
sizeOrigin = 0.1 / sizeTarget;
for (int i = 0; i <= b0; ++i) {
float verX = MathHelper.sin((float) (i % b0) * (float) Math.PI * 2.13F / (float) b0) * sizeTarget;
float verY = MathHelper.cos((float) (i % b0) * (float) Math.PI * 2.13F / (float) b0) * sizeTarget;
float texU = (float) (i % b0) * 1.0F / (float) b0;
tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha);
for (int ray = 0; ray <= raysCount; ray++) {
double texU = (double) ray / raysCount;
double verX = Math.sin(texU * Math.PI * 2.13) * sizeTarget;
double verY = Math.cos(texU * Math.PI * 2.13) * sizeTarget;
tessellator.addVertexWithUV(
(double) (verX * sizeOrigin),
(double) (verY * sizeOrigin),
0.0D,
(double) texU,
(double) texV1);
tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, color & 0xFF, alpha);
tessellator.addVertexWithUV(verX * sizeOrigin, verY * sizeOrigin, 0.0, texU, texV1);
tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0);
tessellator
.addVertexWithUV((double) verX, (double) verY, (double) length, (double) texU, (double) texV2);
tessellator.addVertexWithUV(verX, verY, offsetLength, texU, texV2);
}
tessellator.draw();
// GL11.glPopMatrix();
GL11.glRotatef(((float) particleAge + partialTick) * -30F, 0, 0, 1);
GL11.glRotatef(((float) particleAge + partialTick) * -30F, 0F, 0F, 1F);
tessellator.startDrawing(5);
tessellator.startDrawing(GL11.GL_TRIANGLE_STRIP);
tessellator.setBrightness(200);
color = 0xFF4400;
sizeTarget = (float) (reactor.getCoreDiameter() / 2 * 0.6D);
sizeOrigin = 0.1F / sizeTarget;
length += 0.4F;
sizeTarget = core.getCoreRadius() * 0.6;
sizeOrigin = 0.1 / sizeTarget;
offsetLength += 0.4;
GL11.glTranslated(0, 0, -0.1);
for (int i = 0; i <= b0; ++i) {
float verX = MathHelper.sin((float) (i % b0) * (float) Math.PI * 2.13F / (float) b0) * sizeTarget;
float verY = MathHelper.cos((float) (i % b0) * (float) Math.PI * 2.13F / (float) b0) * sizeTarget;
float texU = (float) (i % b0) * 1.0F / (float) b0;
tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha / 2);
for (int ray = 0; ray <= raysCount; ray++) {
double texU = (double) ray / raysCount;
double verX = Math.sin(texU * Math.PI * 2.13F) * sizeTarget;
double verY = Math.cos(texU * Math.PI * 2.13F) * sizeTarget;
tessellator.addVertexWithUV(
(double) (verX * sizeOrigin),
(double) (verY * sizeOrigin),
0.0D,
(double) texU,
(double) texV1);
tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0);
tessellator
.addVertexWithUV((double) verX, (double) verY, (double) length, (double) texU, (double) texV2);
tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, color & 0xFF, alpha / 2);
tessellator.addVertexWithUV(verX * sizeOrigin, verY * sizeOrigin, 0.0, texU, texV1);
tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, color & 0xFF, 0);
tessellator.addVertexWithUV(verX, verY, offsetLength, texU, texV2);
}
tessellator.draw();
@@ -208,44 +165,28 @@ public class ParticleReactorBeam extends EntityFX {
tessellator.startDrawingQuads();
}
private void renderStabilizerEffect(Tessellator tessellator, TileReactorCore reactor, float offsetX, float offsetY,
float offsetZ, float length, float partialTick) {
private void renderStabilizerEffect(Tessellator tessellator, TileReactorCore core, double offsetLength,
float partialTick) {
GL11.glShadeModel(GL11.GL_SMOOTH);
// Draw Beams
GL11.glPushMatrix();
GL11.glTranslated(0, 0, -0.35);
GL11.glTranslated(0.0, 0.0, -0.35);
ResourceHandler.bindResource("textures/particle/reactorBeam.png");
drawBeam(
tessellator,
reactor,
1F,
0.355F,
0.8F,
offsetX,
offsetY,
offsetZ,
particleAge,
partialTick,
true,
false,
0x00ffff);
drawBeam(tessellator, core, 1.0, 0.355, 0.8, offsetLength, partialTick, true, false, 0x00ffff);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(0, 0, 0.45);
float coreSize = (float) (reactor.getCoreDiameter() / 2) * 0.9F;
float s = 0.355F;
GL11.glTranslated(0.0, 0.0, 0.45);
double coreSize = core.getCoreRadius() * 0.9;
double scale = 0.355;
drawBeam(
tessellator,
reactor,
s / coreSize,
core,
scale / coreSize,
coreSize,
length - (float) (reactor.getCoreDiameter() / 2.5D),
offsetX,
offsetY,
offsetZ,
particleAge,
offsetLength - core.getCoreDiameter() / 2.5,
offsetLength,
partialTick,
false,
false,
@@ -253,37 +194,21 @@ public class ParticleReactorBeam extends EntityFX {
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(0, 0, -0.35);
drawBeam(
tessellator,
reactor,
1F,
0.263F,
0.8F,
offsetX,
offsetY,
offsetZ,
particleAge,
partialTick,
true,
true,
0xff6600);
GL11.glTranslated(0.0, 0.0, -0.35);
drawBeam(tessellator, core, 1.0, 0.263, 0.8, offsetLength, partialTick, true, true, 0xff6600);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(0, 0, 0.45);
coreSize = (float) (reactor.getCoreDiameter() / 2) * 0.4F;
s = 0.263F;
GL11.glTranslated(0.0, 0.0, 0.45);
coreSize = core.getCoreRadius() * 0.4;
scale = 0.263;
drawBeam(
tessellator,
reactor,
s / coreSize,
core,
scale / coreSize,
coreSize,
length - 0.5F,
offsetX,
offsetY,
offsetZ,
particleAge,
offsetLength - 0.5,
offsetLength,
partialTick,
false,
true,
@@ -297,160 +222,36 @@ public class ParticleReactorBeam extends EntityFX {
* Size Origin is the fraction of size start Target So if size target is 10 and size origin is 0.5 origin will
* actually be 5
*/
private void drawBeam(Tessellator tessellator, TileReactorCore reactor, float sizeOrigin, float sizeTarget,
float length, float offsetX, float offsetY, float offsetZ, int tick, float partialTick,
boolean reverseTransparency, boolean reverseDirection, int color) {
float speed = 3F;
float texV2 = -0.1F + ((float) tick + partialTick) * (reverseDirection ? -0.01F : 0.01F) * speed;
float texV1 = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ) / 32.0F
+ ((float) tick + partialTick) * (reverseDirection ? -0.01F : 0.01F) * speed;
private void drawBeam(Tessellator tessellator, TileReactorCore core, double sizeOrigin, double sizeTarget,
double length, double offsetLength, float partialTick, boolean reverseTransparency,
boolean reverseDirection, int color) {
final double speed = 3.0;
final double tickOffset = ((double) particleAge + partialTick) * (reverseDirection ? -0.01 : 0.01) * speed;
tessellator.startDrawing(5);
double texV1 = offsetLength / 32.0 + tickOffset;
double texV2 = -0.1 + tickOffset;
tessellator.startDrawing(GL11.GL_TRIANGLE_STRIP);
tessellator.setBrightness(200);
byte b0 = 16;
for (int i = 0; i <= b0; ++i) {
float verX = MathHelper.sin((float) (i % b0) * (float) Math.PI * 2.13325F / (float) b0) * sizeTarget;
float verY = MathHelper.cos((float) (i % b0) * (float) Math.PI * 2.13325F / (float) b0) * sizeTarget;
float texU = (float) (i % b0) * 1.0F / (float) b0;
final int raysCount = 16;
for (int ray = 0; ray <= raysCount; ++ray) {
double texU = (double) ray / raysCount;
double verX = Math.sin(texU * Math.PI * 2.13325) * sizeTarget;
double verY = Math.cos(texU * Math.PI * 2.13325) * sizeTarget;
tessellator.setColorRGBA(
(color & 0xFF0000) >> 16,
(color & 0xFF00) >> 8,
(color & 0xFF),
reverseTransparency ? 0 : (int) (255D * reactor.renderSpeed));
tessellator.addVertexWithUV(
(double) (verX * sizeOrigin),
(double) (verY * sizeOrigin),
0.0D,
(double) texU,
(double) texV1);
color & 0xFF,
reverseTransparency ? 0 : (int) (255.0 * core.renderSpeed));
tessellator.addVertexWithUV(verX * sizeOrigin, verY * sizeOrigin, 0.0, texU, texV1);
tessellator.setColorRGBA(
(color & 0xFF0000) >> 16,
(color & 0xFF00) >> 8,
(color & 0xFF),
reverseTransparency ? (int) (255D * reactor.renderSpeed) : 0);
tessellator.addVertexWithUV((double) verX, (double) verY, (double) length, (double) texU, (double) texV2);
color & 0xFF,
reverseTransparency ? (int) (255.0 * core.renderSpeed) : 0);
tessellator.addVertexWithUV(verX, verY, length, texU, texV2);
}
tessellator.draw();
}
}
// @Override
// public void renderParticle(Tessellator tessellator, float partialTick, float rotX, float rotXZ, float rotZ, float
// rotYZ, float rotXY) {
// if (!((IIsSlave)tile).isActive()) return;
// tessellator.draw();
// GL11.glPushMatrix();
// GL11.glDisable(GL11.GL_CULL_FACE);
// GL11.glAlphaFunc(GL11.GL_GREATER, 0.0F);
//
// float xx = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTick - interpPosX);
// float yy = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTick - interpPosY);
// float zz = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTick - interpPosZ);
// GL11.glTranslated((double)xx, (double)yy, (double)zz);
//
// //Common Fields
// MultiblockHelper.TileLocation master = ((IIsSlave)tile).getMaster();
// float offsetX = (float)(master.posX - tile.xCoord);
// float offsetY = (float)((double)master.posY - tile.yCoord);
// float offsetZ = (float)(master.posZ - tile.zCoord);
// float length = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ);
//
//
// //Rotate beam to face target
// float f7 = MathHelper.sqrt_float(offsetX * offsetX + offsetZ * offsetZ);
// GL11.glRotatef((float) (-Math.atan2((double) offsetZ, (double) offsetX)) * 180.0F / (float) Math.PI - 90.0F, 0.0F,
// 1.0F, 0.0F);
// GL11.glRotatef((float)(-Math.atan2((double)f7, (double)offsetY)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F,
// 0.0F);
//
// if (tile instanceof TileReactorStabilizer) renderStabilizerEffect(tessellator, offsetX, offsetY, offsetZ, length,
// partialTick);
// else {
// GL11.glShadeModel(GL11.GL_SMOOTH);
// GL11.glTranslated(0, 0, 0.3);
// //GL11.glPushMatrix();
// GL11.glRotatef(((float)particleAge + partialTick)*20F, 0, 0, 1);
// ResourceHandler.bindResource("textures/particle/reactorEnergyBeam.png");
//// float sizeOrigin = 0.5F;
//// float sizeTarget = 0.2F;
// float sizeTarget = 0.2F;
// float sizeOrigin = 0.5F;
//
// int color = 0xFF2200;
// int alpha = 200;
// length -= 1;
//
// float speed = 20F;
// float texV2 = 0.0F + ((float)particleAge + partialTick) * 0.01F * speed;
// float texV1 = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ) +
// ((float)particleAge + partialTick) * 0.01F * speed;
//
// tessellator.startDrawing(5);
// tessellator.setBrightness(200);
//
// byte b0 = 16;
// for (int i = 0; i <= b0; ++i)
// {
// float verX = MathHelper.sin((float)(i % b0) * (float)Math.PI * 2.13F / (float)b0) * sizeTarget;
// float verY = MathHelper.cos((float)(i % b0) * (float)Math.PI * 2.13F / (float)b0) * sizeTarget;
// float texU = (float)(i % b0) * 1.0F / (float)b0;
// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha);
//
// tessellator.addVertexWithUV((double)(verX * sizeOrigin), (double)(verY * sizeOrigin), 0.0D, (double)texU,
// (double)texV1);
// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0);
// tessellator.addVertexWithUV((double)verX, (double)verY, (double)length, (double)texU, (double)texV2);
// }
//
// sizeTarget = 0.1F;
//
// length = 0F;
// for (int i = 0; i <= b0; ++i)
// {
// float verX = MathHelper.sin((float)(i % b0) * (float)Math.PI * 2.3F / (float)b0) * sizeTarget;
// float verY = MathHelper.cos((float)(i % b0) * (float)Math.PI * 2.3F / (float)b0) * sizeTarget;
// float texU = (float)(i % b0) * 1.0F / (float)b0;
// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0);
//
// tessellator.addVertexWithUV((double)(verX * sizeOrigin), (double)(verY * sizeOrigin), -0.55D, (double)texU,
// (double)texV1);
// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha);
// tessellator.addVertexWithUV((double)verX, (double)verY, (double)length, (double)texU, (double)texV2);
// }
//
// tessellator.draw();
// //GL11.glPopMatrix();
// GL11.glRotatef(((float)particleAge + partialTick)*-30F, 0, 0, 1);
//
// tessellator.startDrawing(5);
// tessellator.setBrightness(200);
// color = 0xFF4400;
// sizeOrigin = 0.15F;
// sizeTarget = 0.6F;
// length = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ) - 1;
// GL11.glTranslated(0, 0, -0.1);
//
// for (int i = 0; i <= b0; ++i)
// {
// float verX = MathHelper.sin((float)(i % b0) * (float)Math.PI * 2.13F / (float)b0) * sizeTarget;
// float verY = MathHelper.cos((float)(i % b0) * (float)Math.PI * 2.13F / (float)b0) * sizeTarget;
// float texU = (float)(i % b0) * 1.0F / (float)b0;
// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha/2);
//
// tessellator.addVertexWithUV((double)(verX * sizeOrigin), (double)(verY * sizeOrigin), 0.0D, (double)texU,
// (double)texV1);
// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0);
// tessellator.addVertexWithUV((double)verX, (double)verY, (double)length, (double)texU, (double)texV2);
// }
//
// tessellator.draw();
// GL11.glShadeModel(GL11.GL_FLAT);
// }
//
// GL11.glPopMatrix();
// GL11.glEnable(GL11.GL_CULL_FACE);
// ResourceHandler.bindDefaultParticles();
// tessellator.startDrawingQuads();
// }
@@ -1,6 +1,13 @@
package com.brandon3055.draconicevolution.client.render.tile;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL11.glColor4f;
import static org.lwjgl.opengl.GL11.glDisable;
import static org.lwjgl.opengl.GL11.glEnable;
import static org.lwjgl.opengl.GL11.glPopMatrix;
import static org.lwjgl.opengl.GL11.glPushMatrix;
import static org.lwjgl.opengl.GL11.glRotatef;
import static org.lwjgl.opengl.GL11.glScalef;
import static org.lwjgl.opengl.GL11.glTranslatef;
import java.util.Random;
@@ -1,66 +0,0 @@
package com.brandon3055.draconicevolution.client.render.tile;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEarth;
import cpw.mods.fml.client.FMLClientHandler;
/**
* Created by Brandon on 27/07/2014.
*/
public class RenderTileEarth extends TileEntitySpecialRenderer {
private static final ResourceLocation iner_model_texture = new ResourceLocation(
References.MODID.toLowerCase(),
"textures/models/Earth.png");
public static IModelCustom modelCustom;
public RenderTileEarth() {
modelCustom = AdvancedModelLoader
.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/Earth.obj"));
}
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float timeSinceLastTick) {
if (!(tile instanceof TileEarth)) return;
TileEarth tileEarth = (TileEarth) tile;
float scale = 0.01f * tileEarth.getSize();
GL11.glPushMatrix();
GL11.glColor4f(1F, 1F, 1F, 1F);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 150f, 150f);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(iner_model_texture);
float brightness = (float) Math.abs(Math.sin((float) Minecraft.getSystemTime() / 3000f) * 100f);
GL11.glScalef(scale, scale, scale);
GL11.glPushMatrix();
GL11.glRotatef(-180, 1F, 0F, 1F);
GL11.glRotatef(90, 1F, 0F, 0F);
if (tileEarth.getRotationSpeed() != 0) {
GL11.glRotatef((System.currentTimeMillis() / tileEarth.getRotationSpeed()) % 360, 0F, 0F, 1F);
}
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 80f + brightness, 80f + brightness);
modelCustom.renderAll();
GL11.glPopMatrix();
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
}
@@ -17,10 +17,10 @@ import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.Til
*/
public class RenderTileEnergyPylon extends TileEntitySpecialRenderer {
private static final ResourceLocation model_texture = new ResourceLocation(
private static final ResourceLocation modelTexture = new ResourceLocation(
References.MODID.toLowerCase(),
"textures/models/pylon_sphere_texture.png");
private IModelCustom model;
private final IModelCustom model;
public RenderTileEnergyPylon() {
model = AdvancedModelLoader
@@ -30,10 +30,13 @@ public class RenderTileEnergyPylon extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float timeSinceLastTick) {
if (tile == null || !(tile instanceof TileEnergyPylon)) return;
TileEnergyPylon pylon = (TileEnergyPylon) tile;
if (!pylon.active) return;
float scale = pylon.modelScale + (timeSinceLastTick *= !pylon.reciveEnergy ? -0.01F : 0.01F);
if (!(tile instanceof TileEnergyPylon pylon)) {
return;
}
if (!pylon.active) {
return;
}
float scale = pylon.modelScale + (timeSinceLastTick *= !pylon.isReceivingEnergy ? -0.01F : 0.01F);
float rotation = pylon.modelRotation + (timeSinceLastTick / 2F);
GL11.glPushMatrix();
@@ -48,7 +51,7 @@ public class RenderTileEnergyPylon extends TileEntitySpecialRenderer {
GL11.glAlphaFunc(GL11.GL_GREATER, 0.0F);
bindTexture(model_texture);
bindTexture(modelTexture);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
GL11.glDisable(GL11.GL_LIGHTING);
@@ -59,37 +62,10 @@ public class RenderTileEnergyPylon extends TileEntitySpecialRenderer {
GL11.glDepthMask(false);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F);
GL11.glPushMatrix();
float scale1 = scale % 1F;
GL11.glScalef(scale1, scale1, scale1);
GL11.glRotatef(rotation * 0.5F, 0F, -1F, -0.5F);
GL11.glColor4d(1D, 1D, 1D, 1F - (scale1));
model.renderAll();
GL11.glPopMatrix();
GL11.glPushMatrix();
float scale2 = (scale + 0.25F) % 1F;
GL11.glScalef(scale2, scale2, scale2);
GL11.glRotatef(rotation * 0.5F, 0F, -1F, -0.5F);
GL11.glColor4f(1F, 1F, 1F, 1F - (scale2));
model.renderAll();
GL11.glPopMatrix();
GL11.glPushMatrix();
float scale3 = (scale + 0.5F) % 1F;
GL11.glScalef(scale3, scale3, scale3);
GL11.glRotatef(rotation * 0.5F, 0F, -1F, -0.5F);
GL11.glColor4f(1F, 1F, 1F, 1F - (scale3));
model.renderAll();
GL11.glPopMatrix();
GL11.glPushMatrix();
float scale4 = (scale + 0.75F) % 1F;
GL11.glScalef(scale4, scale4, scale4);
GL11.glRotatef(rotation * 0.5F, 0F, -1F, -0.5F);
GL11.glColor4f(1F, 1F, 1F, 1F - (scale4));
model.renderAll();
GL11.glPopMatrix();
renderPass(scale % 1F, rotation);
renderPass((scale + 0.25F) % 1F, rotation);
renderPass((scale + 0.5F) % 1F, rotation);
renderPass((scale + 0.75F) % 1F, rotation);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
@@ -100,5 +76,12 @@ public class RenderTileEnergyPylon extends TileEntitySpecialRenderer {
GL11.glPopMatrix();
}
// private void renderSphere()
private void renderPass(float scale, float rotation) {
GL11.glPushMatrix();
GL11.glScalef(scale, scale, scale);
GL11.glRotatef(rotation * 0.5F, 0F, -1F, -0.5F);
GL11.glColor4f(1F, 1F, 1F, 1F - scale);
model.renderAll();
GL11.glPopMatrix();
}
}
@@ -12,6 +12,7 @@ import org.lwjgl.opengl.GL11;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore;
import cpw.mods.fml.client.FMLClientHandler;
/**
@@ -19,49 +20,38 @@ import cpw.mods.fml.client.FMLClientHandler;
*/
public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer {
private static final ResourceLocation iner_model_texture = new ResourceLocation(
private static final ResourceLocation InnerModelTexture = new ResourceLocation(
References.MODID.toLowerCase(),
"textures/models/power_sphere_layer_1.png");
private static final ResourceLocation outer_model_texture = new ResourceLocation(
private static final ResourceLocation OuterModelTexture = new ResourceLocation(
References.MODID.toLowerCase(),
"textures/models/power_sphere_layer_2.png");
private IModelCustom iner_model;
private final IModelCustom innerModel;
public RenderTileEnergyStorageCore() {
iner_model = AdvancedModelLoader
innerModel = AdvancedModelLoader
.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/power_sphere_layer_1.obj"));
}
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float timeSinceLastTick) {
if (tile == null || !(tile instanceof TileEnergyStorageCore)) return;
TileEnergyStorageCore core = (TileEnergyStorageCore) tile;
if (!core.isOnline()) return;
if (!(tile instanceof TileEnergyStorageCore core)) {
return;
}
if (!core.isOnline()) {
return;
}
float scale = 0;
float rotation = core.modelRotation + (timeSinceLastTick / 2F);
switch (core.getTier()) {
case 0:
scale = 0.7F;
break;
case 1:
scale = 1.2F;
break;
case 2:
scale = 1.7F;
break;
case 3:
scale = 2.5F;
break;
case 4:
scale = 3.5F;
break;
case 5:
scale = 4.5F;
break;
case 6:
scale = 5.5F;
break;
case 0 -> scale = 0.7F;
case 1 -> scale = 1.2F;
case 2 -> scale = 1.7F;
case 3 -> scale = 2.5F;
case 4 -> scale = 3.5F;
case 5 -> scale = 4.5F;
case 6 -> scale = 5.5F;
}
GL11.glPushMatrix();
@@ -70,44 +60,29 @@ public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer {
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(iner_model_texture);
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(InnerModelTexture);
double colour = (double) ((TileEnergyStorageCore) tile).getEnergyStored()
/ (double) ((TileEnergyStorageCore) tile).getMaxEnergyStored();
double color = (double) core.getEnergyStored() / core.getMaxEnergyStored();
float brightness = (float) Math.abs(Math.sin((float) Minecraft.getSystemTime() / 3000f) * 100f);
colour = 1f - colour;
color = 1f - color;
GL11.glScalef(scale, scale, scale);
GL11.glPushMatrix();
GL11.glRotatef(rotation, 0F, 1F, 0.5F);
GL11.glColor4d(1F, colour * 0.3f, colour * 0.7f, 1F);
GL11.glColor4d(1F, color * 0.3f, color * 0.7f, 1F);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 80f + brightness, 80f + brightness);
iner_model.renderAll();
innerModel.renderAll();
GL11.glPopMatrix();
// GL11.glPushMatrix();
// GL11.glScalef(0.8F, 0.8F, 0.8F);
// GL11.glColor4d(1F, 1f, 0.2f, 1F);
// GL11.glRotatef(rotation, 0F, 1F, 0.5F);
// //iner_model.renderAll();
// GL11.glPopMatrix();
//
// GL11.glPushMatrix();
// GL11.glScalef(0.9F, 0.9F, 0.9F);
// GL11.glColor4d(1F, 0f, 0.2f, 1F);
// GL11.glRotatef(rotation, 0F, 1F, 0.5F);
// //iner_model.renderAll();
// GL11.glPopMatrix();
GL11.glScalef(1.1F, 1.1F, 1.1F);
GL11.glDepthMask(false);
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(outer_model_texture);
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(OuterModelTexture);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glRotatef(rotation * 0.5F, 0F, -1F, -0.5F);
GL11.glColor4f(0.5F, 2F, 2F, 0.7F);
iner_model.renderAll();
innerModel.renderAll();
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_LIGHTING);
@@ -31,9 +31,9 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
private static final ResourceLocation modelTexture = new ResourceLocation(
References.MODID.toLowerCase(),
"textures/models/stabilizer_sphere.png");
private IModelCustom stabilizerSphereModel;
private final IModelCustom stabilizerSphereModel;
private float pxl = 1F / 64;
private final float pixel = 1F / 64F;
public RenderTileParticleGen() {
stabilizerSphereModel = AdvancedModelLoader
@@ -54,8 +54,8 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
public void renderBlock(TileParticleGenerator tl, float f3) {
Tessellator tessellator = Tessellator.instance;
boolean inverted = tl.inverted;
boolean stabilizerMode = tl.stabalizerMode;
boolean inverted = tl.isInverted;
boolean stabilizerMode = tl.isInStabilizerMode;
GL11.glPushMatrix();
@@ -104,7 +104,7 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
drawEnergyBeam(tessellator, tl, f3);
}
if (tl.beam_enabled) preRenderBeam(tessellator, tl, f3);
if (tl.isBeamEnabled) preRenderBeam(tessellator, tl, f3);
}
private void drawEnergyBeam(Tessellator tess, TileParticleGenerator gen, float f) {
@@ -144,12 +144,12 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
GL11.glColor4f(0.0F, 2.0F, 0.0F, 1F);
GL11.glTranslated(0.5, 0, 0.5);
GL11.glScalef(0.4F, 0.4F, 0.4F);
if (!tile.stabalizerMode) {
float red = (float) tile.beam_red / 255F;
float green = (float) tile.beam_green / 255F;
float blue = (float) tile.beam_blue / 255F;
if (!tile.isInStabilizerMode) {
float red = (float) tile.beamRed / 255F;
float green = (float) tile.beamGreen / 255F;
float blue = (float) tile.beamBlue / 255F;
GL11.glColor4f(red, green, blue, 1F);
GL11.glScalef(tile.beam_scale, tile.beam_scale, tile.beam_scale);
GL11.glScalef(tile.beamScale, tile.beamScale, tile.beamScale);
}
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200, 200);
@@ -166,10 +166,10 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDepthMask(false);
GL11.glColor4f(0.0F, 1.0F, 1.0F, 0.5F);
if (!tile.stabalizerMode) {
float red = (float) tile.beam_red / 255F;
float green = (float) tile.beam_green / 255F;
float blue = (float) tile.beam_blue / 255F;
if (!tile.isInStabilizerMode) {
float red = (float) tile.beamRed / 255F;
float green = (float) tile.beamGreen / 255F;
float blue = (float) tile.beamBlue / 255F;
GL11.glColor4f(red, green, blue, 0.5F);
}
GL11.glEnable(GL11.GL_BLEND);
@@ -217,10 +217,10 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
double d17 = 0.5D + Math.sin(rotation + 3.9269908169872414D) * scale;
double d19 = 0.5D + Math.cos(rotation + 5.497787143782138D) * scale;
double d21 = 0.5D + Math.sin(rotation + 5.497787143782138D) * scale;
double height = (double) (length);
double height = length;
double texXMin = 0.0D;
double texXMax = 1.0D;
double d28 = (double) (-1.0F + upMot);
double d28 = -1.0F + upMot;
double texHeight = (double) (length) * (0.5D / scale) + d28;
tess.addVertexWithUV(x + d7, y + height, z + d9, texXMax, texHeight);
@@ -297,10 +297,10 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
double d12 = 0.8D;
double d14 = 0.8D;
double d16 = 0.8D;
double d18 = (double) (length);
double d18 = length;
double d20 = 0.0D;
double d22 = 1.0D;
double d24 = (double) (-1.0F + upMot);
double d24 = -1.0F + upMot;
double d26 = (double) (length) + d24;
tess.addVertexWithUV(x + d30, y + d18, z + d4, d22, d26);
tess.addVertexWithUV(x + d30, y, z + d4, d22, d24);
@@ -333,16 +333,16 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
private void drawCornerCube(Tessellator tess, float x, float y, float z, float FP, boolean inverted,
boolean stabalizerMode) {
float srcXMin = inverted ? 38F * pxl : 32F * pxl;
float srcXMin = inverted ? 38F * pixel : 32F * pixel;
float srcYMin = 0F;
float srcXMax = inverted ? 44F * pxl : 38F * pxl;
float srcYMax = 6 * pxl;
float srcXMax = inverted ? 44F * pixel : 38F * pixel;
float srcYMax = 6 * pixel;
// float FP = 0.6F; //Scale
float FN = 1F - FP;
if (stabalizerMode) {
srcXMin = 44F * pxl;
srcXMax = 50F * pxl;
srcXMin = 44F * pixel;
srcXMax = 50F * pixel;
}
// X+
@@ -385,8 +385,8 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
private void drawBeamX(Tessellator tess, float x, float y, float z, float FP) {
float srcXMin = 0;
float srcYMin = 0F;
float srcXMax = 32F * pxl;
float srcYMax = 4 * pxl;
float srcXMax = 32F * pixel;
float srcYMax = 4 * pixel;
float FN = 1F - FP;
float XX = 0.9F;
@@ -420,8 +420,8 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
private void drawBeamY(Tessellator tess, float x, float y, float z, float FP) {
float srcXMin = 0;
float srcYMin = 0F;
float srcXMax = 32F * pxl;
float srcYMax = 4 * pxl;
float srcXMax = 32F * pixel;
float srcYMax = 4 * pixel;
float FN = 1F - FP;
float XX = 0.9F;
@@ -455,8 +455,8 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
private void drawBeamZ(Tessellator tess, float x, float y, float z, float FP) {
float srcXMin = 0;
float srcYMin = 0F;
float srcXMax = 32F * pxl;
float srcYMax = 4 * pxl;
float srcXMax = 32F * pixel;
float srcYMax = 4 * pixel;
float FN = 1F - FP;
float XX = 0.9F;
@@ -491,17 +491,17 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
GL11.glPushMatrix();
GL11.glTranslated(0, 0.5, 0.5);
GL11.glRotatef(90F + gen.beam_pitch, 1F, 0F, 0F);
GL11.glRotatef(90F + gen.beamPitch, 1F, 0F, 0F);
GL11.glTranslated(0, 0, -0.5);
GL11.glTranslated(0.5, 0, 0);
GL11.glRotatef(gen.beam_yaw, 0F, 0F, 1F);
GL11.glRotatef(gen.beamYaw, 0F, 0F, 1F);
GL11.glTranslated(-0.5, 0, 0);
renderBeam(tess, gen, f);
GL11.glPopMatrix();
if (gen.render_core) {
if (gen.shouldRenderCore) {
GL11.glPushMatrix();
GL11.glTranslated(0, 0.5, 0);
renderStabilizerSphere(gen);
@@ -513,10 +513,10 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
int x = 0;
int y = 0;
int z = 0;
double length = tile.beam_length;
float red = (float) tile.beam_red / 255F;
float green = (float) tile.beam_green / 255F;
float blue = (float) tile.beam_blue / 255F;
double length = tile.beamLength;
float red = (float) tile.beamRed / 255F;
float green = (float) tile.beamGreen / 255F;
float blue = (float) tile.beamBlue / 255F;
GL11.glPushMatrix();
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
@@ -533,14 +533,13 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
// float time = (float)tile.getWorldObj().getTotalWorldTime() + f;
float time = tile.rotation + f;
float upMot = -time * 0.2F - (float) MathHelper.floor_float(-time * 0.1F);
float rotValue = tile.beam_rotation * (tile.rotation + f * 0.5F);
double rotation = rotValue;
double rotation = tile.beamRotation * (tile.rotation + f * 0.5F);
tess.startDrawingQuads();
tess.setBrightness(200);
tess.setColorRGBA(tile.beam_red, tile.beam_green, tile.beam_blue, 32);
tess.setColorRGBA(tile.beamRed, tile.beamGreen, tile.beamBlue, 32);
double scale = (double) tile.beam_scale * 0.2D;
double scale = (double) tile.beamScale * 0.2D;
double d7 = 0.5D + Math.cos(rotation + 2.356194490192345D) * scale; // x point 1
double d9 = 0.5D + Math.sin(rotation + 2.356194490192345D) * scale; // z point 1
double d11 = 0.5D + Math.cos(rotation + (Math.PI / 4D)) * scale; // x point 2
@@ -549,31 +548,30 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
double d17 = 0.5D + Math.sin(rotation + 3.9269908169872414D) * scale;
double d19 = 0.5D + Math.cos(rotation + 5.497787143782138D) * scale;
double d21 = 0.5D + Math.sin(rotation + 5.497787143782138D) * scale;
double height = (double) (length);
double texXMin = 0.0D;
double texXMax = 1.0D;
double d28 = (double) (-1.0F + upMot);
double texHeight = (double) (length) * (0.5D / scale) + d28;
double d28 = -1.0F + upMot;
double texHeight = length * (0.5D / scale) + d28;
tess.addVertexWithUV(x + d7, y + height, z + d9, texXMax, texHeight);
tess.addVertexWithUV(x + d7, y + length, z + d9, texXMax, texHeight);
tess.addVertexWithUV(x + d7, y, z + d9, texXMax, d28);
tess.addVertexWithUV(x + d11, y, z + d13, texXMin, d28);
tess.addVertexWithUV(x + d11, y + height, z + d13, texXMin, texHeight);
tess.addVertexWithUV(x + d11, y + length, z + d13, texXMin, texHeight);
tess.addVertexWithUV(x + d19, y + height, z + d21, texXMax, texHeight);
tess.addVertexWithUV(x + d19, y + length, z + d21, texXMax, texHeight);
tess.addVertexWithUV(x + d19, y, z + d21, texXMax, d28);
tess.addVertexWithUV(x + d15, y, z + d17, texXMin, d28);
tess.addVertexWithUV(x + d15, y + height, z + d17, texXMin, texHeight);
tess.addVertexWithUV(x + d15, y + length, z + d17, texXMin, texHeight);
tess.addVertexWithUV(x + d11, y + height, z + d13, texXMax, texHeight);
tess.addVertexWithUV(x + d11, y + length, z + d13, texXMax, texHeight);
tess.addVertexWithUV(x + d11, y, z + d13, texXMax, d28);
tess.addVertexWithUV(x + d19, y, z + d21, texXMin, d28);
tess.addVertexWithUV(x + d19, y + height, z + d21, texXMin, texHeight);
tess.addVertexWithUV(x + d19, y + length, z + d21, texXMin, texHeight);
tess.addVertexWithUV(x + d15, y + height, z + d17, texXMax, texHeight);
tess.addVertexWithUV(x + d15, y + length, z + d17, texXMax, texHeight);
tess.addVertexWithUV(x + d15, y, z + d17, texXMax, d28);
tess.addVertexWithUV(x + d7, y, z + d9, texXMin, d28);
tess.addVertexWithUV(x + d7, y + height, z + d9, texXMin, texHeight);
tess.addVertexWithUV(x + d7, y + length, z + d9, texXMin, texHeight);
rotation += 0.77f;
d7 = 0.5D + Math.cos(rotation + 2.356194490192345D) * scale;
@@ -586,29 +584,29 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
d21 = 0.5D + Math.sin(rotation + 5.497787143782138D) * scale;
d28 = (-1F + (upMot * 1));
texHeight = (double) (length) * (0.5D / scale) + d28;
texHeight = length * (0.5D / scale) + d28;
tess.setColorRGBA_F(red, green, blue, 1f);
tess.addVertexWithUV(x + d7, y + height, z + d9, texXMax, texHeight);
tess.addVertexWithUV(x + d7, y + length, z + d9, texXMax, texHeight);
tess.addVertexWithUV(x + d7, y, z + d9, texXMax, d28);
tess.addVertexWithUV(x + d11, y, z + d13, texXMin, d28);
tess.addVertexWithUV(x + d11, y + height, z + d13, texXMin, texHeight);
tess.addVertexWithUV(x + d11, y + length, z + d13, texXMin, texHeight);
tess.addVertexWithUV(x + d19, y + height, z + d21, texXMax, texHeight);
tess.addVertexWithUV(x + d19, y + length, z + d21, texXMax, texHeight);
tess.addVertexWithUV(x + d19, y, z + d21, texXMax, d28);
tess.addVertexWithUV(x + d15, y, z + d17, texXMin, d28);
tess.addVertexWithUV(x + d15, y + height, z + d17, texXMin, texHeight);
tess.addVertexWithUV(x + d15, y + length, z + d17, texXMin, texHeight);
tess.addVertexWithUV(x + d11, y + height, z + d13, texXMax, texHeight);
tess.addVertexWithUV(x + d11, y + length, z + d13, texXMax, texHeight);
tess.addVertexWithUV(x + d11, y, z + d13, texXMax, d28);
tess.addVertexWithUV(x + d19, y, z + d21, texXMin, d28);
tess.addVertexWithUV(x + d19, y + height, z + d21, texXMin, texHeight);
tess.addVertexWithUV(x + d19, y + length, z + d21, texXMin, texHeight);
tess.addVertexWithUV(x + d15, y + height, z + d17, texXMax, texHeight);
tess.addVertexWithUV(x + d15, y + length, z + d17, texXMax, texHeight);
tess.addVertexWithUV(x + d15, y, z + d17, texXMax, d28);
tess.addVertexWithUV(x + d7, y, z + d9, texXMin, d28);
tess.addVertexWithUV(x + d7, y + height, z + d9, texXMin, texHeight);
tess.addVertexWithUV(x + d7, y + length, z + d9, texXMin, texHeight);
tess.draw();
GL11.glPushMatrix();
@@ -620,10 +618,10 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glDepthMask(false);
GL11.glTranslated(0.5, 0, 0.5);
GL11.glScalef(tile.beam_scale, 1f, tile.beam_scale);
GL11.glScalef(tile.beamScale, 1f, tile.beamScale);
GL11.glTranslated(-0.5, -0, -0.5);
tess.startDrawingQuads();
tess.setColorRGBA(tile.beam_red, tile.beam_green, tile.beam_blue, 32);
tess.setColorRGBA(tile.beamRed, tile.beamGreen, tile.beamBlue, 32);
double d30 = 0.2D;
double d4 = 0.2D;
double d6 = 0.8D;
@@ -632,27 +630,26 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
double d12 = 0.8D;
double d14 = 0.8D;
double d16 = 0.8D;
double d18 = (double) (length);
double d20 = 0.0D;
double d22 = 1D;
double d24 = (double) (-1.0F + upMot);
double d26 = (double) (length) + d24;
tess.addVertexWithUV(x + d30, y + d18, z + d4, d22, d26);
double d24 = -1.0F + upMot;
double d26 = length + d24;
tess.addVertexWithUV(x + d30, y + length, z + d4, d22, d26);
tess.addVertexWithUV(x + d30, y, z + d4, d22, d24);
tess.addVertexWithUV(x + d6, y, z + d8, d20, d24);
tess.addVertexWithUV(x + d6, y + d18, z + d8, d20, d26);
tess.addVertexWithUV(x + d14, y + d18, z + d16, d22, d26);
tess.addVertexWithUV(x + d6, y + length, z + d8, d20, d26);
tess.addVertexWithUV(x + d14, y + length, z + d16, d22, d26);
tess.addVertexWithUV(x + d14, y, z + d16, d22, d24);
tess.addVertexWithUV(x + d10, y, z + d12, d20, d24);
tess.addVertexWithUV(x + d10, y + d18, z + d12, d20, d26);
tess.addVertexWithUV(x + d6, y + d18, z + d8, d22, d26);
tess.addVertexWithUV(x + d10, y + length, z + d12, d20, d26);
tess.addVertexWithUV(x + d6, y + length, z + d8, d22, d26);
tess.addVertexWithUV(x + d6, y, z + d8, d22, d24);
tess.addVertexWithUV(x + d14, y, z + d16, d20, d24);
tess.addVertexWithUV(x + d14, y + d18, z + d16, d20, d26);
tess.addVertexWithUV(x + d10, y + d18, z + d12, d22, d26);
tess.addVertexWithUV(x + d14, y + length, z + d16, d20, d26);
tess.addVertexWithUV(x + d10, y + length, z + d12, d22, d26);
tess.addVertexWithUV(x + d10, y, z + d12, d22, d24);
tess.addVertexWithUV(x + d30, y, z + d4, d20, d24);
tess.addVertexWithUV(x + d30, y + d18, z + d4, d20, d26);
tess.addVertexWithUV(x + d30, y + length, z + d4, d20, d26);
tess.draw();
GL11.glPopMatrix();
@@ -72,12 +72,11 @@ public class RenderTilePlacedItem extends TileEntitySpecialRenderer {
GL11.glTranslatef(0.0F, -0.18F, 0.0F);
}
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT);
RenderItem.renderInFrame = true;
RenderManager.instance.renderEntityWithPosYaw(itemEntity, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderItem.renderInFrame = false;
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopAttrib();
}
private void metaAdjustItemTool(int meta) {
@@ -27,35 +27,23 @@ public class RenderTileReactorCore extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick) {
TileReactorCore tile = (TileReactorCore) tileEntity;
// tile.renderList.clear();
TileReactorCore core = (TileReactorCore) tileEntity;
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
renderReactorCore(tile, partialTick);
// for (MultiblockHelper.TileOffset offset : tile.stabilizerLocations){
// if (!(offset.getTileEntity(tileEntity) instanceof TileReactorStabilizer)) continue;
// GL11.glPushMatrix();
//
// TileReactorStabilizer stabilizer = (TileReactorStabilizer)offset.getTileEntity(tileEntity);
// GL11.glTranslated(-offset.offsetX, -offset.offsetY, -offset.offsetZ);
// //RenderTileReactorStabilizer.renderCore(stabilizer, partialTick);
// //RenderTileReactorStabilizer.renderEffects(stabilizer, partialTick);
//
// GL11.glPopMatrix();
// }
renderReactorCore(core, partialTick);
GL11.glPopMatrix();
}
public void renderReactorCore(TileReactorCore tile, float partialTick) {
float rotation = (tile.renderRotation * 0.2F) + (partialTick * (tile.renderSpeed * 0.2F));
double ff = tile.maxFieldCharge > 0 ? tile.fieldCharge / tile.maxFieldCharge : 0;
double r = ff < 0.5 ? 1 - (ff * 2) : 0;
double g = ff > 0.5 ? (ff - 0.5) * 2 : 0;
double b = ff * 2;
double a = ff < 0.1 ? (ff * 10) : 1;
public void renderReactorCore(TileReactorCore core, float partialTick) {
float rotation = core.renderRotation * 0.2F + partialTick * (core.renderSpeed * 0.2F);
double fieldChargePercentage = core.maxFieldCharge > 0 ? core.fieldCharge / core.maxFieldCharge : 0;
double r = fieldChargePercentage < 0.5 ? 1 - fieldChargePercentage * 2 : 0;
double g = fieldChargePercentage > 0.5 ? (fieldChargePercentage - 0.5) * 2 : 0;
double b = fieldChargePercentage * 2;
double a = fieldChargePercentage < 0.1 ? fieldChargePercentage * 10 : 1;
// Pre Render
GL11.glPushMatrix();
@@ -65,7 +53,7 @@ public class RenderTileReactorCore extends TileEntitySpecialRenderer {
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F);
// Render inner
if (tile.reactorFuel + tile.convertedFuel < 144) {
if (core.reactorFuel + core.convertedFuel < 144) {
ResourceHandler.bindResource("textures/blocks/draconic_block_blank.png");
GL11.glPushMatrix();
GL11.glScaled(0.1, 0.1, 0.1);
@@ -77,8 +65,8 @@ public class RenderTileReactorCore extends TileEntitySpecialRenderer {
GL11.glColor4d(1, 1, 1, 1);
GL11.glRotatef(rotation, 0.5F, 1F, 0.5F);
GL11.glScaled(0.5, 0.5, 0.5);
double r3 = tile.getCoreDiameter();
GL11.glScaled(r3, r3, r3);
double diameter = core.getCoreDiameter();
GL11.glScaled(diameter, diameter, diameter);
reactorModel.renderAll();
// Mid Render
@@ -87,10 +75,11 @@ public class RenderTileReactorCore extends TileEntitySpecialRenderer {
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glAlphaFunc(GL11.GL_GREATER, 0F);
if (tile.reactionTemperature < 2000) {
if (core.reactionTemperature < 2000) {
ResourceHandler.bindResource("textures/blocks/draconic_block_blank.png");
if (tile.reactionTemperature > 1000)
GL11.glColor4d(1F, 1F, 1F, 1D - ((tile.reactionTemperature - 1000) / 1000D));
if (core.reactionTemperature > 1000) {
GL11.glColor4d(1F, 1F, 1F, 1D - (core.reactionTemperature - 1000) / 1000D);
}
reactorModel.renderAll();
}
@@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.client.render.tile;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
@@ -17,38 +18,40 @@ public class RenderTileReactorEnergyInjector extends TileEntitySpecialRenderer {
public static ModelReactorEnergyInjector modelReactorEnergyInjector = new ModelReactorEnergyInjector();
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick) {
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTick) {
if (!(tile instanceof TileReactorEnergyInjector injector)) {
return;
}
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
renderCore((TileReactorEnergyInjector) tileEntity, partialTick);
renderCore(injector);
GL11.glPopMatrix();
}
public static void renderCore(TileReactorEnergyInjector tile, float partialTick) {
public static void renderCore(TileReactorEnergyInjector injector) {
GL11.glPushMatrix();
float scale = (1F / 16F);
switch (tile.facingDirection) {
case 1:
GL11.glRotated(180, -1, 0, 0);
break;
case 2:
GL11.glRotated(90, 1, 0, 0);
break;
case 3:
GL11.glRotated(90, -1, 0, 0);
break;
case 4:
GL11.glRotated(90, 0, 0, -1);
break;
case 5:
GL11.glRotated(90, 0, 0, 1);
int angle = 90;
ForgeDirection axis = injector.facing;
switch (injector.facing) {
case UP -> {
angle = 180;
axis = ForgeDirection.WEST;
}
case SOUTH -> axis = ForgeDirection.WEST;
case NORTH -> axis = ForgeDirection.EAST;
case WEST -> axis = ForgeDirection.NORTH;
case EAST -> axis = ForgeDirection.SOUTH;
}
if (injector.facing != ForgeDirection.DOWN) {
GL11.glRotated(angle, axis.offsetX, axis.offsetY, axis.offsetZ);
}
ResourceHandler.bindResource("textures/models/ModelReactorPowerInjector.png");
modelReactorEnergyInjector.render(null, tile.modelIllumination, 0F, 0F, 0F, 0F, scale);
modelReactorEnergyInjector.render(null, injector.modelIllumination, 0F, 0F, 0F, 0F, scale);
GL11.glPopMatrix();
}
@@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.client.render.tile;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
@@ -19,120 +20,49 @@ public class RenderTileReactorStabilizer extends TileEntitySpecialRenderer {
public static ModelReactorStabilizerCore modelStabilizerCore = new ModelReactorStabilizerCore();
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick) {
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTick) {
if (!(tile instanceof TileReactorStabilizer stabilizer)) {
return;
}
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
renderCore((TileReactorStabilizer) tileEntity, partialTick);
// renderEffects((TileReactorStabilizer) tileEntity, partialTick);
renderCore(stabilizer, partialTick);
GL11.glPopMatrix();
}
public static void renderCore(TileReactorStabilizer tile, float partialTick) {
public static void renderCore(TileReactorStabilizer stabilizer, float partialTick) {
GL11.glPushMatrix();
float scale = (1F / 16F);
float coreRotation = tile.coreRotation + (partialTick * tile.coreSpeed);
float ringRotation = tile.ringRotation + (partialTick * tile.ringSpeed);
float coreRotation = stabilizer.coreRotation + (partialTick * stabilizer.coreSpeed);
float ringRotation = stabilizer.ringRotation + (partialTick * stabilizer.ringSpeed);
switch (tile.facingDirection) {
case 0:
GL11.glRotated(90, -1, 0, 0);
break;
case 1:
GL11.glRotated(90, 1, 0, 0);
break;
case 3:
GL11.glRotated(180, 1, 0, 0);
break;
case 4:
GL11.glRotated(90, 0, 1, 0);
break;
case 5:
GL11.glRotated(90, 0, -1, 0);
int angle = 90;
ForgeDirection axis = stabilizer.facing;
switch (stabilizer.facing) {
case DOWN -> axis = ForgeDirection.WEST;
case SOUTH -> {
angle = 180;
axis = ForgeDirection.EAST;
}
case UP -> axis = ForgeDirection.EAST;
case WEST -> axis = ForgeDirection.UP;
case EAST -> axis = ForgeDirection.DOWN;
}
if (stabilizer.facing != ForgeDirection.NORTH) {
GL11.glRotated(angle, axis.offsetX, axis.offsetY, axis.offsetZ);
}
ResourceHandler.bindResource("textures/models/reactorStabilizerCore.png");
modelStabilizerCore.render(null, coreRotation, tile.modelIllumination, 0F, 0F, 0F, scale);
modelStabilizerCore.render(null, coreRotation, stabilizer.modelIllumination, 0F, 0F, 0F, scale);
ResourceHandler.bindResource("textures/models/reactorStabilizerRing.png");
GL11.glRotated(90, 1, 0, 0);
GL11.glTranslated(0, -0.58, 0);
GL11.glScaled(0.95, 0.95, 0.95);
GL11.glRotatef(ringRotation, 0, 1, 0);
modelStabilizerRing.render(null, -70F, tile.modelIllumination, 0F, 0F, 0F, scale);
modelStabilizerRing.render(null, -70F, stabilizer.modelIllumination, 0F, 0F, 0F, scale);
GL11.glPopMatrix();
}
// public static void renderEffects(TileReactorStabilizer tile, float partialTick) {
// if (tile.isValid)
// {
// //Common Fields
// MultiblockHelper.TileLocation master = tile.masterLocation;
// float offsetX = (float)(master.posX - tile.xCoord);
// float offsetY = (float)((double)master.posY - tile.yCoord);
// float offsetZ = (float)(master.posZ - tile.zCoord);
// float length = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ);
//
// Tessellator tessellator = Tessellator.instance;
//
// //Pre Render
// GL11.glPushMatrix();
//// RenderHelper.disableStandardItemLighting();
// GL11.glDisable(GL11.GL_CULL_FACE);
// GL11.glShadeModel(GL11.GL_SMOOTH);
// GL11.glEnable(GL11.GL_BLEND);
// OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
// GL11.glAlphaFunc(GL11.GL_GREATER, 0.0F);
// GL11.glDisable(GL11.GL_LIGHTING);
// GL11.glDepthMask(false);
//
// //Rotate beam to face target
// float f7 = MathHelper.sqrt_float(offsetX * offsetX + offsetZ * offsetZ);
// GL11.glRotatef((float) (-Math.atan2((double) offsetZ, (double) offsetX)) * 180.0F / (float) Math.PI - 90.0F,
// 0.0F, 1.0F, 0.0F);
// GL11.glRotatef((float)(-Math.atan2((double)f7, (double)offsetY)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F,
// 0.0F);
//
//
// //Draw Beams
// GL11.glPushMatrix();
// GL11.glTranslated(0, 0, -0.35);
// ResourceHandler.bindTexture(new ResourceLocation("textures/entity/endercrystal/endercrystal_beam.png"));
//// drawBeam(tessellator, 1F, 0.355F, 0.8F, offsetX, offsetY, offsetZ, tile.tick, partialTick, true, false);
// GL11.glPopMatrix();
//
// GL11.glPushMatrix();
// GL11.glTranslated(0, 0, 0.4526);
// float coreSize = 1.1F;
// float s = 0.355F;
//// drawBeam(tessellator, s/coreSize, coreSize, length - 0.5F, offsetX, offsetY, offsetZ, tile.tick, partialTick,
// false, false);
// GL11.glPopMatrix();
//
//// GL11.glPushMatrix();
//// GL11.glTranslated(0, 0, -0.35);
//// ResourceHandler.bindTexture(new ResourceLocation("textures/entity/endercrystal/endercrystal_beam.png"));
//// drawBeam(tessellator, 1F, 0.26F, 0.8F, offsetX, offsetY, offsetZ, tile.tick, partialTick, true, true);
//// GL11.glPopMatrix();
////
//// GL11.glPushMatrix();
//// GL11.glTranslated(0, 0, 0.4526);
//// coreSize = 1.1F;
//// s = 0.263F;
//// drawBeam(tessellator, s/coreSize, coreSize, length - 0.5F, offsetX, offsetY, offsetZ, tile.tick, partialTick,
// false, true);
//// GL11.glPopMatrix();
//
// //Post Render
// GL11.glDepthMask(true);
// GL11.glEnable(GL11.GL_LIGHTING);
// GL11.glEnable(GL11.GL_CULL_FACE);
// GL11.glShadeModel(GL11.GL_FLAT);
//// RenderHelper.enableStandardItemLighting();
// GL11.glDisable(GL11.GL_BLEND);
// GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
// GL11.glPopMatrix();
// }
// }
}
@@ -1,6 +1,6 @@
package com.brandon3055.draconicevolution.client.render.tile;
import java.awt.*;
import java.awt.Point;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
@@ -11,6 +11,7 @@ import org.lwjgl.opengl.GL11;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.TileTestBlock;
import cpw.mods.fml.client.FMLClientHandler;
/**
@@ -1,12 +1,5 @@
package com.brandon3055.draconicevolution.common;
import net.minecraft.client.audio.ISound;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.creativetab.DETab;
import com.brandon3055.draconicevolution.client.gui.GuiHandler;
@@ -14,20 +7,75 @@ import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyBe
import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyField;
import com.brandon3055.draconicevolution.client.render.particle.ParticleReactorBeam;
import com.brandon3055.draconicevolution.common.achievements.Achievements;
import com.brandon3055.draconicevolution.common.entity.*;
import com.brandon3055.draconicevolution.common.handler.*;
import com.brandon3055.draconicevolution.common.entity.EntityChaosBolt;
import com.brandon3055.draconicevolution.common.entity.EntityChaosCrystal;
import com.brandon3055.draconicevolution.common.entity.EntityChaosGuardian;
import com.brandon3055.draconicevolution.common.entity.EntityChaosVortex;
import com.brandon3055.draconicevolution.common.entity.EntityCustomArrow;
import com.brandon3055.draconicevolution.common.entity.EntityCustomDragon;
import com.brandon3055.draconicevolution.common.entity.EntityDraconicArrow;
import com.brandon3055.draconicevolution.common.entity.EntityDragonHeart;
import com.brandon3055.draconicevolution.common.entity.EntityDragonProjectile;
import com.brandon3055.draconicevolution.common.entity.EntityEnderArrow;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.handler.ContributorHandler;
import com.brandon3055.draconicevolution.common.handler.CraftingHandler;
import com.brandon3055.draconicevolution.common.handler.FMLEventHandler;
import com.brandon3055.draconicevolution.common.handler.MinecraftForgeEventHandler;
import com.brandon3055.draconicevolution.common.lib.OreDoublingRegistry;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.magic.EnchantmentReaper;
import com.brandon3055.draconicevolution.common.magic.PotionHandler;
import com.brandon3055.draconicevolution.common.network.*;
import com.brandon3055.draconicevolution.common.tileentities.*;
import com.brandon3055.draconicevolution.common.network.BlockUpdatePacket;
import com.brandon3055.draconicevolution.common.network.ButtonPacket;
import com.brandon3055.draconicevolution.common.network.ContributorPacket;
import com.brandon3055.draconicevolution.common.network.GenericParticlePacket;
import com.brandon3055.draconicevolution.common.network.ItemConfigPacket;
import com.brandon3055.draconicevolution.common.network.MagnetToggleAckPacket;
import com.brandon3055.draconicevolution.common.network.MagnetTogglePacket;
import com.brandon3055.draconicevolution.common.network.MountUpdatePacket;
import com.brandon3055.draconicevolution.common.network.ParticleGenPacket;
import com.brandon3055.draconicevolution.common.network.PlacedItemPacket;
import com.brandon3055.draconicevolution.common.network.PlayerDetectorButtonPacket;
import com.brandon3055.draconicevolution.common.network.PlayerDetectorStringPacket;
import com.brandon3055.draconicevolution.common.network.ShieldHitPacket;
import com.brandon3055.draconicevolution.common.network.SpeedRequestPacket;
import com.brandon3055.draconicevolution.common.network.TeleporterPacket;
import com.brandon3055.draconicevolution.common.network.TileObjectPacket;
import com.brandon3055.draconicevolution.common.network.ToolModePacket;
import com.brandon3055.draconicevolution.common.tileentities.TileCKeyStone;
import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard;
import com.brandon3055.draconicevolution.common.tileentities.TileContainerTemplate;
import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner;
import com.brandon3055.draconicevolution.common.tileentities.TileDislocatorInhibitor;
import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter;
import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest;
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
import com.brandon3055.draconicevolution.common.tileentities.TileGenerator;
import com.brandon3055.draconicevolution.common.tileentities.TileGrinder;
import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator;
import com.brandon3055.draconicevolution.common.tileentities.TilePlacedItem;
import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetector;
import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetectorAdvanced;
import com.brandon3055.draconicevolution.common.tileentities.TilePotentiometer;
import com.brandon3055.draconicevolution.common.tileentities.TileSunDial;
import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand;
import com.brandon3055.draconicevolution.common.tileentities.TileTestBlock;
import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier;
import com.brandon3055.draconicevolution.common.tileentities.TileWeatherController;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyRelay;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyTransceiver;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileWirelessEnergyTransceiver;
import com.brandon3055.draconicevolution.common.tileentities.gates.TileFluidGate;
import com.brandon3055.draconicevolution.common.tileentities.gates.TileFluxGate;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.*;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileDislocatorReceptacle;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnderResurrection;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyPylon;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileInvisibleMultiblock;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TilePortalBlock;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorEnergyInjector;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorStabilizer;
@@ -35,7 +83,6 @@ import com.brandon3055.draconicevolution.common.utills.DragonChunkLoader;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import com.brandon3055.draconicevolution.common.world.DraconicWorldGenerator;
import com.brandon3055.draconicevolution.integration.computers.CCOCIntegration;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
@@ -44,6 +91,12 @@ import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.client.audio.ISound;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary;
public class CommonProxy {
@@ -174,7 +227,6 @@ public class CommonProxy {
GameRegistry.registerTileEntity(TileGenerator.class, References.RESOURCESPREFIX + "TileGenerator");
GameRegistry
.registerTileEntity(TileEnergyStorageCore.class, References.RESOURCESPREFIX + "TileEnergyStorageCore");
GameRegistry.registerTileEntity(TileEarth.class, References.RESOURCESPREFIX + "TileEarth");
GameRegistry.registerTileEntity(
TileInvisibleMultiblock.class,
References.RESOURCESPREFIX + "TileInvisibleMultiblock");
@@ -207,6 +259,9 @@ public class CommonProxy {
GameRegistry.registerTileEntity(TileChaosShard.class, References.RESOURCESPREFIX + "TileChaosShard");
GameRegistry
.registerTileEntity(TileUpgradeModifier.class, References.RESOURCESPREFIX + "TileEnhancementModifier");
GameRegistry.registerTileEntity(
TileDislocatorInhibitor.class,
References.RESOURCESPREFIX + "TileDislocatorInhibitor");
if (DraconicEvolution.debug) {
GameRegistry.registerTileEntity(TileTestBlock.class, References.RESOURCESPREFIX + "TileTestBlock");
GameRegistry.registerTileEntity(
@@ -1,16 +1,52 @@
package com.brandon3055.draconicevolution.common;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.blocks.*;
import com.brandon3055.draconicevolution.common.blocks.machine.*;
import com.brandon3055.draconicevolution.common.blocks.multiblock.*;
import com.brandon3055.draconicevolution.common.blocks.BlockContainerTemplate;
import com.brandon3055.draconicevolution.common.blocks.BlockDE;
import com.brandon3055.draconicevolution.common.blocks.CKeyStone;
import com.brandon3055.draconicevolution.common.blocks.ChaosCrystal;
import com.brandon3055.draconicevolution.common.blocks.ChaosShardAtmos;
import com.brandon3055.draconicevolution.common.blocks.CustomSpawner;
import com.brandon3055.draconicevolution.common.blocks.DraconicBlock;
import com.brandon3055.draconicevolution.common.blocks.DraconiumBlock;
import com.brandon3055.draconicevolution.common.blocks.DraconiumChest;
import com.brandon3055.draconicevolution.common.blocks.DraconiumOre;
import com.brandon3055.draconicevolution.common.blocks.InfusedObsidian;
import com.brandon3055.draconicevolution.common.blocks.ParticleGenerator;
import com.brandon3055.draconicevolution.common.blocks.PlacedItem;
import com.brandon3055.draconicevolution.common.blocks.Potentiometer;
import com.brandon3055.draconicevolution.common.blocks.RainSensor;
import com.brandon3055.draconicevolution.common.blocks.SafetyFlame;
import com.brandon3055.draconicevolution.common.blocks.TeleporterStand;
import com.brandon3055.draconicevolution.common.blocks.TestBlock;
import com.brandon3055.draconicevolution.common.blocks.XRayBlock;
import com.brandon3055.draconicevolution.common.blocks.machine.DislocatorInhibitor;
import com.brandon3055.draconicevolution.common.blocks.machine.DissEnchanter;
import com.brandon3055.draconicevolution.common.blocks.machine.EnergyCrystal;
import com.brandon3055.draconicevolution.common.blocks.machine.EnergyInfuser;
import com.brandon3055.draconicevolution.common.blocks.machine.FlowGate;
import com.brandon3055.draconicevolution.common.blocks.machine.Generator;
import com.brandon3055.draconicevolution.common.blocks.machine.Grinder;
import com.brandon3055.draconicevolution.common.blocks.machine.LongRangeDislocator;
import com.brandon3055.draconicevolution.common.blocks.machine.PlayerDetector;
import com.brandon3055.draconicevolution.common.blocks.machine.PlayerDetectorAdvanced;
import com.brandon3055.draconicevolution.common.blocks.machine.SunDial;
import com.brandon3055.draconicevolution.common.blocks.machine.UpgradeModifier;
import com.brandon3055.draconicevolution.common.blocks.machine.WeatherController;
import com.brandon3055.draconicevolution.common.blocks.multiblock.DislocatorReceptacle;
import com.brandon3055.draconicevolution.common.blocks.multiblock.EnergyPylon;
import com.brandon3055.draconicevolution.common.blocks.multiblock.EnergyStorageCore;
import com.brandon3055.draconicevolution.common.blocks.multiblock.InvisibleMultiblock;
import com.brandon3055.draconicevolution.common.blocks.multiblock.Portal;
import com.brandon3055.draconicevolution.common.blocks.multiblock.ReactorCore;
import com.brandon3055.draconicevolution.common.blocks.multiblock.ReactorEnergyInjector;
import com.brandon3055.draconicevolution.common.blocks.multiblock.ReactorStabilizer;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
@GameRegistry.ObjectHolder(References.MODID)
public class ModBlocks {
@@ -31,7 +67,6 @@ public class ModBlocks {
public static BlockDE longRangeDislocator;
public static BlockDE generator;
public static BlockDE energyStorageCore;
public static BlockDE earthBlock;
public static BlockDE draconiumBlock;
public static BlockDE invisibleMultiblock;
public static BlockDE energyPylon;
@@ -52,6 +87,7 @@ public class ModBlocks {
public static BlockDE reactorEnergyInjector;
public static BlockDE chaosCrystal;
public static BlockDE upgradeModifier;
public static BlockDE dislocatorInhibitor;
public static Block safetyFlame;
public static Block chaosShardAtmos = new ChaosShardAtmos()
.setBlockName(References.RESOURCESPREFIX + "chaosShardAtmos")
@@ -74,7 +110,6 @@ public class ModBlocks {
customSpawner = new CustomSpawner();
generator = new Generator();
energyStorageCore = new EnergyStorageCore();
earthBlock = new Earth();
draconiumBlock = new DraconiumBlock();
invisibleMultiblock = new InvisibleMultiblock();
energyPylon = new EnergyPylon();
@@ -95,6 +130,7 @@ public class ModBlocks {
reactorEnergyInjector = new ReactorEnergyInjector();
chaosCrystal = new ChaosCrystal();
upgradeModifier = new UpgradeModifier();
dislocatorInhibitor = new DislocatorInhibitor();
longRangeDislocator = new LongRangeDislocator();
@@ -8,16 +8,52 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.EnumHelper;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.items.*;
import com.brandon3055.draconicevolution.common.items.AwakenedCore;
import com.brandon3055.draconicevolution.common.items.ChaosFragment;
import com.brandon3055.draconicevolution.common.items.ChaosShard;
import com.brandon3055.draconicevolution.common.items.ChaoticCore;
import com.brandon3055.draconicevolution.common.items.DezilsMarshmallow;
import com.brandon3055.draconicevolution.common.items.DraconicCore;
import com.brandon3055.draconicevolution.common.items.DraconicIngot;
import com.brandon3055.draconicevolution.common.items.DraconiumBlend;
import com.brandon3055.draconicevolution.common.items.DraconiumDust;
import com.brandon3055.draconicevolution.common.items.DraconiumEnergyCore;
import com.brandon3055.draconicevolution.common.items.DraconiumIngot;
import com.brandon3055.draconicevolution.common.items.DragonHeart;
import com.brandon3055.draconicevolution.common.items.InfoTablet;
import com.brandon3055.draconicevolution.common.items.ItemDE;
import com.brandon3055.draconicevolution.common.items.Key;
import com.brandon3055.draconicevolution.common.items.MobSoul;
import com.brandon3055.draconicevolution.common.items.Nugget;
import com.brandon3055.draconicevolution.common.items.ReactorStabiliserPart;
import com.brandon3055.draconicevolution.common.items.SunFocus;
import com.brandon3055.draconicevolution.common.items.Tclogo;
import com.brandon3055.draconicevolution.common.items.WyvernCore;
import com.brandon3055.draconicevolution.common.items.armor.DraconicArmor;
import com.brandon3055.draconicevolution.common.items.armor.WyvernArmor;
import com.brandon3055.draconicevolution.common.items.tools.*;
import com.brandon3055.draconicevolution.common.items.tools.AdminSpawnEgg;
import com.brandon3055.draconicevolution.common.items.tools.CreativeStructureSpawner;
import com.brandon3055.draconicevolution.common.items.tools.DraconicAxe;
import com.brandon3055.draconicevolution.common.items.tools.DraconicDistructionStaff;
import com.brandon3055.draconicevolution.common.items.tools.DraconicHoe;
import com.brandon3055.draconicevolution.common.items.tools.DraconicPickaxe;
import com.brandon3055.draconicevolution.common.items.tools.DraconicShovel;
import com.brandon3055.draconicevolution.common.items.tools.DraconiumFluxCapacitor;
import com.brandon3055.draconicevolution.common.items.tools.EnderArrow;
import com.brandon3055.draconicevolution.common.items.tools.Magnet;
import com.brandon3055.draconicevolution.common.items.tools.SafetyMatch;
import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKI;
import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKII;
import com.brandon3055.draconicevolution.common.items.tools.Wrench;
import com.brandon3055.draconicevolution.common.items.tools.WyvernPickaxe;
import com.brandon3055.draconicevolution.common.items.tools.WyvernShovel;
import com.brandon3055.draconicevolution.common.items.weapons.DraconicBow;
import com.brandon3055.draconicevolution.common.items.weapons.DraconicSword;
import com.brandon3055.draconicevolution.common.items.weapons.WyvernBow;
import com.brandon3055.draconicevolution.common.items.weapons.WyvernSword;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import cpw.mods.fml.common.registry.GameRegistry;
@GameRegistry.ObjectHolder(References.MODID)
@@ -1,5 +1,6 @@
package com.brandon3055.draconicevolution.common.blocks;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
@@ -26,9 +27,10 @@ import cpw.mods.fml.relauncher.SideOnly;
/**
* Created by Brandon on 27/08/2014.
*/
public class CKeyStone extends BlockDE {
public class CKeyStone extends BlockDE implements ITileEntityProvider {
private IIcon blockIcon1;
@SideOnly(Side.CLIENT)
private IIcon blockIconActive;
public CKeyStone() {
this.setBlockUnbreakable();
@@ -43,43 +45,41 @@ public class CKeyStone extends BlockDE {
}
@Override
public TileEntity createTileEntity(World world, int metadata) {
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileCKeyStone();
}
@SideOnly(Side.CLIENT)
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "key_stone_inactive");
blockIcon1 = iconRegister.registerIcon(References.RESOURCESPREFIX + "key_stone_active");
blockIconActive = iconRegister.registerIcon(References.RESOURCESPREFIX + "key_stone_active");
}
@Override
@SideOnly(Side.CLIENT)
@Override
public IIcon getIcon(int side, int meta) {
if (side == 0 || side == 1) return Blocks.furnace.getIcon(side, meta);
else return blockIcon1;
public IIcon getIcon(int side, int metadata) {
return side == 0 || side == 1 ? Blocks.furnace.getIcon(side, metadata) : blockIconActive;
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
if (side == 0 || side == 1) return Blocks.furnace.getIcon(side, 0);
TileCKeyStone tile = world.getTileEntity(x, y, z) != null
&& world.getTileEntity(x, y, z) instanceof TileCKeyStone ? (TileCKeyStone) world.getTileEntity(x, y, z)
: null;
if (tile != null) return tile.isActivated ? blockIcon1 : blockIcon;
else return blockIcon;
if (side == 0 || side == 1) {
return Blocks.furnace.getIcon(side, 0);
}
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileCKeyStone keyStone) {
return keyStone.isActivated ? blockIconActive : blockIcon;
}
return blockIcon;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_,
float p_149727_7_, float p_149727_8_, float p_149727_9_) {
TileCKeyStone tile = world.getTileEntity(x, y, z) != null
&& world.getTileEntity(x, y, z) instanceof TileCKeyStone ? (TileCKeyStone) world.getTileEntity(x, y, z)
: null;
if (tile != null) return tile.onActivated(player.getHeldItem(), player);
return false;
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float subX,
float subY, float subZ) {
TileEntity tile = world.getTileEntity(x, y, z);
return tile instanceof TileCKeyStone keyStone && keyStone.onActivated(player.getHeldItem(), player);
}
@Override
@@ -94,26 +94,16 @@ public class CKeyStone extends BlockDE {
@Override
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int meta) {
TileCKeyStone tile = world.getTileEntity(x, y, z) != null
&& world.getTileEntity(x, y, z) instanceof TileCKeyStone ? (TileCKeyStone) world.getTileEntity(x, y, z)
: null;
if (tile != null) return tile.isActivated ? 15 : 0;
return 0;
}
@Override
public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int meta) {
return 0;
TileEntity tile = world.getTileEntity(x, y, z);
return tile instanceof TileCKeyStone keyStone && keyStone.isActivated ? 15 : 0;
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
TileCKeyStone tile = world.getTileEntity(x, y, z) != null
&& world.getTileEntity(x, y, z) instanceof TileCKeyStone ? (TileCKeyStone) world.getTileEntity(x, y, z)
: null;
if (tile != null) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileCKeyStone keyStone) {
ItemStack key = new ItemStack(ModItems.key);
ItemNBTHelper.setInteger(key, "KeyCode", tile.getKeyCode());
ItemNBTHelper.setInteger(key, "KeyCode", keyStone.getKeyCode());
ItemNBTHelper.setInteger(key, "X", x);
ItemNBTHelper.setInteger(key, "Y", y);
ItemNBTHelper.setInteger(key, "Z", z);
@@ -123,8 +113,7 @@ public class CKeyStone extends BlockDE {
}
@Override
public boolean isBlockSolid(IBlockAccess p_149747_1_, int p_149747_2_, int p_149747_3_, int p_149747_4_,
int p_149747_5_) {
public boolean isBlockSolid(IBlockAccess world, int x, int y, int z, int side) {
return true;
}
@@ -14,7 +14,11 @@ import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@@ -19,7 +19,11 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
@@ -3,6 +3,7 @@ package com.brandon3055.draconicevolution.common.blocks;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
@@ -11,6 +12,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.gui.GuiHandler;
@@ -26,7 +28,7 @@ import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ParticleGenerator extends BlockDE {
public class ParticleGenerator extends BlockDE implements ITileEntityProvider {
public static Block instance;
@@ -38,45 +40,45 @@ public class ParticleGenerator extends BlockDE {
ModBlocks.register(this);
}
@SideOnly(Side.CLIENT)
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "machine_side");
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float p_149727_7_,
float p_149727_8_, float p_149727_9_) {
if (world.getBlockMetadata(x, y, z) == 1) return false;
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float subX,
float subY, float subZ) {
if (world.getBlockMetadata(x, y, z) == 1) {
return false;
}
if (player.getHeldItem() != null && player.getHeldItem().getItem() == Items.paper) {
TileEntity tile = world.getTileEntity(x, y, z);
TileParticleGenerator gen = (tile != null && tile instanceof TileParticleGenerator)
? (TileParticleGenerator) tile
: null;
ItemStack stack = player.getHeldItem();
if (gen != null && stack.hasTagCompound() && stack.getTagCompound().hasKey("particles_enabled")) {
gen.setBlockNBT(stack.getTagCompound());
return true;
if (tile instanceof TileParticleGenerator particleGenerator) {
ItemStack stack = player.getHeldItem();
if (stack.hasTagCompound() && stack.getTagCompound().hasKey("particles_enabled")) {
particleGenerator.setBlockNBT(stack.getTagCompound());
return true;
}
}
}
if (player.isSneaking()) {
if (activateEnergyStorageCore(world, x, y, z, player)) return true;
TileEntity tile = world.getTileEntity(x, y, z);
TileParticleGenerator gen = (tile != null && tile instanceof TileParticleGenerator)
? (TileParticleGenerator) tile
: null;
if (gen != null) {
gen.toggleInverted();
if (activateEnergyStorageCore(world, x, y, z, player)) {
return true;
}
} else
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileParticleGenerator particleGenerator) {
particleGenerator.toggleInverted();
}
} else {
FMLNetworkHandler.openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_PARTICLEGEN, world, x, y, z);
}
return true;
}
@SideOnly(Side.CLIENT)
@Override
@SideOnly(Side.CLIENT)
public int getRenderType() {
return -1;
}
@@ -84,11 +86,8 @@ public class ParticleGenerator extends BlockDE {
@Override
public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block block) {
TileEntity tile = world.getTileEntity(x, y, z);
TileParticleGenerator gen = (tile != null && tile instanceof TileParticleGenerator)
? (TileParticleGenerator) tile
: null;
if (gen != null) {
gen.signal = world.isBlockIndirectlyGettingPowered(x, y, z);
if (tile instanceof TileParticleGenerator particleGenerator) {
particleGenerator.hasRedstoneSignal = world.isBlockIndirectlyGettingPowered(x, y, z);
world.markBlockForUpdate(x, y, z);
}
}
@@ -98,44 +97,45 @@ public class ParticleGenerator extends BlockDE {
return true;
}
@SideOnly(Side.CLIENT)
@Override
public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int meta) {
if (world.isRemote) {
Random rand = world.rand;
float modifier = 0.1F;
float SCALE = 1;
double spawnX = x + 0.5D;
double spawnY = y + 0.5D;
double spawnZ = z + 0.5D;
@SideOnly(Side.CLIENT)
public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int metadata) {
if (!world.isRemote) {
return;
}
Random rand = world.rand;
float modifier = 0.1F;
float scale = 1;
double spawnX = x + 0.5D;
double spawnY = y + 0.5D;
double spawnZ = z + 0.5D;
for (int i = 0; i < 100; i++) {
float MX = modifier - ((2f * modifier) * rand.nextFloat());
float MY = modifier - ((2f * modifier) * rand.nextFloat());
float MZ = modifier - ((2f * modifier) * rand.nextFloat());
for (int i = 0; i < 100; i++) {
float motionX = modifier - ((2f * modifier) * rand.nextFloat());
float motionY = modifier - ((2f * modifier) * rand.nextFloat());
float motionZ = modifier - ((2f * modifier) * rand.nextFloat());
{
ParticleCustom particle = new ParticleCustom(
world,
spawnX,
spawnY,
spawnZ,
MX,
MY,
MZ,
SCALE,
false,
1);
particle.red = rand.nextInt(255);
particle.green = rand.nextInt(255);
particle.blue = rand.nextInt(255);
particle.maxAge = rand.nextInt(10);
particle.fadeTime = 20;
particle.fadeLength = 20;
particle.gravity = 0F;
{
ParticleCustom particle = new ParticleCustom(
world,
spawnX,
spawnY,
spawnZ,
motionX,
motionY,
motionZ,
scale,
false,
1);
particle.red = rand.nextInt(255);
particle.green = rand.nextInt(255);
particle.blue = rand.nextInt(255);
particle.maxAge = rand.nextInt(10);
particle.fadeTime = 20;
particle.fadeLength = 20;
particle.gravity = 0F;
ParticleHandler.spawnCustomParticle(particle);
}
ParticleHandler.spawnCustomParticle(particle);
}
}
}
@@ -146,8 +146,7 @@ public class ParticleGenerator extends BlockDE {
}
@Override
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_,
int p_149646_5_) {
public boolean shouldSideBeRendered(IBlockAccess worldIn, int x, int y, int z, int side) {
return false;
}
@@ -157,81 +156,54 @@ public class ParticleGenerator extends BlockDE {
}
@Override
public boolean hasTileEntity(int meta) {
public boolean hasTileEntity(int metadata) {
return true;
}
@Override
public TileEntity createTileEntity(World world, int metadata) {
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileParticleGenerator();
}
private boolean activateEnergyStorageCore(World world, int x, int y, int z, EntityPlayer player) {
for (int x1 = x - 11; x1 <= x + 11; x1++) {
if (world.getBlock(x1, y, z) == ModBlocks.energyStorageCore) {
TileEnergyStorageCore tile = (world.getTileEntity(x1, y, z) != null
&& world.getTileEntity(x1, y, z) instanceof TileEnergyStorageCore)
? (TileEnergyStorageCore) world.getTileEntity(x1, y, z)
: null;
if (tile != null && !tile.isOnline()) {
if (player.capabilities.isCreativeMode) {
if (!tile.creativeActivate()) {
if (world.isRemote) player.addChatComponentMessage(
new ChatComponentTranslation("msg.energyStorageCoreUTA.txt"));
return false;
}
} else {
if (!tile.tryActivate()) {
if (world.isRemote) player.addChatComponentMessage(
new ChatComponentTranslation("msg.energyStorageCoreUTA.txt"));
return false;
}
}
return true;
}
}
}
for (int z1 = z - 11; z1 <= z + 11; z1++) {
if (world.getBlock(x, y, z1) == ModBlocks.energyStorageCore) {
TileEnergyStorageCore tile = (world.getTileEntity(x, y, z1) != null
&& world.getTileEntity(x, y, z1) instanceof TileEnergyStorageCore)
? (TileEnergyStorageCore) world.getTileEntity(x, y, z1)
: null;
if (tile != null && !tile.isOnline()) {
if (player.capabilities.isCreativeMode) {
if (!tile.creativeActivate()) {
if (world.isRemote) player.addChatComponentMessage(
new ChatComponentTranslation("msg.energyStorageCoreUTA.txt"));
return false;
}
} else {
if (!tile.tryActivate()) {
if (world.isRemote) player.addChatComponentMessage(
new ChatComponentTranslation("msg.energyStorageCoreUTA.txt"));
return false;
}
}
return true;
final ForgeDirection[] horizontalDirections = new ForgeDirection[] { ForgeDirection.EAST, ForgeDirection.SOUTH,
ForgeDirection.WEST, ForgeDirection.NORTH };
for (ForgeDirection direction : horizontalDirections) {
for (int distance = 1; distance <= TileEnergyStorageCore.STABILIZER_SEARCH_DISTANCE; distance++) {
int coreX = x + direction.offsetX * distance;
int coreZ = z + direction.offsetZ * distance;
if (world.getBlock(coreX, y, coreZ) == ModBlocks.energyStorageCore) {
return tryActivateEnergyStorageCore(world, coreX, y, coreZ, player);
}
}
}
return false;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block p_149749_5_, int meta) {
if (meta == 1) {
TileEntity tile = world.getTileEntity(x, y, z);
TileParticleGenerator gen = (tile != null && tile instanceof TileParticleGenerator)
? (TileParticleGenerator) tile
: null;
if (gen != null && gen.getMaster() != null) {
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
// LogHelper.info("deActivate");
gen.getMaster().isStructureStillValid(true);
private boolean tryActivateEnergyStorageCore(World world, int coreX, int coreY, int coreZ, EntityPlayer player) {
TileEntity tile = world.getTileEntity(coreX, coreY, coreZ);
if (tile instanceof TileEnergyStorageCore core) {
if (core.tryActivate(player.capabilities.isCreativeMode)) {
return true;
}
if (world.isRemote) {
player.addChatComponentMessage(new ChatComponentTranslation("msg.energyStorageCoreUTA.txt"));
}
}
super.breakBlock(world, x, y, z, p_149749_5_, meta);
return false;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block blockBroken, int metadata) {
if (metadata == 1) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileParticleGenerator particleGenerator) {
if (particleGenerator.getMaster() != null) {
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
particleGenerator.getMaster().validateStructure(true);
}
}
}
super.breakBlock(world, x, y, z, blockBroken, metadata);
}
}
@@ -1,6 +1,11 @@
package com.brandon3055.draconicevolution.common.blocks;
import static net.minecraftforge.common.util.ForgeDirection.*;
import static net.minecraftforge.common.util.ForgeDirection.DOWN;
import static net.minecraftforge.common.util.ForgeDirection.EAST;
import static net.minecraftforge.common.util.ForgeDirection.NORTH;
import static net.minecraftforge.common.util.ForgeDirection.SOUTH;
import static net.minecraftforge.common.util.ForgeDirection.UP;
import static net.minecraftforge.common.util.ForgeDirection.WEST;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@@ -12,10 +12,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler;
import cofh.api.energy.IEnergyContainerItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -0,0 +1,84 @@
package com.brandon3055.draconicevolution.common.blocks.machine;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.blocks.BlockDE;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.tileentities.TileDislocatorInhibitor;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class DislocatorInhibitor extends BlockDE implements ITileEntityProvider {
public DislocatorInhibitor() {
this.setBlockName(Strings.dislocatorInhibitor);
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
this.setStepSound(soundTypeStone);
ModBlocks.register(this);
}
@Override
public boolean isBlockSolid(IBlockAccess world, int x, int y, int z, int side) {
return true;
}
@Override
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
return true;
}
@Override
public boolean hasTileEntity(int metadata) {
return true;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileDislocatorInhibitor();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float prx,
float pry, float prz) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile != null) {
if (tile instanceof TileDislocatorInhibitor te) {
if (!player.isSneaking()) te.increaseRange();
else te.decreaseRange();
if (world.isRemote) player.addChatMessage(new ChatComponentText("Range: " + te.getRange()));
}
}
return true;
}
@Override
public void breakBlock(World worldIn, int x, int y, int z, Block blockBroken, int meta) {
TileEntity tile = worldIn.getTileEntity(x, y, z);
if (tile != null) {
if (tile instanceof TileDislocatorInhibitor) {
((TileDislocatorInhibitor) tile).unregister();
}
}
super.breakBlock(worldIn, x, y, z, blockBroken, meta);
}
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "inhibitor_block");
}
}
@@ -24,7 +24,12 @@ import com.brandon3055.draconicevolution.common.blocks.BlockDE;
import com.brandon3055.draconicevolution.common.blocks.itemblocks.EnergyCrystalItemBlock;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.tileentities.energynet.*;
import com.brandon3055.draconicevolution.common.tileentities.energynet.IRemoteEnergyHandler;
import com.brandon3055.draconicevolution.common.tileentities.energynet.LinkedEnergyDevice;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyRelay;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyTransceiver;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileRemoteEnergyBase;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileWirelessEnergyTransceiver;
import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock;
import cpw.mods.fml.relauncher.Side;
@@ -1,6 +1,7 @@
package com.brandon3055.draconicevolution.common.blocks.machine;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
@@ -18,11 +19,18 @@ import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetector;
public class PlayerDetector extends BlockDE {
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class PlayerDetector extends BlockDE implements ITileEntityProvider {
@SideOnly(Side.CLIENT)
IIcon side_inactive;
@SideOnly(Side.CLIENT)
IIcon side_active;
@SideOnly(Side.CLIENT)
IIcon top;
@SideOnly(Side.CLIENT)
IIcon bottom;
public PlayerDetector() {
@@ -33,6 +41,7 @@ public class PlayerDetector extends BlockDE {
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
side_inactive = iconRegister.registerIcon(References.RESOURCESPREFIX + "player_detector_side_inactive");
side_active = iconRegister.registerIcon(References.RESOURCESPREFIX + "player_detector_side_active");
@@ -40,28 +49,39 @@ public class PlayerDetector extends BlockDE {
bottom = iconRegister.registerIcon(References.RESOURCESPREFIX + "machine_side");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
if (side == 0) {
return bottom;
}
if (side == 1) {
return top;
}
IIcon side_icon;
TileEntity tile = world.getTileEntity(x, y, z);
if (tile != null && tile instanceof TilePlayerDetector && ((TilePlayerDetector) tile).output)
if (tile instanceof TilePlayerDetector detector && detector.shouldOutput()) {
side_icon = side_active;
else side_icon = side_inactive;
if (side == 0) return bottom;
else if (side == 1) return top;
else return side_icon;
} else {
side_icon = side_inactive;
}
return side_icon;
}
@Override
public IIcon getIcon(int side, int meta) {
if (side == 0) return bottom;
else if (side == 1) return top;
else return side_active;
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
if (side == 0) {
return bottom;
}
if (side == 1) {
return top;
}
return side_active;
}
@Override
public boolean isBlockSolid(IBlockAccess p_149747_1_, int p_149747_2_, int p_149747_3_, int p_149747_4_,
int p_149747_5_) {
public boolean isBlockSolid(IBlockAccess world, int x, int y, int z, int side) {
return true;
}
@@ -71,19 +91,18 @@ public class PlayerDetector extends BlockDE {
}
@Override
public boolean hasTileEntity(int meta) {
public boolean hasTileEntity(int metadata) {
return true;
}
@Override
public TileEntity createTileEntity(World world, int metadata) {
public TileEntity createNewTileEntity(World world, int metadata) {
return new TilePlayerDetector();
}
@Override
public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) {
if (side == 0 || side == 1) return false;
else return true;
return side >= 0;
}
@Override
@@ -92,27 +111,21 @@ public class PlayerDetector extends BlockDE {
}
@Override
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int meta) {
TileEntity te = world.getTileEntity(x, y, z);
TilePlayerDetector detector = (te != null && te instanceof TilePlayerDetector) ? (TilePlayerDetector) te : null;
if (detector != null) return detector.output ? 15 : 0;
else return 0;
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) {
return isProvidingStrongPower(world, x, y, z, side);
}
@Override
public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int meta) {
TileEntity te = world.getTileEntity(x, y, z);
TilePlayerDetector detector = (te != null && te instanceof TilePlayerDetector) ? (TilePlayerDetector) te : null;
if (detector != null) return detector.output ? 15 : 0;
else return 0;
public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side) {
TileEntity tile = world.getTileEntity(x, y, z);
return tile instanceof TilePlayerDetector detector && detector.shouldOutput() ? 15 : 0;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float p_149727_7_,
float p_149727_8_, float p_149727_9_) {
TileEntity te = world.getTileEntity(x, y, z);
TilePlayerDetector detector = (te != null && te instanceof TilePlayerDetector) ? (TilePlayerDetector) te : null;
if (detector != null) {
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float subX,
float subY, float subZ) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TilePlayerDetector detector) {
int range = detector.getRange();
if (player.isSneaking()) {
@@ -121,25 +134,27 @@ public class PlayerDetector extends BlockDE {
range++;
}
if (range > 10) range = 1;
if (range < 1) range = 10;
detector.setRange(range);
if (world.isRemote) player.addChatMessage(
new ChatComponentTranslation("msg.range.txt").appendSibling(new ChatComponentText(" " + range)));
if (world.isRemote) {
player.addChatMessage(
new ChatComponentTranslation("msg.range.txt")
.appendSibling(new ChatComponentText(" " + detector.getRange())));
}
}
return true;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
super.breakBlock(world, x, y, z, block, meta);
world.notifyBlocksOfNeighborChange(x - 1, y, z, world.getBlock(x, y, z));
world.notifyBlocksOfNeighborChange(x + 1, y, z, world.getBlock(x, y, z));
world.notifyBlocksOfNeighborChange(x, y - 1, z, world.getBlock(x, y, z));
world.notifyBlocksOfNeighborChange(x, y + 1, z, world.getBlock(x, y, z));
world.notifyBlocksOfNeighborChange(x, y, z - 1, world.getBlock(x, y, z));
world.notifyBlocksOfNeighborChange(x, y, z + 1, world.getBlock(x, y, z));
public void breakBlock(World world, int x, int y, int z, Block blockBroken, int metadata) {
super.breakBlock(world, x, y, z, blockBroken, metadata);
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
world.notifyBlocksOfNeighborChange(
x + direction.offsetX,
y + direction.offsetY,
z + direction.offsetZ,
blockBroken,
direction.getOpposite().ordinal());
}
}
}
@@ -28,9 +28,13 @@ import cpw.mods.fml.relauncher.SideOnly;
public class PlayerDetectorAdvanced extends BlockCustomDrop {
@SideOnly(Side.CLIENT)
IIcon side_inactive;
@SideOnly(Side.CLIENT)
IIcon side_active;
@SideOnly(Side.CLIENT)
IIcon top;
@SideOnly(Side.CLIENT)
IIcon bottom;
public PlayerDetectorAdvanced() {
@@ -41,8 +45,8 @@ public class PlayerDetectorAdvanced extends BlockCustomDrop {
ModBlocks.register(this);
}
@SideOnly(Side.CLIENT)
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
side_inactive = iconRegister
.registerIcon(References.RESOURCESPREFIX + "advanced_player_detector_side_inactive");
@@ -52,8 +56,7 @@ public class PlayerDetectorAdvanced extends BlockCustomDrop {
}
@Override
public boolean isBlockSolid(IBlockAccess p_149747_1_, int p_149747_2_, int p_149747_3_, int p_149747_4_,
int p_149747_5_) {
public boolean isBlockSolid(IBlockAccess world, int x, int y, int z, int side) {
return true;
}
@@ -62,47 +65,50 @@ public class PlayerDetectorAdvanced extends BlockCustomDrop {
return true;
}
@SideOnly(Side.CLIENT)
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
IIcon side_icon;
TileEntity tile = world.getTileEntity(x, y, z);
TilePlayerDetectorAdvanced detector = (tile != null && tile instanceof TilePlayerDetectorAdvanced)
? (TilePlayerDetectorAdvanced) tile
: null;
if (detector != null && detector.getStackInSlot(0) != null) {
ItemStack stack = detector.getStackInSlot(0);
Block block = Block.getBlockFromItem(stack.getItem());
if (block != null && block.renderAsNormalBlock()) return block.getIcon(side, stack.getItemDamage());
} else {
if (detector != null && detector.output) side_icon = side_active;
else side_icon = side_inactive;
if (side == 0) return bottom;
else if (side == 1) return top;
else return side_icon;
if (tile instanceof TilePlayerDetectorAdvanced detector) {
if (detector.getStackInSlot(0) != null) {
ItemStack stack = detector.getStackInSlot(0);
Block block = Block.getBlockFromItem(stack.getItem());
if (block != null && block.renderAsNormalBlock()) {
return block.getIcon(side, stack.getItemDamage());
}
} else {
if (side == 0) {
return bottom;
}
if (side == 1) {
return top;
}
return detector.shouldOutput() ? side_active : side_inactive;
}
}
return null;
return side_active;
}
@Override
@SideOnly(Side.CLIENT)
@Override
public IIcon getIcon(int side, int meta) {
if (side == 0) return bottom;
else if (side == 1) return top;
else return side_active;
public IIcon getIcon(int side, int metadata) {
if (side == 0) {
return bottom;
}
if (side == 1) {
return top;
}
return side_active;
}
@Override
public TileEntity createNewTileEntity(World var1, int var2) {
public TileEntity createNewTileEntity(World world, int metadata) {
return new TilePlayerDetectorAdvanced();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_,
float p_149727_7_, float p_149727_8_, float p_149727_9_) {
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float subX,
float subY, float subZ) {
if (!world.isRemote) {
FMLNetworkHandler
.openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_PLAYERDETECTOR, world, x, y, z);
@@ -112,8 +118,7 @@ public class PlayerDetectorAdvanced extends BlockCustomDrop {
@Override
public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) {
if (side == 0 || side == 1) return false;
else return true;
return side >= 0;
}
@Override
@@ -122,25 +127,14 @@ public class PlayerDetectorAdvanced extends BlockCustomDrop {
}
@Override
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int meta) {
TileEntity te = world.getTileEntity(x, y, z);
TilePlayerDetectorAdvanced detector = (te != null && te instanceof TilePlayerDetectorAdvanced)
? (TilePlayerDetectorAdvanced) te
: null;
if (detector != null) if (!detector.outputInverted) return detector.output ? 15 : 0;
else return detector.output ? 0 : 15;
else return 0;
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) {
return isProvidingStrongPower(world, x, y, z, side);
}
@Override
public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int meta) {
TileEntity te = world.getTileEntity(x, y, z);
TilePlayerDetectorAdvanced detector = (te != null && te instanceof TilePlayerDetectorAdvanced)
? (TilePlayerDetectorAdvanced) te
: null;
if (detector != null) if (!detector.outputInverted) return detector.output ? 15 : 0;
else return detector.output ? 0 : 15;
else return 0;
public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side) {
TileEntity tile = world.getTileEntity(x, y, z);
return tile instanceof TilePlayerDetectorAdvanced detector && detector.shouldOutput() ? 15 : 0;
}
@Override
@@ -154,17 +148,30 @@ public class PlayerDetectorAdvanced extends BlockCustomDrop {
}
@Override
protected void getCustomTileEntityDrops(TileEntity te, List<ItemStack> droppes) {}
protected void getCustomTileEntityDrops(TileEntity tile, List<ItemStack> drops) {}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
TilePlayerDetectorAdvanced detector = (te != null && te instanceof TilePlayerDetectorAdvanced)
? (TilePlayerDetectorAdvanced) te
: null;
if (detector != null && detector.getStackInSlot(0) != null) {
return detector.getStackInSlot(0);
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TilePlayerDetectorAdvanced detector) {
ItemStack stackInSlot = detector.getStackInSlot(0);
if (stackInSlot != null) {
return stackInSlot;
}
}
return super.getPickBlock(target, world, x, y, z, player);
}
@Override
public void breakBlock(World world, int x, int y, int z, Block blockBroken, int metadata) {
super.breakBlock(world, x, y, z, blockBroken, metadata);
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
world.notifyBlocksOfNeighborChange(
x + direction.offsetX,
y + direction.offsetY,
z + direction.offsetZ,
blockBroken,
direction.getOpposite().ordinal());
}
return super.getPickBlock(target, world, x, y, z);
}
}
@@ -22,11 +22,15 @@ import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKI;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileDislocatorReceptacle;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Created by Brandon on 19/5/2015.
*/
public class DislocatorReceptacle extends BlockCustomDrop implements ITileEntityProvider {
@SideOnly(Side.CLIENT)
IIcon textureInactive;
public DislocatorReceptacle() {
@@ -41,6 +45,7 @@ public class DislocatorReceptacle extends BlockCustomDrop implements ITileEntity
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
textureInactive = iconRegister
.registerIcon(References.RESOURCESPREFIX + "animated/dislocatorReceptacle_inactive");
@@ -48,23 +53,21 @@ public class DislocatorReceptacle extends BlockCustomDrop implements ITileEntity
}
@Override
public IIcon getIcon(IBlockAccess access, int x, int y, int z, int side) {
TileDislocatorReceptacle tile = access.getTileEntity(x, y, z) instanceof TileDislocatorReceptacle
? (TileDislocatorReceptacle) access.getTileEntity(x, y, z)
: null;
if (tile != null) return tile.isActive ? blockIcon : textureInactive;
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileDislocatorReceptacle receptacle) {
return receptacle.isActive ? blockIcon : textureInactive;
}
return blockIcon;
}
@Override
public void updateTick(World world, int x, int y, int z, Random random) {
TileDislocatorReceptacle tile = (TileDislocatorReceptacle) world.getTileEntity(x, y, z);
if (tile != null) tile.updateState();
}
@Override
public IIcon getIcon(int p_149691_1_, int meta) {
return blockIcon;
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileDislocatorReceptacle receptacle) {
receptacle.updateState();
}
}
@Override
@@ -72,44 +75,44 @@ public class DislocatorReceptacle extends BlockCustomDrop implements ITileEntity
return true;
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileDislocatorReceptacle();
}
@Override
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
return false;
}
@Override
public TileEntity createNewTileEntity(World world, int i) {
return new TileDislocatorReceptacle();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float p_149727_7_,
float p_149727_8_, float p_149727_9_) {
if (world.isRemote) return true;
TileDislocatorReceptacle tile = (TileDislocatorReceptacle) world.getTileEntity(x, y, z);
if (tile == null) return false;
if (tile.getStackInSlot(0) != null) {
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float subX,
float subY, float subZ) {
if (world.isRemote) {
return true;
}
TileEntity tile = world.getTileEntity(x, y, z);
if (!(tile instanceof TileDislocatorReceptacle receptacle)) {
return false;
}
ItemStack stackInSlot = receptacle.getStackInSlot(0);
if (stackInSlot != null) {
if (player.getHeldItem() == null) {
player.inventory.setInventorySlotContents(player.inventory.currentItem, tile.getStackInSlot(0));
tile.setInventorySlotContents(0, null);
player.inventory.setInventorySlotContents(player.inventory.currentItem, stackInSlot);
} else {
world.spawnEntityInWorld(
new EntityItem(world, player.posX, player.posY, player.posZ, tile.getStackInSlot(0)));
tile.setInventorySlotContents(0, null);
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, stackInSlot));
}
receptacle.setInventorySlotContents(0, null);
world.markBlockForUpdate(x, y, z);
world.notifyBlockChange(x, y, z, this);
} else {
ItemStack stack = player.getHeldItem();
if (stack != null && stack.getItem() instanceof TeleporterMKI
&& ((TeleporterMKI) stack.getItem()).getLocation(stack) != null) {
tile.setInventorySlotContents(0, player.getHeldItem());
if (stack != null && stack.getItem() instanceof TeleporterMKI teleporter
&& teleporter.getLocation(stack) != null) {
receptacle.setInventorySlotContents(0, player.getHeldItem());
player.destroyCurrentEquippedItem();
}
}
return true;
}
@@ -120,8 +123,13 @@ public class DislocatorReceptacle extends BlockCustomDrop implements ITileEntity
@Override
public int getComparatorInputOverride(World world, int x, int y, int z, int p_149736_5_) {
TileDislocatorReceptacle tile = (TileDislocatorReceptacle) world.getTileEntity(x, y, z);
return tile == null ? 0 : tile.getStackInSlot(0) != null ? 15 : 0;
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileDislocatorReceptacle receptacle) {
if (receptacle.getStackInSlot(0) != null) {
return 15;
}
}
return 0;
}
@Override
@@ -135,5 +143,5 @@ public class DislocatorReceptacle extends BlockCustomDrop implements ITileEntity
}
@Override
protected void getCustomTileEntityDrops(TileEntity te, List<ItemStack> droppes) {}
protected void getCustomTileEntityDrops(TileEntity tile, List<ItemStack> drops) {}
}
@@ -1,80 +0,0 @@
package com.brandon3055.draconicevolution.common.blocks.multiblock;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.blocks.BlockDE;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEarth;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class Earth extends BlockDE {
public Earth() {
super(Material.iron);
this.setHardness(10F);
this.setResistance(20f);
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
this.setBlockName(Strings.earthName);
ModBlocks.register(this);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "transparency");
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean canRenderInPass(int a) {
return true;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean hasTileEntity(int metadata) {
return true;
}
@Override
public TileEntity createTileEntity(World world, int metadata) {
return new TileEarth();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_,
float p_149727_7_, float p_149727_8_, float p_149727_9_) {
TileEarth tile = (TileEarth) world.getTileEntity(x, y, z);
if (player.isSneaking()) {
tile.incrementSize();
} else {
tile.increaseRotationSpeed();
}
if (!world.isRemote) {
player.addChatComponentMessage(new ChatComponentText("Rotation Speed:" + tile.getRotationSpeed()));
player.addChatComponentMessage(new ChatComponentText("Size: " + tile.getSize()));
}
return true;
}
}
@@ -1,6 +1,7 @@
package com.brandon3055.draconicevolution.common.blocks.multiblock;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
@@ -23,12 +24,13 @@ import cpw.mods.fml.relauncher.SideOnly;
/**
* Created by Brandon on 28/07/2014.
*/
public class EnergyPylon extends BlockDE { // todo fix sphere renderer
public class EnergyPylon extends BlockDE implements ITileEntityProvider {
@SideOnly(Side.CLIENT)
public IIcon icon_active_face;
@SideOnly(Side.CLIENT)
public IIcon icon_input;
@SideOnly(Side.CLIENT)
public IIcon icon_output;
public EnergyPylon() {
@@ -46,9 +48,8 @@ public class EnergyPylon extends BlockDE { // todo fix sphere renderer
}
@Override
public TileEntity createTileEntity(World world, int metadata) {
if (metadata == 1 || metadata == 2) return new TileEnergyPylon();
else return null;
public TileEntity createNewTileEntity(World world, int metadata) {
return metadata == 1 || metadata == 2 ? new TileEnergyPylon() : null;
}
@Override
@@ -61,109 +62,80 @@ public class EnergyPylon extends BlockDE { // todo fix sphere renderer
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
if (meta == 1 && side == 1) return icon_active_face;
if (meta == 2 && side == 0) return icon_active_face;
return icon_input;
public IIcon getIcon(int side, int metadata) {
return metadata == 1 && side == 1 || metadata == 2 && side == 0 ? icon_active_face : icon_input;
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
int meta = world.getBlockMetadata(x, y, z);
if (meta == 1 && side == 1) return icon_active_face;
if (meta == 2 && side == 0) return icon_active_face;
TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null
&& world.getTileEntity(x, y, z) instanceof TileEnergyPylon)
? (TileEnergyPylon) world.getTileEntity(x, y, z)
: null;
if (thisTile == null) return icon_input;
return !thisTile.reciveEnergy ? icon_output : icon_input;
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 1 && side == 1 || metadata == 2 && side == 0) return icon_active_face;
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEnergyPylon pylon) {
return pylon.isReceivingEnergy ? icon_input : icon_output;
}
return icon_input;
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) {
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0) {
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) {
updateBlockState(world, x, y, z);
}
private void updateBlockState(World world, int x, int y, int z) {
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 0) {
if (world.getBlock(x, y + 1, z) == Blocks.glass) {
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
metadata = 1;
world.setBlockMetadataWithNotify(x, y, z, metadata, 2);
world.setBlock(x, y + 1, z, ModBlocks.invisibleMultiblock, 2, 2);
} else if (world.getBlock(x, y - 1, z) == Blocks.glass) {
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
metadata = 2;
world.setBlockMetadataWithNotify(x, y, z, metadata, 2);
world.setBlock(x, y - 1, z, ModBlocks.invisibleMultiblock, 2, 2);
}
} else {
TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null
&& world.getTileEntity(x, y, z) instanceof TileEnergyPylon)
? (TileEnergyPylon) world.getTileEntity(x, y, z)
: null;
if (thisTile == null || (meta == 1 && !isGlass(world, x, y + 1, z))
|| (meta == 2 && !isGlass(world, x, y - 1, z))) {
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
TileEntity tile = world.getTileEntity(x, y, z);
if (!(tile instanceof TileEnergyPylon) || (metadata == 1 && isGlassMissing(world, x, y + 1, z))
|| (metadata == 2 && isGlassMissing(world, x, y - 1, z))) {
metadata = 0;
world.setBlockMetadataWithNotify(x, y, z, metadata, 2);
}
}
TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null
&& world.getTileEntity(x, y, z) instanceof TileEnergyPylon)
? (TileEnergyPylon) world.getTileEntity(x, y, z)
: null;
if (thisTile != null) {
thisTile.onActivated();
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEnergyPylon) {
((TileEnergyPylon) tile).onActivated();
if (metadata == 0) {
world.removeTileEntity(x, y, z);
}
}
if (world.getBlockMetadata(x, y, z) == 0 && world.getTileEntity(x, y, z) != null)
world.removeTileEntity(x, y, z);
}
private boolean isGlass(World world, int x, int y, int z) {
return world.getBlock(x, y, z) == ModBlocks.invisibleMultiblock && world.getBlockMetadata(x, y, z) == 2;
private boolean isGlassMissing(World world, int x, int y, int z) {
return world.getBlock(x, y, z) != ModBlocks.invisibleMultiblock || world.getBlockMetadata(x, y, z) != 2;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_,
float p_149727_7_, float p_149727_8_, float p_149727_9_) {
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0) return false;
TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null
&& world.getTileEntity(x, y, z) instanceof TileEnergyPylon)
? (TileEnergyPylon) world.getTileEntity(x, y, z)
: null;
if (thisTile != null) {
if (!player.isSneaking()) thisTile.onActivated();
else thisTile.nextCore();
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float subX,
float subY, float subZ) {
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 0) return false;
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEnergyPylon pylon) {
if (player.isSneaking()) {
pylon.nextCore();
} else {
pylon.onActivated();
}
return true;
}
return false;
}
@Override
public void onPostBlockPlaced(World world, int x, int y, int z, int p_149714_5_) {
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0) {
if (world.getBlock(x, y + 1, z) == Blocks.glass) {
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
world.setBlock(x, y + 1, z, ModBlocks.invisibleMultiblock, 2, 2);
} else if (world.getBlock(x, y - 1, z) == Blocks.glass) {
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
world.setBlock(x, y - 1, z, ModBlocks.invisibleMultiblock, 2, 2);
}
} else {
TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null
&& world.getTileEntity(x, y, z) instanceof TileEnergyPylon)
? (TileEnergyPylon) world.getTileEntity(x, y, z)
: null;
if (thisTile == null || (meta == 1 && !isGlass(world, x, y + 1, z))
|| (meta == 2 && !isGlass(world, x, y - 1, z))) {
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
}
}
TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null
&& world.getTileEntity(x, y, z) instanceof TileEnergyPylon)
? (TileEnergyPylon) world.getTileEntity(x, y, z)
: null;
if (thisTile != null) {
thisTile.onActivated();
}
if (world.getBlockMetadata(x, y, z) == 0 && world.getTileEntity(x, y, z) != null)
world.removeTileEntity(x, y, z);
public void onPostBlockPlaced(World world, int x, int y, int z, int metadata) {
updateBlockState(world, x, y, z);
}
@Override
@@ -172,11 +144,11 @@ public class EnergyPylon extends BlockDE { // todo fix sphere renderer
}
@Override
public int getComparatorInputOverride(World world, int x, int y, int z, int meta) {
TileEnergyPylon tile = world.getTileEntity(x, y, z) instanceof TileEnergyPylon
? (TileEnergyPylon) world.getTileEntity(x, y, z)
: null;
if (tile != null) return (int) (tile.getEnergyStored() / tile.getMaxEnergyStored() * 15D);
public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEnergyPylon pylon) {
return (int) (pylon.getEnergyStored() / pylon.getMaxEnergyStored() * 15D);
}
return 0;
}
}
@@ -1,22 +1,20 @@
package com.brandon3055.draconicevolution.common.blocks.multiblock;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.StatCollector;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.brandon3055.brandonscore.common.utills.InfoHelper;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.blocks.BlockDE;
@@ -32,7 +30,7 @@ import cpw.mods.fml.relauncher.SideOnly;
/**
* Created by Brandon on 25/07/2014.
*/
public class EnergyStorageCore extends BlockDE implements IHudDisplayBlock {
public class EnergyStorageCore extends BlockDE implements IHudDisplayBlock, ITileEntityProvider {
public EnergyStorageCore() {
super(Material.iron);
@@ -65,34 +63,23 @@ public class EnergyStorageCore extends BlockDE implements IHudDisplayBlock {
}
@Override
public TileEntity createTileEntity(World world, int metadata) {
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileEnergyStorageCore();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_,
float p_149727_7_, float p_149727_8_, float p_149727_9_) {
TileEnergyStorageCore tile = (world.getTileEntity(x, y, z) != null
&& world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore)
? (TileEnergyStorageCore) world.getTileEntity(x, y, z)
: null;
if (tile == null) {
LogHelper.error("Missing Tile Entity (EnergyStorageCore)");
return false;
}
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float subX,
float subY, float subZ) {
if (!world.isRemote) {
player.addChatComponentMessage(new ChatComponentText("Tier:" + (tile.getTier() + 1)));
String BN = String.valueOf(tile.getEnergyStored());
player.addChatComponentMessage(
new ChatComponentText(
StatCollector.translateToLocal("info.de.charge.txt") + ": "
+ Utills.formatNumber(tile.getEnergyStored())
+ " / "
+ Utills.formatNumber(tile.getMaxEnergyStored())
+ " ["
+ BN
+ " RF]"));
TileEntity tile = world.getTileEntity(x, y, z);
if (!(tile instanceof TileEnergyStorageCore core)) {
LogHelper.error("Missing Tile Entity (EnergyStorageCore)");
return false;
}
List<String> information = core.getDisplayInformation(false);
for (String message : information) {
player.addChatComponentMessage(new ChatComponentText(message));
}
}
return true;
}
@@ -100,96 +87,60 @@ public class EnergyStorageCore extends BlockDE implements IHudDisplayBlock {
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
TileEnergyStorageCore tile = (world.getTileEntity(
x - ForgeDirection.getOrientation(side).offsetX,
y - ForgeDirection.getOrientation(side).offsetY,
z - ForgeDirection.getOrientation(side).offsetZ) != null
&& world.getTileEntity(
x - ForgeDirection.getOrientation(side).offsetX,
y - ForgeDirection.getOrientation(side).offsetY,
z - ForgeDirection.getOrientation(side).offsetZ) instanceof TileEnergyStorageCore)
? (TileEnergyStorageCore) world.getTileEntity(
x - ForgeDirection.getOrientation(side).offsetX,
y - ForgeDirection.getOrientation(side).offsetY,
z - ForgeDirection.getOrientation(side).offsetZ)
: null;
// LogHelper.error(world.getTileEntity(x - ForgeDirection.getOrientation(side).offsetX, y -
// ForgeDirection.getOrientation(side).offsetY, z - ForgeDirection.getOrientation(side).offsetZ));
if (tile == null) {
ForgeDirection direction = ForgeDirection.getOrientation(side);
TileEntity tile = world.getTileEntity(x - direction.offsetX, y - direction.offsetY, z - direction.offsetZ);
if (!(tile instanceof TileEnergyStorageCore core)) {
LogHelper.error("Missing Tile Entity (EnergyStorageCore)(shouldSideBeRendered)");
return true;
}
if (tile.isOnline()) return false;
else return super.shouldSideBeRendered(world, x, y, z, side);
return !core.isOnline() && super.shouldSideBeRendered(world, x, y, z, side);
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) {
TileEnergyStorageCore thisTile = (world.getTileEntity(x, y, z) != null
&& world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore)
? (TileEnergyStorageCore) world.getTileEntity(x, y, z)
: null;
if (thisTile != null && thisTile.isOnline() && thisTile.getTier() == 0) {
thisTile.isStructureStillValid(false);
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEnergyStorageCore core) {
if (core.isOnline() && core.getTier() == 0) {
core.validateStructure(false);
}
}
}
@Override
public void breakBlock(World world, int x, int y, int z, Block p_149749_5_, int p_149749_6_) {
TileEnergyStorageCore thisTile = (world.getTileEntity(x, y, z) != null
&& world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore)
? (TileEnergyStorageCore) world.getTileEntity(x, y, z)
: null;
if (thisTile != null && thisTile.isOnline() && thisTile.getTier() == 0) {
thisTile.deactivateStabilizers();
public void breakBlock(World world, int x, int y, int z, Block blockBroken, int metadata) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEnergyStorageCore core) {
if (core.isOnline() && core.getTier() == 0) {
core.deactivateStabilizers();
}
}
super.breakBlock(world, x, y, z, p_149749_5_, p_149749_6_);
super.breakBlock(world, x, y, z, blockBroken, metadata);
}
@Override
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
TileEnergyStorageCore thisTile = (world.getTileEntity(x, y, z) != null
&& world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore)
? (TileEnergyStorageCore) world.getTileEntity(x, y, z)
: null;
if (thisTile != null && thisTile.isOnline()) {
return AxisAlignedBB.getBoundingBox(
thisTile.xCoord + 0.5,
thisTile.yCoord + 0.5,
thisTile.zCoord + 0.5,
thisTile.xCoord + 0.5,
thisTile.yCoord + 0.5,
thisTile.zCoord + 0.5);
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEnergyStorageCore core) {
if (core.isOnline()) {
return AxisAlignedBB.getBoundingBox(
core.xCoord + 0.5,
core.yCoord + 0.5,
core.zCoord + 0.5,
core.xCoord + 0.5,
core.yCoord + 0.5,
core.zCoord + 0.5);
}
}
return super.getSelectedBoundingBoxFromPool(world, x, y, z);
}
@Override
public List<String> getDisplayData(World world, int x, int y, int z) {
List<String> list = new ArrayList<String>();
TileEnergyStorageCore tile = (world.getTileEntity(x, y, z) != null
&& world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore)
? (TileEnergyStorageCore) world.getTileEntity(x, y, z)
: null;
if (tile == null) {
TileEntity tile = world.getTileEntity(x, y, z);
if (!(tile instanceof TileEnergyStorageCore core)) {
LogHelper.error("Missing Tile Entity (EnergyStorageCore getDisplayData)");
return list;
return Collections.emptyList();
}
list.add(InfoHelper.HITC() + getLocalizedName());
list.add("Tier: " + InfoHelper.ITC() + (tile.getTier() + 1));
String BN = String.valueOf(tile.getEnergyStored());
list.add(
StatCollector.translateToLocal("info.de.charge.txt") + ": "
+ InfoHelper.ITC()
+ Utills.formatNumber(tile.getEnergyStored())
+ " / "
+ Utills.formatNumber(tile.getMaxEnergyStored())
+ " ["
+ BN
+ " RF]");
return list;
return core.getDisplayInformation(true);
}
}
@@ -1,30 +1,68 @@
package com.brandon3055.draconicevolution.common.blocks.multiblock;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.StatCollector;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
/**
* Created by Brandon on 23/7/2015.
*/
public interface IReactorPart {
public static int RMODE_TEMP = 0;
public static int RMODE_TEMP_INV = 1;
public static int RMODE_FIELD = 2;
public static int RMODE_FIELD_INV = 3;
public static int RMODE_SAT = 4;
public static int RMODE_SAT_INV = 5;
public static int RMODE_FUEL = 6;
public static int RMODE_FUEL_INV = 7;
enum ComparatorMode {
public MultiblockHelper.TileLocation getMaster();
TEMPERATURE,
TEMPERATURE_INVERTED,
FIELD_CHARGE,
FIELD_CHARGE_INVERTED,
ENERGY_SATURATION,
ENERGY_SATURATION_INVERTED,
CONVERTED_FUEL,
CONVERTED_FUEL_INVERTED;
public void shutDown();
private static final ComparatorMode[] values = values();
public boolean checkForMaster();
public static ComparatorMode getMode(int ordinal) {
return ordinal >= 0 && ordinal < values.length ? values[ordinal] : TEMPERATURE;
}
public boolean isActive();
public ComparatorMode next() {
return values[(ordinal() + 1) % values.length];
}
public String getRedstoneModeString();
public String toLocalizedString() {
return StatCollector.translateToLocal("msg.de.reactorRSMode." + ordinal() + ".txt");
}
}
public void changeRedstoneMode();
static int getComparatorOutput(IBlockAccess world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof IReactorPart part) {
TileReactorCore core = part.getMaster();
if (core != null) {
return core.getComparatorOutput(part.getComparatorMode());
}
}
return 0;
}
public int getRedstoneMode();
TileLocation getMasterLocation();
TileReactorCore getMaster();
void setUp(TileLocation masterLocation);
void shutDown();
boolean isActive();
ForgeDirection getFacing();
ComparatorMode getComparatorMode();
void changeComparatorMode();
}
@@ -1,10 +1,11 @@
package com.brandon3055.draconicevolution.common.blocks.multiblock;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
@@ -15,11 +16,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import com.brandon3055.brandonscore.common.utills.InfoHelper;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.blocks.BlockDE;
import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler;
@@ -37,13 +35,33 @@ import cpw.mods.fml.relauncher.SideOnly;
/**
* Created by Brandon on 25/07/2014.
*/
public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock {
public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock, ITileEntityProvider {
public static void revertStructure(World world, int x, int y, int z) {
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 0) {
world.setBlock(
x,
y,
z,
BalanceConfigHandler.energyStorageStructureOuterBlock,
BalanceConfigHandler.energyStorageStructureOuterBlockMetadata,
3);
} else if (metadata == 1) {
world.setBlock(
x,
y,
z,
BalanceConfigHandler.energyStorageStructureBlock,
BalanceConfigHandler.energyStorageStructureBlockMetadata,
3);
}
}
public InvisibleMultiblock() {
super(Material.iron);
this.setHardness(10F);
this.setResistance(2000F);
// this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setBlockName(Strings.invisibleMultiblockName);
ModBlocks.register(this);
}
@@ -76,17 +94,16 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock {
}
@Override
public TileEntity createTileEntity(World world, int metadata) {
if (metadata == 0 || metadata == 1) return new TileInvisibleMultiblock();
else return null;
public TileEntity createNewTileEntity(World world, int metadata) {
return metadata == 0 || metadata == 1 ? new TileInvisibleMultiblock() : null;
}
@Override
public Item getItemDropped(int meta, Random p_149650_2_, int var2) {
if (meta == 0) {
public Item getItemDropped(int metadata, Random random, int fortune) {
if (metadata == 0) {
return Item.getItemFromBlock(BalanceConfigHandler.energyStorageStructureOuterBlock);
}
if (meta == 1) {
if (metadata == 1) {
return Item.getItemFromBlock(BalanceConfigHandler.energyStorageStructureBlock);
}
return null;
@@ -104,48 +121,37 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock {
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_,
float p_149727_7_, float p_149727_8_, float p_149727_9_) {
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0 || meta == 1) {
TileInvisibleMultiblock thisTile = (world.getTileEntity(x, y, z) != null
&& world.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock)
? (TileInvisibleMultiblock) world.getTileEntity(x, y, z)
: null;
if (thisTile == null) {
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float subX,
float subY, float subZ) {
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 0 || metadata == 1) {
TileEntity tile = world.getTileEntity(x, y, z);
if (!(tile instanceof TileInvisibleMultiblock multiblock)) {
LogHelper.error("Missing Tile Entity (TileInvisibleMultiblock)");
return false;
}
TileEnergyStorageCore master = thisTile.getMaster();
if (master == null) {
TileEnergyStorageCore core = multiblock.getMaster();
if (core == null) {
onNeighborBlockChange(world, x, y, z, this);
return false;
}
if (!world.isRemote) {
world.markBlockForUpdate(master.xCoord, master.yCoord, master.zCoord);
player.addChatComponentMessage(new ChatComponentText("Tier:" + (master.getTier() + 1)));
String BN = String.valueOf(master.getEnergyStored());
player.addChatComponentMessage(
new ChatComponentText(
StatCollector.translateToLocal("info.de.charge.txt") + ": "
+ Utills.formatNumber(master.getEnergyStored())
+ " / "
+ Utills.formatNumber(master.getMaxEnergyStored())
+ " ["
+ BN
+ " RF]"));
world.markBlockForUpdate(core.xCoord, core.yCoord, core.zCoord);
List<String> information = core.getDisplayInformation(false);
for (String message : information) {
player.addChatComponentMessage(new ChatComponentText(message));
}
}
return true;
} else if (meta == 2) {
TileEnergyPylon pylon = (world.getTileEntity(x, y + 1, z) != null
&& world.getTileEntity(x, y + 1, z) instanceof TileEnergyPylon)
? (TileEnergyPylon) world.getTileEntity(x, y + 1, z)
: (world.getTileEntity(x, y - 1, z) != null
&& world.getTileEntity(x, y - 1, z) instanceof TileEnergyPylon)
? (TileEnergyPylon) world.getTileEntity(x, y - 1, z)
: null;
if (pylon == null) return false;
pylon.reciveEnergy = !pylon.reciveEnergy;
} else if (metadata == 2) {
TileEntity tileAbove = world.getTileEntity(x, y + 1, z);
TileEntity tileBelow = world.getTileEntity(x, y - 1, z);
TileEnergyPylon pylon = tileAbove instanceof TileEnergyPylon ? (TileEnergyPylon) tileAbove
: tileBelow instanceof TileEnergyPylon ? (TileEnergyPylon) tileBelow : null;
if (pylon == null) {
return false;
}
pylon.isReceivingEnergy = !pylon.isReceivingEnergy;
world.markBlockForUpdate(pylon.xCoord, pylon.yCoord, pylon.zCoord);
pylon.onActivated();
return true;
@@ -154,87 +160,65 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock {
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) {
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0 || meta == 1) {
TileInvisibleMultiblock thisTile = (world.getTileEntity(x, y, z) != null
&& world.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock)
? (TileInvisibleMultiblock) world.getTileEntity(x, y, z)
: null;
if (thisTile == null) {
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) {
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 0 || metadata == 1) {
TileEntity tile = world.getTileEntity(x, y, z);
if (!(tile instanceof TileInvisibleMultiblock multiblock)) {
LogHelper.error("Missing Tile Entity (TileInvisibleMultiblock)");
revert(world, x, y, z);
revertStructure(world, x, y, z);
return;
}
TileEnergyStorageCore master = thisTile.getMaster();
if (master == null) {
TileEnergyStorageCore core = multiblock.getMaster();
if (core == null) {
LogHelper.error("Master = null reverting!");
revert(world, x, y, z);
revertStructure(world, x, y, z);
return;
}
if (master.isOnline()) master.isStructureStillValid(thisTile.getMaster().getTier() == 1);
if (!master.isOnline()) revert(world, x, y, z);
} else if (meta == 2) {
if (core.isOnline()) {
core.validateStructure(core.getTier() == 1);
} else {
revertStructure(world, x, y, z);
}
} else if (metadata == 2) {
if (world.getBlock(x, y + 1, z) != ModBlocks.energyPylon
&& world.getBlock(x, y - 1, z) != ModBlocks.energyPylon)
world.setBlock(x, y, z, Blocks.glass);
}
}
private void revert(World world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0) {
world.setBlock(
x,
y,
z,
BalanceConfigHandler.energyStorageStructureOuterBlock,
BalanceConfigHandler.energyStorageStructureOuterBlockMetadata,
3);
} else if (meta == 1) {
world.setBlock(
x,
y,
z,
BalanceConfigHandler.energyStorageStructureBlock,
BalanceConfigHandler.energyStorageStructureBlockMetadata,
3);
}
}
@Override
public void breakBlock(World world, int x, int y, int z, Block p_149749_5_, int meta) {
public void breakBlock(World world, int x, int y, int z, Block blockBroken, int metadata) {
TileEntity tile = world.getTileEntity(x, y, z);
TileInvisibleMultiblock thisTile = (tile != null && tile instanceof TileInvisibleMultiblock)
? (TileInvisibleMultiblock) tile
: null;
if (thisTile != null && thisTile.getMaster() != null && thisTile.getMaster().isOnline()) {
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
thisTile.getMaster().isStructureStillValid(thisTile.getMaster().getTier() == 1);
if (tile instanceof TileInvisibleMultiblock multiblock) {
TileEnergyStorageCore core = multiblock.getMaster();
if (core != null && core.isOnline()) {
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
core.validateStructure(core.getTier() == 1);
}
}
super.breakBlock(world, x, y, z, p_149749_5_, meta);
super.breakBlock(world, x, y, z, blockBroken, metadata);
}
@Override
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0 || meta == 1) {
TileInvisibleMultiblock thisTile = (world.getTileEntity(x, y, z) != null
&& world.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock)
? (TileInvisibleMultiblock) world.getTileEntity(x, y, z)
: null;
if (thisTile != null && thisTile.getMaster() != null) {
return AxisAlignedBB.getBoundingBox(
thisTile.getMaster().xCoord,
thisTile.getMaster().yCoord,
thisTile.getMaster().zCoord,
thisTile.getMaster().xCoord + 0.5,
thisTile.getMaster().yCoord + 0.5,
thisTile.getMaster().zCoord + 0.5);
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 0 || metadata == 1) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileInvisibleMultiblock multiblock) {
TileEnergyStorageCore core = multiblock.getMaster();
if (core != null) {
return AxisAlignedBB.getBoundingBox(
core.xCoord,
core.yCoord,
core.zCoord,
core.xCoord + 0.5,
core.yCoord + 0.5,
core.zCoord + 0.5);
}
}
return super.getSelectedBoundingBoxFromPool(world, x, y, z);
} else if (meta == 2) {
} else if (metadata == 2) {
return AxisAlignedBB.getBoundingBox(x + 0.49, y + 0.49, z + 0.49, x + 0.51, y + 0.51, z + 0.51);
}
return super.getSelectedBoundingBoxFromPool(world, x, y, z);
@@ -242,9 +226,8 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock {
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z);
if (meta == 2) {
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 2) {
return AxisAlignedBB.getBoundingBox(x, y, z, x, y, z);
}
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
@@ -270,46 +253,18 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock {
@Override
public List<String> getDisplayData(World world, int x, int y, int z) {
List<String> list = new ArrayList<String>();
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0 || meta == 1) {
TileInvisibleMultiblock thisTile = (world.getTileEntity(x, y, z) != null
&& world.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock)
? (TileInvisibleMultiblock) world.getTileEntity(x, y, z)
: null;
if (thisTile == null) {
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 0 || metadata == 1) {
TileEntity tile = world.getTileEntity(x, y, z);
if (!(tile instanceof TileInvisibleMultiblock multiblock)) {
LogHelper.error("Missing Tile Entity (TileInvisibleMultiblock getDisplayData)");
return list;
return Collections.emptyList();
}
TileEnergyStorageCore master = thisTile.getMaster();
if (master == null) {
return list;
TileEnergyStorageCore core = multiblock.getMaster();
if (core != null) {
return core.getDisplayInformation(true);
}
list.add(InfoHelper.HITC() + ModBlocks.energyStorageCore.getLocalizedName());
list.add("Tier: " + InfoHelper.ITC() + (master.getTier() + 1));
String BN = String.valueOf(master.getEnergyStored());
list.add(
StatCollector.translateToLocal("info.de.charge.txt") + ": "
+ InfoHelper.ITC()
+ Utills.formatNumber(master.getEnergyStored())
+ " / "
+ Utills.formatNumber(master.getMaxEnergyStored())
+ " ["
+ Utills.addCommas(master.getEnergyStored())
+ " RF]");
return list;
}
return list;
}
@Override
public String getUnlocalizedName() {
return super.getUnlocalizedName();
return Collections.emptyList();
}
}
@@ -1,5 +1,6 @@
package com.brandon3055.draconicevolution.common.blocks.multiblock;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates;
@@ -60,6 +61,14 @@ public class MultiblockHelper {
initialized = true;
}
public Block getBlock(World world) {
return world.getBlock(posX, posY, posZ);
}
public int getBlockMetadata(World world) {
return world.getBlockMetadata(posX, posY, posZ);
}
public TileEntity getTileEntity(World world) {
return world.getTileEntity(posX, posY, posZ);
}
@@ -35,8 +35,8 @@ public class Portal extends BlockDE implements ITileEntityProvider {
ModBlocks.register(this);
}
@SideOnly(Side.CLIENT)
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "transparency");
}
@@ -47,8 +47,7 @@ public class Portal extends BlockDE implements ITileEntityProvider {
}
@Override
public AxisAlignedBB getSelectedBoundingBoxFromPool(World p_149633_1_, int p_149633_2_, int p_149633_3_,
int p_149633_4_) {
public AxisAlignedBB getSelectedBoundingBoxFromPool(World worldIn, int x, int y, int z) {
return AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0);
}
@@ -63,26 +62,35 @@ public class Portal extends BlockDE implements ITileEntityProvider {
}
@Override
public TileEntity createNewTileEntity(World world, int i) {
public boolean hasTileEntity(int metadata) {
return true;
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {
return new TilePortalBlock();
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_,
int p_149668_4_) {
public AxisAlignedBB getCollisionBoundingBoxFromPool(World worldIn, int x, int y, int z) {
return null;
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
if (world.isRemote) return;
if (getMaster(world, x, y, z) == null) {
if (world.isRemote) {
return;
}
TileDislocatorReceptacle receptacle = getMaster(world, x, y, z);
if (receptacle == null) {
world.setBlockToAir(x, y, z);
return;
}
if (getMaster(world, x, y, z).isActive) getMaster(world, x, y, z).validateActivePortal();
if (!getMaster(world, x, y, z).isActive && !getMaster(world, x, y, z).updating) {
if (receptacle.isActive) {
receptacle.validateActivePortal();
}
if (!receptacle.isActive && !receptacle.updating) {
world.setBlockToAir(x, y, z);
return;
}
@@ -91,29 +99,37 @@ public class Portal extends BlockDE implements ITileEntityProvider {
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
if (world.isRemote) return;
TileDislocatorReceptacle tile = getMaster(world, x, y, z);
if (tile != null && tile.isActive && tile.getLocation() != null) {
if (tile.coolDown > 0) return;
tile.coolDown = 1;
tile.getLocation().sendEntityToCoords(entity);
} else if (tile != null) tile.validateActivePortal();
else world.setBlockToAir(x, y, z);
if (world.isRemote) {
return;
}
TileDislocatorReceptacle receptacle = getMaster(world, x, y, z);
if (receptacle == null) {
world.setBlockToAir(x, y, z);
return;
}
if (receptacle.isActive && receptacle.getLocation() != null) {
if (receptacle.coolDown > 0) {
return;
}
receptacle.coolDown = 1;
receptacle.getLocation().sendEntityToCoords(entity);
} else {
receptacle.validateActivePortal();
}
}
private TileDislocatorReceptacle getMaster(World world, int x, int y, int z) {
return world.getTileEntity(x, y, z) instanceof TilePortalBlock
? ((TilePortalBlock) world.getTileEntity(x, y, z)).getMaster()
: null;
TileEntity tile = world.getTileEntity(x, y, z);
return tile instanceof TilePortalBlock portal ? portal.getMaster() : null;
}
@Override
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
public Item getItemDropped(int metadata, Random random, int fortune) {
return null;
}
private boolean isPortalOrFrame(IBlockAccess access, int x, int y, int z) {
Block block = access.getBlock(x, y, z);
private boolean isPortalOrFrame(IBlockAccess world, int x, int y, int z) {
Block block = world.getBlock(x, y, z);
return block == ModBlocks.portal || block == ModBlocks.infusedObsidian
|| block == ModBlocks.dislocatorReceptacle;
}
@@ -124,22 +140,21 @@ public class Portal extends BlockDE implements ITileEntityProvider {
}
private void updateMetadata(World world, int x, int y, int z) {
if (world.isRemote || world.getBlockMetadata(x, y, z) != 0) return;
int meta = 0;
if (world.isRemote || world.getBlockMetadata(x, y, z) != 0) {
return;
}
int metadata = 0;
boolean hasPortalsAlongXAxis = isPortalOrFrame(world, x + 1, y, z) && isPortalOrFrame(world, x - 1, y, z);
boolean hasPortalsAlongYAxis = isPortalOrFrame(world, x, y + 1, z) && isPortalOrFrame(world, x, y - 1, z);
boolean hasPortalsAlongZAxis = isPortalOrFrame(world, x, y, z + 1) && isPortalOrFrame(world, x, y, z - 1);
if (isPortalOrFrame(world, x, y + 1, z) && isPortalOrFrame(world, x, y - 1, z)
&& isPortalOrFrame(world, x + 1, y, z)
&& isPortalOrFrame(world, x - 1, y, z))
meta = 1;
else if (isPortalOrFrame(world, x, y + 1, z) && isPortalOrFrame(world, x, y - 1, z)
&& isPortalOrFrame(world, x, y, z + 1)
&& isPortalOrFrame(world, x, y, z - 1))
meta = 2;
else if (isPortalOrFrame(world, x + 1, y, z) && isPortalOrFrame(world, x - 1, y, z)
&& isPortalOrFrame(world, x, y, z + 1)
&& isPortalOrFrame(world, x, y, z - 1))
meta = 3;
world.setBlockMetadataWithNotify(x, y, z, meta, 2);
if (hasPortalsAlongXAxis && hasPortalsAlongYAxis) {
metadata = 1;
} else if (hasPortalsAlongYAxis && hasPortalsAlongZAxis) {
metadata = 2;
} else if (hasPortalsAlongXAxis && hasPortalsAlongZAxis) {
metadata = 3;
}
world.setBlockMetadataWithNotify(x, y, z, metadata, 2);
}
}
@@ -1,8 +1,8 @@
package com.brandon3055.draconicevolution.common.blocks.multiblock;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
@@ -19,7 +19,7 @@ import cpw.mods.fml.relauncher.SideOnly;
/**
* Created by Brandon on 16/6/2015.
*/
public class ReactorCore extends BlockDE {
public class ReactorCore extends BlockDE implements ITileEntityProvider {
public ReactorCore() {
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
@@ -29,8 +29,8 @@ public class ReactorCore extends BlockDE {
ModBlocks.register(this);
}
@SideOnly(Side.CLIENT)
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "transparency");
}
@@ -56,40 +56,29 @@ public class ReactorCore extends BlockDE {
}
@Override
public TileEntity createTileEntity(World world, int metadata) {
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileReactorCore();
}
@Override
public void onBlockAdded(World world, int x, int y, int z) {
TileReactorCore tile = world.getTileEntity(x, y, z) instanceof TileReactorCore
? (TileReactorCore) world.getTileEntity(x, y, z)
: null;
if (tile != null) tile.onPlaced();
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileReactorCore core) {
core.onPlaced();
}
}
@Override
public AxisAlignedBB getSelectedBoundingBoxFromPool(World p_149633_1_, int x, int y, int z) {
return AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 1); // super.getSelectedBoundingBoxFromPool(p_149633_1_, x,
// y, z);
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
return AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 1);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_,
float p_149727_7_, float p_149727_8_, float p_149727_9_) {
// TileReactorCore tile = world.getTileEntity(x, y, z) instanceof TileReactorCore ? (TileReactorCore)
// world.getTileEntity(x, y, z) : null;
// if (tile != null) return tile.onStructureRightClicked(player);
return false;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block p_149749_5_, int p_149749_6_) {
TileReactorCore tile = world.getTileEntity(x, y, z) instanceof TileReactorCore
? (TileReactorCore) world.getTileEntity(x, y, z)
: null;
if (tile != null) tile.onBroken();
super.breakBlock(world, x, y, z, p_149749_5_, p_149749_6_);
public void breakBlock(World world, int x, int y, int z, Block blockBroken, int metadata) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileReactorCore core) {
core.onBroken();
}
super.breakBlock(world, x, y, z, blockBroken, metadata);
}
}
@@ -1,5 +1,6 @@
package com.brandon3055.draconicevolution.common.blocks.multiblock;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@@ -16,7 +17,6 @@ import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.blocks.BlockDE;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorEnergyInjector;
import cpw.mods.fml.relauncher.Side;
@@ -25,7 +25,7 @@ import cpw.mods.fml.relauncher.SideOnly;
/**
* Created by Brandon on 23/7/2015.
*/
public class ReactorEnergyInjector extends BlockDE {
public class ReactorEnergyInjector extends BlockDE implements ITileEntityProvider {
public ReactorEnergyInjector() {
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
@@ -34,70 +34,36 @@ public class ReactorEnergyInjector extends BlockDE {
ModBlocks.register(this);
}
@SideOnly(Side.CLIENT)
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "transparency");
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess access, int x, int y, int z) {
TileReactorEnergyInjector tile = access.getTileEntity(x, y, z) instanceof TileReactorEnergyInjector
? (TileReactorEnergyInjector) access.getTileEntity(x, y, z)
: null;
if (tile != null) {
switch (tile.facingDirection) {
case 0:
this.setBlockBounds(0F, 0.885F, 0F, 1F, 1F, 1F);
break;
case 1:
this.setBlockBounds(0F, 0F, 0F, 1F, 0.125F, 1F);
break;
case 2:
this.setBlockBounds(0F, 0F, 0.885F, 1F, 1F, 1F);
break;
case 3:
this.setBlockBounds(0F, 0F, 0F, 1F, 1F, 0.125F);
break;
case 4:
this.setBlockBounds(0.885F, 0F, 0F, 1F, 1F, 1F);
break;
case 5:
this.setBlockBounds(0F, 0F, 0F, 0.125F, 1F, 1F);
break;
}
}
super.setBlockBoundsBasedOnState(access, x, y, z);
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
initializeBoundingBox(world, x, y, z);
super.setBlockBoundsBasedOnState(world, x, y, z);
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
TileReactorEnergyInjector tile = world.getTileEntity(x, y, z) instanceof TileReactorEnergyInjector
? (TileReactorEnergyInjector) world.getTileEntity(x, y, z)
: null;
if (tile != null) {
switch (tile.facingDirection) {
case 0:
this.setBlockBounds(0F, 0.885F, 0F, 1F, 1F, 1F);
break;
case 1:
this.setBlockBounds(0F, 0F, 0F, 1F, 0.125F, 1F);
break;
case 2:
this.setBlockBounds(0F, 0F, 0.885F, 1F, 1F, 1F);
break;
case 3:
this.setBlockBounds(0F, 0F, 0F, 1F, 1F, 0.125F);
break;
case 4:
this.setBlockBounds(0.885F, 0F, 0F, 1F, 1F, 1F);
break;
case 5:
this.setBlockBounds(0F, 0F, 0F, 0.125F, 1F, 1F);
break;
initializeBoundingBox(world, x, y, z);
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
}
private void initializeBoundingBox(IBlockAccess world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileReactorEnergyInjector injector) {
switch (injector.facing) {
case DOWN -> this.setBlockBounds(0F, 0.875F, 0F, 1F, 1F, 1F);
case UP -> this.setBlockBounds(0F, 0F, 0F, 1F, 0.125F, 1F);
case NORTH -> this.setBlockBounds(0F, 0F, 0.875F, 1F, 1F, 1F);
case SOUTH -> this.setBlockBounds(0F, 0F, 0F, 1F, 1F, 0.125F);
case WEST -> this.setBlockBounds(0.875F, 0F, 0F, 1F, 1F, 1F);
case EAST -> this.setBlockBounds(0F, 0F, 0F, 0.125F, 1F, 1F);
}
}
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
}
@Override
@@ -117,41 +83,36 @@ public class ReactorEnergyInjector extends BlockDE {
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
int d = Utills.determineOrientation(x, y, z, entity);
TileReactorEnergyInjector tile = (TileReactorEnergyInjector) world.getTileEntity(x, y, z);
tile.facingDirection = ForgeDirection.getOrientation(d).getOpposite().ordinal();
tile.onPlaced();
ForgeDirection facing = ForgeDirection.getOrientation(Utills.determineOrientation(x, y, z, entity));
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileReactorEnergyInjector injector) {
injector.facing = entity.isSneaking() ? facing.getOpposite() : facing;
injector.onPlaced();
}
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_,
float p_149727_7_, float p_149727_8_, float p_149727_9_) {
IReactorPart tile = world.getTileEntity(x, y, z) instanceof IReactorPart
? (IReactorPart) world.getTileEntity(x, y, z)
: null;
if (tile != null && player.isSneaking()) {
tile.changeRedstoneMode();
if (!world.isRemote) player.addChatComponentMessage(new ChatComponentText(tile.getRedstoneModeString()));
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float subX,
float subY, float subZ) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof IReactorPart part && player.isSneaking()) {
part.changeComparatorMode();
if (!world.isRemote) {
player.addChatComponentMessage(new ChatComponentText(part.getComparatorMode().toLocalizedString()));
}
return true;
}
return false;
}
@Override
public boolean hasComparatorInputOverride() {
return true;
}
@Override
public int getComparatorInputOverride(World world, int x, int y, int z, int p_149736_5_) {
IReactorPart tile = world.getTileEntity(x, y, z) instanceof IReactorPart
? (IReactorPart) world.getTileEntity(x, y, z)
: null;
if (tile == null) return 0;
TileReactorCore core = tile.getMaster().getTileEntity(world) instanceof TileReactorCore
? (TileReactorCore) tile.getMaster().getTileEntity(world)
: null;
if (core != null) return core.getComparatorOutput(tile.getRedstoneMode());
return 0;
public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
return IReactorPart.getComparatorOutput(world, x, y, z);
}
@Override
@@ -160,7 +121,7 @@ public class ReactorEnergyInjector extends BlockDE {
}
@Override
public TileEntity createTileEntity(World world, int metadata) {
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileReactorEnergyInjector();
}
}
@@ -1,6 +1,7 @@
package com.brandon3055.draconicevolution.common.blocks.multiblock;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@@ -24,7 +25,7 @@ import cpw.mods.fml.relauncher.SideOnly;
/**
* Created by Brandon on 5/7/2015.
*/
public class ReactorStabilizer extends BlockDE {
public class ReactorStabilizer extends BlockDE implements ITileEntityProvider {
public ReactorStabilizer() {
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
@@ -32,8 +33,8 @@ public class ReactorStabilizer extends BlockDE {
ModBlocks.register(this);
}
@SideOnly(Side.CLIENT)
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "transparency");
}
@@ -44,27 +45,20 @@ public class ReactorStabilizer extends BlockDE {
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_,
float p_149727_7_, float p_149727_8_, float p_149727_9_) {
if (!player.isSneaking()) {
TileReactorStabilizer tile = world.getTileEntity(x, y, z) instanceof TileReactorStabilizer
? (TileReactorStabilizer) world.getTileEntity(x, y, z)
: null;
TileEntity core = null;
if (tile != null) core = tile.getMaster().getTileEntity(world);
if (core instanceof TileReactorCore) {
((TileReactorCore) core).onStructureRightClicked(player);
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float subX,
float subY, float subZ) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof IReactorPart part) {
if (player.isSneaking()) {
part.changeComparatorMode();
if (!world.isRemote) {
player.addChatComponentMessage(new ChatComponentText(part.getComparatorMode().toLocalizedString()));
}
return true;
}
} else if (!world.isRemote) {
IReactorPart tile = world.getTileEntity(x, y, z) instanceof IReactorPart
? (IReactorPart) world.getTileEntity(x, y, z)
: null;
if (tile != null) {
tile.changeRedstoneMode();
if (!world.isRemote)
player.addChatComponentMessage(new ChatComponentText(tile.getRedstoneModeString()));
return true;
TileReactorCore core = part.getMaster();
if (core != null) {
return core.onStructureRightClicked(player);
}
}
return false;
@@ -86,48 +80,38 @@ public class ReactorStabilizer extends BlockDE {
}
@Override
public TileEntity createTileEntity(World world, int metadata) {
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileReactorStabilizer();
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
int d = Utills.determineOrientation(x, y, z, entity);
TileReactorStabilizer tile = world.getTileEntity(x, y, z) instanceof TileReactorStabilizer
? (TileReactorStabilizer) world.getTileEntity(x, y, z)
: null;
if (tile != null) {
if (entity.isSneaking()) tile.facingDirection = ForgeDirection.getOrientation(d).getOpposite().ordinal();
else tile.facingDirection = ForgeDirection.getOrientation(d).ordinal();
tile.onPlaced();
ForgeDirection facing = ForgeDirection.getOrientation(Utills.determineOrientation(x, y, z, entity));
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileReactorStabilizer stabilizer) {
stabilizer.facing = entity.isSneaking() ? facing.getOpposite() : facing;
stabilizer.onPlaced();
}
}
@Override
public void breakBlock(World world, int x, int y, int z, Block p_149749_5_, int p_149749_6_) {
TileReactorStabilizer tile = world.getTileEntity(x, y, z) instanceof TileReactorStabilizer
? (TileReactorStabilizer) world.getTileEntity(x, y, z)
: null;
TileEntity core = null;
if (tile != null) core = tile.getMaster().getTileEntity(world);
super.breakBlock(world, x, y, z, p_149749_5_, p_149749_6_);
if (core instanceof TileReactorCore) ((TileReactorCore) core).validateStructure();
public void breakBlock(World world, int x, int y, int z, Block blockBroken, int metadata) {
TileEntity tile = world.getTileEntity(x, y, z);
TileReactorCore core = tile instanceof IReactorPart part ? part.getMaster() : null;
super.breakBlock(world, x, y, z, blockBroken, metadata);
if (core != null) {
core.updateReactorParts(false);
core.validateStructure();
}
}
@Override
public boolean hasComparatorInputOverride() {
return true;
}
@Override
public int getComparatorInputOverride(World world, int x, int y, int z, int p_149736_5_) {
IReactorPart tile = world.getTileEntity(x, y, z) instanceof IReactorPart
? (IReactorPart) world.getTileEntity(x, y, z)
: null;
if (tile == null) return 0;
TileReactorCore core = tile.getMaster().getTileEntity(world) instanceof TileReactorCore
? (TileReactorCore) tile.getMaster().getTileEntity(world)
: null;
if (core != null) return core.getComparatorOutput(tile.getRedstoneMode());
return 0;
public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
return IReactorPart.getComparatorOutput(world, x, y, z);
}
}
@@ -2,21 +2,25 @@ package com.brandon3055.draconicevolution.common.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.*;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.common.blocks.DraconiumChest;
import com.brandon3055.draconicevolution.common.inventory.InventoryCraftingChest;
import com.brandon3055.draconicevolution.common.inventory.InventoryCraftingChestResult;
import com.brandon3055.draconicevolution.common.lib.OreDoublingRegistry;
import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest;
import cofh.api.energy.IEnergyContainerItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import invtweaks.api.container.ChestContainer;
@@ -5,11 +5,10 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.common.inventory.SlotChargable;
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
import cofh.api.energy.IEnergyContainerItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -1,37 +1,24 @@
package com.brandon3055.draconicevolution.common.container;
import java.util.Iterator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import com.brandon3055.draconicevolution.client.gui.GUIPlayerDetector;
import com.brandon3055.draconicevolution.common.inventory.SlotOpaqueBlock;
import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetectorAdvanced;
public class ContainerPlayerDetector extends Container {
private TilePlayerDetectorAdvanced tileDetector;
private GUIPlayerDetector gui = null;
private boolean shouldShowInventory = true;
private final TilePlayerDetectorAdvanced detector;
public ContainerPlayerDetector(InventoryPlayer invPlayer, TilePlayerDetectorAdvanced tileDetector) {
this.tileDetector = tileDetector;
public ContainerPlayerDetector(InventoryPlayer playerInventory, TilePlayerDetectorAdvanced detector) {
this.detector = detector;
bindPlayerInventory(invPlayer);
addContainerSlots(tileDetector);
updateContainerSlots();
}
public ContainerPlayerDetector(InventoryPlayer invPlayer, TilePlayerDetectorAdvanced tileDetector,
GUIPlayerDetector gui) {
this.tileDetector = tileDetector;
this.gui = gui;
bindPlayerInventory(invPlayer);
addContainerSlots(tileDetector);
bindPlayerInventory(playerInventory);
addContainerSlots(detector);
updateContainerSlots();
}
@@ -52,40 +39,27 @@ public class ContainerPlayerDetector extends Container {
}
public void updateContainerSlots() {
if (gui == null) {
return;
}
Iterator<Slot> i1 = inventorySlots.iterator();
while (i1.hasNext()) {
Slot sl = i1.next();
if (sl instanceof SlotOpaqueBlock) {
if (gui.showInvSlots) {
sl.xDisplayPosition = 143;
sl.yDisplayPosition = 20;
for (Slot slot : (Iterable<Slot>) inventorySlots) {
if (slot instanceof SlotOpaqueBlock) {
if (shouldShowInventory) {
slot.xDisplayPosition = 143;
slot.yDisplayPosition = 20;
} else {
sl.xDisplayPosition = -1000;
sl.yDisplayPosition = -1000;
slot.xDisplayPosition = -1000;
slot.yDisplayPosition = -1000;
}
} else {
if (gui.showInvSlots) {
if (sl.slotNumber < 9) {
sl.xDisplayPosition = 8 + 18 * sl.slotNumber;
sl.yDisplayPosition = 174;
} else if (sl.slotNumber < 18) {
sl.xDisplayPosition = 8 + 18 * (sl.slotNumber - 9);
sl.yDisplayPosition = 116 + 0 * 18;
} else if (sl.slotNumber < 27) {
sl.xDisplayPosition = 8 + 18 * (sl.slotNumber - 18);
sl.yDisplayPosition = 116 + 1 * 18;
} else if (sl.slotNumber < 36) {
sl.xDisplayPosition = 8 + 18 * (sl.slotNumber - 27);
sl.yDisplayPosition = 116 + 2 * 18;
if (shouldShowInventory) {
if (slot.slotNumber < 9) {
slot.xDisplayPosition = 8 + 18 * slot.slotNumber;
slot.yDisplayPosition = 174;
} else if (slot.slotNumber < 36) {
slot.xDisplayPosition = 8 + 18 * (slot.slotNumber % 9);
slot.yDisplayPosition = 116 + (slot.slotNumber / 9 - 1) * 18;
}
} else {
sl.xDisplayPosition = -1000;
sl.yDisplayPosition = -1000;
slot.xDisplayPosition = -1000;
slot.yDisplayPosition = -1000;
}
}
}
@@ -93,53 +67,24 @@ public class ContainerPlayerDetector extends Container {
@Override
public boolean canInteractWith(EntityPlayer player) {
return tileDetector.isUseableByPlayer(player);
return detector.isUseableByPlayer(player);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int i) {
// Slot slot = getSlot(i);
//
//
// if (slot != null && slot.getHasStack())
// {
// ItemStack stack = slot.getStack();
// ItemStack result = stack.copy();
// Block block = Block.getBlockFromItem(stack.getItem());
//
// if (i >= 36){
// if (!mergeItemStack(stack, 0, 36, false)){
// return null;
// }
// }else if (!(block.isOpaqueCube() && block.renderAsNormalBlock()) || !mergeItemStack(stack, 36, 36 +
// tileDetector.getSizeInventory(), false)){
// return null;
// }
//
// if (stack.stackSize == 0) {
// slot.putStack(null);
// }else{
// slot.onSlotChanged();
// }
//
// slot.onPickupFromSlot(player, stack);
//
// return result;
// }
public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
return null;
}
public TilePlayerDetectorAdvanced getTileDetector() {
return tileDetector;
public boolean shouldShowInventory() {
return shouldShowInventory;
}
@Override
public ItemStack slotClick(int slot, int button, int par3, EntityPlayer par4EntityPlayer) {
return super.slotClick(slot, button, par3, par4EntityPlayer);
// if (par3 == 4)
// return super.slotClick(slot, button, 0, par4EntityPlayer);
// else
// return super.slotClick(slot, button, par3, par4EntityPlayer);
public void setShouldShowInventory(boolean shouldShow) {
shouldShowInventory = shouldShow;
updateContainerSlots();
}
public TilePlayerDetectorAdvanced getDetector() {
return detector;
}
}
@@ -1,83 +1,79 @@
package com.brandon3055.draconicevolution.common.container;
import java.util.Iterator;
import java.util.Set;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.inventory.GenericInventory;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore.ReactorState;
import com.brandon3055.draconicevolution.common.utills.OreDictionaryHelper;
/**
* Created by brandon3055 on 30/7/2015.
*/
public class ContainerReactor extends ContainerDataSync {
private TileReactorCore reactor;
private EntityPlayer player;
private GenericInventory ioSlots = new GenericInventory() {
private static final int maximumFuelStorage = 10368;
private static final int nuggetFuelAmount = 16;
private static final int ingotFuelAmount = nuggetFuelAmount * 9;
private static final int blockFuelAmount = ingotFuelAmount * 9;
private final TileReactorCore core;
private final EntityPlayer player;
private final GenericInventory ioSlots = new GenericInventory() {
private ItemStack[] items = new ItemStack[2];
private final ItemStack[] items = new ItemStack[2];
@Override
public ItemStack[] getStorage() {
return items;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
return true;
// return itemstack != null && (itemstack.getItem() == ModItems.draconicIngot || itemstack.getItem() ==
// Item.getItemFromBlock(ModBlocks.draconicBlock));
}
@Override
public int getInventoryStackLimit() {
return 1; // super.getInventoryStackLimit();
return 1;
}
@Override
public void setInventorySlotContents(int i, ItemStack stack) {
if (i == 0 && stack != null
&& (stack.getItem() == ModItems.draconicIngot
|| stack.getItem() == Item.getItemFromBlock(ModBlocks.draconicBlock)
|| (stack.getItem() == ModItems.nugget && stack.getItemDamage() == 1))) {
if (stack.getItem() == ModItems.nugget) reactor.reactorFuel += stack.stackSize * 16;
if (stack.getItem() == ModItems.draconicIngot) reactor.reactorFuel += stack.stackSize * 144;
if (stack.getItem() == Item.getItemFromBlock(ModBlocks.draconicBlock))
reactor.reactorFuel += stack.stackSize * 1296;
reactor.validateStructure();
} else getStorage()[i] = stack;
public void setInventorySlotContents(int slot, ItemStack stack) {
if (slot == 0) {
Set<String> oreNames = OreDictionaryHelper.getOreNames(stack);
if (oreNames.contains("blockDraconiumAwakened")) {
core.reactorFuel += stack.stackSize * blockFuelAmount;
} else if (oreNames.contains("ingotDraconiumAwakened")) {
core.reactorFuel += stack.stackSize * ingotFuelAmount;
} else if (oreNames.contains("nuggetDraconiumAwakened")) {
core.reactorFuel += stack.stackSize * nuggetFuelAmount;
}
} else {
items[slot] = stack;
}
}
@Override
public void markDirty() {
super.markDirty();
core.markDirty();
}
};
// Syncing //todo sort out syncing
public int LTConversionUnit = -1;
public int LTReactionIntensity = -1;
// public int LTMaxReactIntensity = -1;
// public int LTFieldStrength = -1;
// public int LTMaxFieldStrength = -1;
// public int LTEnergySaturation = -1;
// public int LTMaxEnergySaturation = -1;
// public int LTFuelConversion = -1;
private int conversionUnitCache = -1;
private int tempDrainFactorCache = -1;
private int generationRateCache = -1;
private int fieldDrainCache = -1;
private int fuelUseRateCache = -1;
private boolean isOfflineCache;
public double LTTempDrainFactor = -1;
public double LTGenerationRate = -1;
public int LTFieldDrain = -1;
public double LTFuelUseRate = -1;
public boolean LTOffline;
// #######
public ContainerReactor(EntityPlayer player, TileReactorCore reactor) {
this.reactor = reactor;
public ContainerReactor(EntityPlayer player, TileReactorCore core) {
this.core = core;
this.player = player;
this.LTOffline = reactor.reactorState == TileReactorCore.STATE_OFFLINE;
this.isOfflineCache = core.reactorState == ReactorState.OFFLINE;
for (int x = 0; x < 9; x++) {
addSlotToContainer(new Slot(player.inventory, x, 44 + 18 * x, 198));
@@ -89,12 +85,21 @@ public class ContainerReactor extends ContainerDataSync {
}
}
if (reactor.reactorState == TileReactorCore.STATE_OFFLINE) {
addSlotToContainer(new SlotInsert(ioSlots, 0, 15, 140, reactor));
addSlotToContainer(new SlotExtract(ioSlots, 1, 217, 140));
if (core.reactorState == ReactorState.OFFLINE) {
addFuelSlots();
}
}
private void addFuelSlots() {
addSlotToContainer(new SlotInsert(ioSlots, 0, 15, 140, core));
addSlotToContainer(new SlotExtract(ioSlots, 1, 217, 140));
}
@SuppressWarnings("unchecked")
private void removeFuelSlots() {
inventorySlots.removeIf(o -> o instanceof SlotExtract || o instanceof SlotInsert);
}
@Override
public void onContainerClosed(EntityPlayer entityPlayer) {
if (ioSlots.getStackInSlot(1) != null && !player.worldObj.isRemote) {
@@ -116,158 +121,141 @@ public class ContainerReactor extends ContainerDataSync {
}
@Override
public void detectAndSendChanges() { // todo check what values are being synced by the tile and remove them from
// here
if (LTOffline && reactor.reactorState != TileReactorCore.STATE_OFFLINE) {
Iterator i = inventorySlots.iterator();
while (i.hasNext()) {
Object o = i.next();
if (o instanceof SlotExtract || o instanceof SlotInsert) i.remove();
}
public void detectAndSendChanges() {
if (isOfflineCache && core.reactorState != ReactorState.OFFLINE) {
removeFuelSlots();
sendObjectToClient(null, 99, 1);
} else if (!LTOffline && reactor.reactorState == TileReactorCore.STATE_OFFLINE) {
addSlotToContainer(new SlotInsert(ioSlots, 0, 15, 140, reactor));
addSlotToContainer(new SlotExtract(ioSlots, 1, 217, 140));
} else if (!isOfflineCache && core.reactorState == ReactorState.OFFLINE) {
addFuelSlots();
sendObjectToClient(null, 98, 1);
}
LTOffline = reactor.reactorState == TileReactorCore.STATE_OFFLINE;
isOfflineCache = core.reactorState == ReactorState.OFFLINE;
if (reactor.conversionUnit != LTConversionUnit)
LTConversionUnit = (Integer) sendObjectToClient(null, 0, (int) (reactor.conversionUnit * 100));
// if ((int)reactor.reactionTemperature != LTReactionIntensity)LTReactionIntensity = (Integer)
// sendObjectToClient(null, 1, (int) reactor.reactionTemperature);
// if ((int)reactor.maxReactTemperature != LTMaxReactIntensity)LTMaxReactIntensity = (Integer)
// sendObjectToClient(null, 2, (int) reactor.maxReactTemperature);
// if ((int)reactor.fieldCharge != LTFieldStrength) LTFieldStrength = (Integer) sendObjectToClient(null,
// 3, (int) reactor.fieldCharge);
// if ((int)reactor.maxFieldCharge != LTMaxFieldStrength) LTMaxFieldStrength = (Integer)
// sendObjectToClient(null, 7, (int) reactor.maxFieldCharge);
// if (reactor.energySaturation != LTEnergySaturation) LTEnergySaturation = (Integer)
// sendObjectToClient(null, 4, reactor.energySaturation);
// if (reactor.maxEnergySaturation != LTMaxEnergySaturation) LTMaxEnergySaturation = (Integer)
// sendObjectToClient(null, 5, reactor.maxEnergySaturation);
// if (reactor.convertedFuel != LTFuelConversion) LTFuelConversion = (Integer) sendObjectToClient(null,
// 6, reactor.convertedFuel);
/* if (reactor.tempDrainFactor != LTTempDrainFactor) LTTempDrainFactor = (Integer) */
sendObjectToClient(null, 8, (int) (reactor.tempDrainFactor * 1000D));
if (reactor.generationRate != LTGenerationRate)
LTGenerationRate = (Integer) sendObjectToClient(null, 9, (int) (reactor.generationRate));
if (reactor.fieldDrain != LTFieldDrain)
LTFieldDrain = (Integer) sendObjectToClient(null, 10, reactor.fieldDrain);
/* if (reactor.fuelUseRate != LTFuelUseRate) LTFuelUseRate = (Integer) */
sendObjectToClient(null, 11, (int) (reactor.fuelUseRate * 1000000D));
int conversionUnit = (int) (core.conversionUnit * 100);
if (conversionUnit != conversionUnitCache) {
conversionUnitCache = (int) sendObjectToClient(null, 0, conversionUnit);
}
int tempDrainFactor = (int) (core.tempDrainFactor * 1000);
if (tempDrainFactor != tempDrainFactorCache) {
tempDrainFactorCache = (int) sendObjectToClient(null, 8, tempDrainFactor);
}
int generationRate = (int) core.generationRate;
if (generationRate != generationRateCache) {
generationRateCache = (int) sendObjectToClient(null, 9, generationRate);
}
if (core.fieldDrain != fieldDrainCache) {
fieldDrainCache = (int) sendObjectToClient(null, 10, core.fieldDrain);
}
int fuelUseRate = (int) (core.fuelUseRate * 1000000);
if (fuelUseRate != fuelUseRateCache) {
fuelUseRateCache = (int) sendObjectToClient(null, 11, fuelUseRate);
}
super.detectAndSendChanges();
}
@Override
public void receiveSyncData(int index, int value) {
if (index == 0) reactor.conversionUnit = (double) value / 100D;
// else if (index == 1) reactor.reactionTemperature = value;
// else if (index == 2) reactor.maxReactTemperature = value;
// else if (index == 3) reactor.fieldCharge = value;
// else if (index == 4) reactor.energySaturation = value;
// else if (index == 5) reactor.maxEnergySaturation = value;
// else if (index == 6) reactor.convertedFuel = value;
// else if (index == 7) reactor.maxFieldCharge = value;
else if (index == 8) reactor.tempDrainFactor = value / 1000D;
else if (index == 9) reactor.generationRate = value;
else if (index == 10) reactor.fieldDrain = value;
else if (index == 11) reactor.fuelUseRate = value / 1000000D;
if (index == 20) reactor.processButtonPress(value);
if (index == 0) {
core.conversionUnit = (double) value / 100D;
} else if (index == 8) {
core.tempDrainFactor = value / 1000D;
} else if (index == 9) {
core.generationRate = value;
} else if (index == 10) {
core.fieldDrain = value;
} else if (index == 11) {
core.fuelUseRate = value / 1000000D;
}
if (index == 20) {
core.processButtonPress(value);
}
if (index == 99) {
Iterator i = inventorySlots.iterator();
while (i.hasNext()) {
Object o = i.next();
if (o instanceof SlotExtract || o instanceof SlotInsert) i.remove();
}
removeFuelSlots();
} else if (index == 98) {
addSlotToContainer(new SlotInsert(ioSlots, 0, 15, 140, reactor));
addSlotToContainer(new SlotExtract(ioSlots, 1, 217, 140));
addFuelSlots();
}
}
@Override
public ItemStack slotClick(int slot, int button, int p_75144_3_, EntityPlayer player1) {
if (slot == 37 && player1.inventory.getItemStack() == null) {
if (reactor.reactorFuel / 144 >= 64) {
int i = reactor.reactorFuel / 1296;
int i2 = Math.min(64, i);
ioSlots.getStorage()[1] = new ItemStack(ModBlocks.draconicBlock, i2);
reactor.reactorFuel -= i2 * 1296;
} else if (reactor.reactorFuel >= 144) {
int i = reactor.reactorFuel / 144;
int i2 = Math.min(64, i);
ioSlots.getStorage()[1] = new ItemStack(ModItems.draconicIngot, i2);
reactor.reactorFuel -= i2 * 144;
} else if (reactor.reactorFuel >= 16) {
int i = reactor.reactorFuel / 16;
int i2 = Math.min(64, i);
ioSlots.getStorage()[1] = new ItemStack(ModItems.nugget, i2, 1);
reactor.reactorFuel -= i2 * 16;
} else if (reactor.convertedFuel / 144 >= 64) {
int i = reactor.convertedFuel / 1296;
int i2 = Math.min(64, i);
ioSlots.getStorage()[1] = new ItemStack(ModItems.chaosFragment, i2, 2);
reactor.convertedFuel -= i2 * 1296;
} else if (reactor.convertedFuel >= 144) {
int i = reactor.convertedFuel / 144;
int i2 = Math.min(64, i);
ioSlots.getStorage()[1] = new ItemStack(ModItems.chaosFragment, i2, 1);
reactor.convertedFuel -= i2 * 144;
} else if (reactor.convertedFuel >= 16) {
int i = reactor.convertedFuel / 16;
int i2 = Math.min(64, i);
ioSlots.getStorage()[1] = new ItemStack(ModItems.chaosFragment, i2, 0);
reactor.convertedFuel -= i2 * 16;
public ItemStack slotClick(int slot, int button, int mode, EntityPlayer player) {
if (slot == 37 && player.inventory.getItemStack() == null) {
if (core.reactorFuel / ingotFuelAmount >= 64) {
int stackSize = core.reactorFuel / blockFuelAmount;
stackSize = Math.min(64, stackSize);
ioSlots.setInventorySlotContents(1, new ItemStack(ModBlocks.draconicBlock, stackSize));
core.reactorFuel -= stackSize * blockFuelAmount;
} else if (core.reactorFuel >= ingotFuelAmount) {
int stackSize = core.reactorFuel / ingotFuelAmount;
stackSize = Math.min(64, stackSize);
ioSlots.setInventorySlotContents(1, new ItemStack(ModItems.draconicIngot, stackSize));
core.reactorFuel -= stackSize * ingotFuelAmount;
} else if (core.reactorFuel >= nuggetFuelAmount) {
int stackSize = core.reactorFuel / nuggetFuelAmount;
ioSlots.setInventorySlotContents(1, new ItemStack(ModItems.nugget, stackSize, 1));
core.reactorFuel -= stackSize * nuggetFuelAmount;
} else if (core.convertedFuel / ingotFuelAmount >= 64) {
int stackSize = core.convertedFuel / blockFuelAmount;
stackSize = Math.min(64, stackSize);
ioSlots.setInventorySlotContents(1, new ItemStack(ModItems.chaosFragment, stackSize, 2));
core.convertedFuel -= stackSize * blockFuelAmount;
} else if (core.convertedFuel >= ingotFuelAmount) {
int stackSize = core.convertedFuel / ingotFuelAmount;
stackSize = Math.min(64, stackSize);
ioSlots.setInventorySlotContents(1, new ItemStack(ModItems.chaosFragment, stackSize, 1));
core.convertedFuel -= stackSize * ingotFuelAmount;
} else if (core.convertedFuel >= nuggetFuelAmount) {
int stackSize = core.convertedFuel / nuggetFuelAmount;
ioSlots.setInventorySlotContents(1, new ItemStack(ModItems.chaosFragment, stackSize, 0));
core.convertedFuel -= stackSize * nuggetFuelAmount;
}
}
return super.slotClick(slot, button, p_75144_3_, player1);
return super.slotClick(slot, button, mode, player);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
return null;
}
public static class SlotInsert extends Slot {
private int numberAllowed = -1;
private TileReactorCore reactor;
private int stackSizeLimit = 0;
private final TileReactorCore core;
public SlotInsert(IInventory iInventory, int iSlot, int x, int y, TileReactorCore reactor) {
super(iInventory, iSlot, x, y);
this.reactor = reactor;
public SlotInsert(IInventory inventory, int slot, int x, int y, TileReactorCore core) {
super(inventory, slot, x, y);
this.core = core;
}
@Override
public boolean isItemValid(ItemStack stack) {
if (stack == null) return false;
else if (stack.getItem() == ModItems.nugget && stack.getItemDamage() == 1)
numberAllowed = (10368 - (reactor.reactorFuel + reactor.convertedFuel)) / 16;
else if (stack.getItem() == ModItems.draconicIngot)
numberAllowed = (10368 - (reactor.reactorFuel + reactor.convertedFuel)) / 144;
else if (stack.getItem() == Item.getItemFromBlock(ModBlocks.draconicBlock))
numberAllowed = (10368 - (reactor.reactorFuel + reactor.convertedFuel)) / 1296;
else return false;
return numberAllowed > 0;
if (stack == null) {
return false;
}
Set<String> oreNames = OreDictionaryHelper.getOreNames(stack);
if (oreNames.contains("nuggetDraconiumAwakened")) {
stackSizeLimit = (maximumFuelStorage - (core.reactorFuel + core.convertedFuel)) / nuggetFuelAmount;
} else if (oreNames.contains("ingotDraconiumAwakened")) {
stackSizeLimit = (maximumFuelStorage - (core.reactorFuel + core.convertedFuel)) / ingotFuelAmount;
} else if (oreNames.contains("blockDraconiumAwakened")) {
stackSizeLimit = (maximumFuelStorage - (core.reactorFuel + core.convertedFuel)) / blockFuelAmount;
} else {
return false;
}
return stackSizeLimit > 0;
}
@Override
public int getSlotStackLimit() {
return numberAllowed;
return stackSizeLimit;
}
}
public static class SlotExtract extends Slot {
private GenericInventory inventory;
public SlotExtract(GenericInventory iInventory, int iSlot, int x, int y) {
super(iInventory, iSlot, x, y);
inventory = iInventory;
public SlotExtract(GenericInventory inventory, int slot, int x, int y) {
super(inventory, slot, x, y);
}
@Override
@@ -54,7 +54,7 @@ public class ChaosImplosionTrace implements IProcess {
List<Entity> entities = worldObj.getEntitiesWithinAABB(
Entity.class,
AxisAlignedBB.getBoundingBox(xCoord, y, zCoord, xCoord + 1, y + 1, zCoord + 1));
for (Entity entity : entities) entity.attackEntityFrom(ReactorExplosion.fusionExplosion, power * 100);
for (Entity entity : entities) entity.attackEntityFrom(ReactorExplosion.FUSION_EXPLOSION, power * 100);
// energy -= block instanceof BlockLiquid ? 10 : block.getExplosionResistance(null);
if (energy >= 0) worldObj.setBlockToAir(xCoord, y, zCoord);
@@ -15,7 +15,14 @@ import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import net.minecraft.util.Vec3;
import net.minecraft.util.WeightedRandom;
import net.minecraft.world.World;
import com.brandon3055.brandonscore.common.utills.Utills;
@@ -11,6 +11,7 @@ import com.brandon3055.brandonscore.common.handlers.ProcessHandler;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.render.particle.Particles;
import com.brandon3055.draconicevolution.common.network.GenericParticlePacket;
import cpw.mods.fml.common.network.NetworkRegistry;
/**
@@ -17,7 +17,12 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.play.server.S2BPacketChangeGameState;
import net.minecraft.util.*;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSourceIndirect;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import com.brandon3055.draconicevolution.DraconicEvolution;
@@ -17,7 +17,11 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.play.server.S2BPacketChangeGameState;
import net.minecraft.util.*;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
@@ -10,11 +10,13 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.brandonscore.common.utills.Teleporter;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.DraconicEvolution;
@@ -22,6 +24,7 @@ import com.brandon3055.draconicevolution.client.handler.ParticleHandler;
import com.brandon3055.draconicevolution.client.render.particle.Particles;
import com.brandon3055.draconicevolution.common.network.GenericParticlePacket;
import cofh.api.energy.IEnergyContainerItem;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -9,7 +9,11 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
@@ -10,6 +10,7 @@ import net.minecraftforge.common.config.Property;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem.EnumUpgrade;
import cpw.mods.fml.common.registry.GameRegistry;
public class BalanceConfigHandler {
@@ -30,11 +30,11 @@ public class ConfigHandler {
public static boolean disableOreSpawnEnd;
public static boolean disableOreSpawnOverworld;
public static boolean disableOreSpawnNether;
public static boolean enableVersionChecker;
public static boolean dragonBreaksBlocks;
public static boolean sumonRitualAccelerated;
public static int[] dragonEggSpawnLocation;
public static int[] oreGenDimentionBlacklist;
public static int[] oreGenDimensionWhitelist;
public static int[] hudSettings;
private static String[] disabledBlocksItems;
public static List<String> disabledNamesList = new ArrayList<String>();
@@ -177,11 +177,6 @@ public class ConfigHandler {
"Disable Ore Spawn (Overworld)",
false,
"Set to true to prevent draconium ore from spawning in the overworld").getBoolean(false);
enableVersionChecker = config.get(
Configuration.CATEGORY_GENERAL,
"Enable version checker",
true,
"Set to false to disable the version checker").getBoolean(true);
dragonBreaksBlocks = config.get(
Configuration.CATEGORY_GENERAL,
"Can dragon break blocks",
@@ -199,6 +194,12 @@ public class ConfigHandler {
"Ore gen dimension blacklist",
new int[0],
"Add the id's of dimensions you do not want draconium ore to spawn in").getIntList();
oreGenDimensionWhitelist = config.get(
Configuration.CATEGORY_GENERAL,
"Ore gen dimension whitelist",
new int[0],
"Add the id's of dimensions you do want draconium ore to spawn in (if empty, uses only the blacklist)")
.getIntList();
disabledBlocksItems = config.getStringList(
"Disabled Blocks & Items",
Configuration.CATEGORY_GENERAL,
@@ -1,6 +1,10 @@
package com.brandon3055.draconicevolution.common.handler;
import java.io.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -609,6 +609,17 @@ public class CraftingHandler {
"ingotDraconium",
'C',
ModItems.draconicCore);
addOre(
ModBlocks.dislocatorInhibitor,
"IBI",
"BDB",
"IBI",
'I',
"ingotIron",
'B',
Blocks.iron_bars,
'D',
new ItemStack(ModItems.magnet, 1, 0));
// machines adv
ItemStack mobSoul = new ItemStack(ModItems.mobSoul);
@@ -34,7 +34,11 @@ import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.entity.living.*;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
@@ -1,7 +1,8 @@
package com.brandon3055.draconicevolution.common.inventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.*;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest;
@@ -4,10 +4,10 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
import cofh.api.energy.IEnergyContainerItem;
public class SlotChargable extends Slot {
public SlotChargable(IInventory inventory, int id, int x, int y) {
@@ -9,6 +9,7 @@ import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import com.brandon3055.draconicevolution.common.lib.References;
import cpw.mods.fml.common.registry.GameRegistry;
/**
@@ -10,6 +10,7 @@ import com.brandon3055.draconicevolution.client.gui.GuiHandler;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
/**
@@ -3,7 +3,11 @@ package com.brandon3055.draconicevolution.common.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.*;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
@@ -1,6 +1,10 @@
package com.brandon3055.draconicevolution.common.items.armor;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.WeakHashMap;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
@@ -15,8 +19,6 @@ import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.brandonscore.BrandonsCore;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.DraconicEvolution;
@@ -26,6 +28,7 @@ import com.brandon3055.draconicevolution.common.network.ShieldHitPacket;
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
import com.brandon3055.draconicevolution.integration.ModHelper;
import cofh.api.energy.IEnergyContainerItem;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
@@ -12,7 +12,11 @@ import net.minecraft.enchantment.EnumEnchantmentType;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.*;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
@@ -22,11 +26,6 @@ import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.ISpecialArmor;
import thaumcraft.api.IGoggles;
import thaumcraft.api.IVisDiscountGear;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.nodes.IRevealer;
import com.brandon3055.brandonscore.BrandonsCore;
import com.brandon3055.brandonscore.common.utills.InfoHelper;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
@@ -56,6 +55,10 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.apiculture.IArmorApiarist;
import forestry.api.core.IArmorNaturalist;
import thaumcraft.api.IGoggles;
import thaumcraft.api.IVisDiscountGear;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.nodes.IRevealer;
/**
* Created by Brandon on 3/07/2014.
@@ -11,7 +11,11 @@ import net.minecraft.enchantment.EnumEnchantmentType;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.*;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
@@ -19,10 +23,6 @@ import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.ISpecialArmor;
import thaumcraft.api.IVisDiscountGear;
import thaumcraft.api.IWarpingGear;
import thaumcraft.api.aspects.Aspect;
import com.brandon3055.brandonscore.BrandonsCore;
import com.brandon3055.brandonscore.common.utills.InfoHelper;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
@@ -46,6 +46,9 @@ import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import thaumcraft.api.IVisDiscountGear;
import thaumcraft.api.IWarpingGear;
import thaumcraft.api.aspects.Aspect;
/**
* Created by Brandon on 3/07/2014.
@@ -22,8 +22,6 @@ import net.minecraftforge.event.entity.player.UseHoeEvent;
import org.lwjgl.opengl.GL11;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.brandonscore.common.utills.InfoHelper;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.brandonscore.common.utills.Utills;
@@ -35,8 +33,13 @@ import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler;
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolBase;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.utills.*;
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem;
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import cofh.api.energy.IEnergyContainerItem;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
@@ -14,8 +14,6 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.brandonscore.common.utills.InfoHelper;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.brandonscore.common.utills.Utills;
@@ -27,6 +25,7 @@ import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolBase
import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
import cofh.api.energy.IEnergyContainerItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -1,15 +1,18 @@
package com.brandon3055.draconicevolution.common.items.tools;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
@@ -24,14 +27,23 @@ import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.items.ItemDE;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.TileDislocatorInhibitor;
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
import com.brandon3055.draconicevolution.integration.ModHelper;
import baubles.api.BaubleType;
import baubles.api.IBauble;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Created by brandon3055 on 9/3/2016.
*/
public class Magnet extends ItemDE {
@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles")
public class Magnet extends ItemDE implements IBauble, IConfigurableItem {
private IIcon draconium;
private IIcon awakened;
@@ -79,9 +91,14 @@ public class Magnet extends ItemDE {
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean hotbar) {
if (!entity.isSneaking() && entity.ticksExisted % 5 == 0
&& isEnabled(stack)
&& entity instanceof EntityPlayer) {
if (entity.ticksExisted % 5 != 0 || !isEnabled(stack)) {
return;
}
if (IConfigurableItem.ProfileHelper.getBoolean(stack, References.MAGNET_SNEAK, true) && entity.isSneaking()) {
return;
}
if (entity instanceof EntityPlayer player) {
int range = stack.getItemDamage() == 0 ? 8 : 32;
List<EntityItem> items = world.getEntitiesWithinAABB(
@@ -97,7 +114,8 @@ public class Magnet extends ItemDE {
boolean playSound = false;
for (EntityItem item : items) {
if (item.getEntityItem() == null) {
if (item.getEntityItem() == null || ModHelper.isAE2EntityFloatingItem(item)
|| TileDislocatorInhibitor.isInInhibitorRange(world, item.posX, item.posY, item.posZ)) {
continue;
}
@@ -139,7 +157,6 @@ public class Magnet extends ItemDE {
entity.posX,
entity.posY,
entity.posZ).expand(4, 4, 4));
EntityPlayer player = (EntityPlayer) entity;
for (EntityXPOrb orb : xp) {
if (orb.field_70532_c == 0 && orb.isEntityAlive()) {
if (MinecraftForge.EVENT_BUS.post(new PlayerPickupXpEvent(player, orb))) continue;
@@ -158,15 +175,24 @@ public class Magnet extends ItemDE {
}
public static boolean isEnabled(ItemStack itemStack) {
return ItemNBTHelper.getBoolean(itemStack, "MagnetEnabled", false);
// For backward compatibility
if (ItemNBTHelper.verifyExistance(itemStack, "MagnetEnabled")) {
final NBTTagCompound nbt = itemStack.getTagCompound();
final boolean enabled = nbt.getBoolean("MagnetEnabled");
IConfigurableItem.ProfileHelper.setBoolean(itemStack, References.ENABLED, enabled);
nbt.removeTag("MagnetEnabled");
return enabled;
}
return IConfigurableItem.ProfileHelper.getBoolean(itemStack, References.ENABLED, false);
}
public static void toggle(ItemStack itemStack) {
ItemNBTHelper.setBoolean(itemStack, "MagnetEnabled", !isEnabled(itemStack));
final boolean enabled = IConfigurableItem.ProfileHelper.getBoolean(itemStack, References.ENABLED, false);
IConfigurableItem.ProfileHelper.setBoolean(itemStack, References.ENABLED, !enabled);
}
public static void setStatus(ItemStack itemStack, boolean status) {
ItemNBTHelper.setBoolean(itemStack, "MagnetEnabled", status);
IConfigurableItem.ProfileHelper.setBoolean(itemStack, References.ENABLED, status);
}
@Override
@@ -187,4 +213,54 @@ public class Magnet extends ItemDE {
+ " "
+ StatCollector.translateToLocal("info.de.blockRange.txt"));
}
@Override
@Optional.Method(modid = "Baubles")
public BaubleType getBaubleType(ItemStack itemstack) {
return BaubleType.UNIVERSAL;
}
@Override
@Optional.Method(modid = "Baubles")
public void onWornTick(ItemStack itemstack, EntityLivingBase player) {
World world = player.worldObj;
onUpdate(itemstack, world, player, 0, false);
}
@Override
@Optional.Method(modid = "Baubles")
public void onEquipped(ItemStack itemstack, EntityLivingBase player) {
}
@Override
@Optional.Method(modid = "Baubles")
public void onUnequipped(ItemStack itemstack, EntityLivingBase player) {
}
@Override
@Optional.Method(modid = "Baubles")
public boolean canEquip(ItemStack itemstack, EntityLivingBase player) {
return true;
}
@Override
@Optional.Method(modid = "Baubles")
public boolean canUnequip(ItemStack itemstack, EntityLivingBase player) {
return true;
}
@Override
public List<ItemConfigField> getFields(ItemStack stack, int slot) {
List<ItemConfigField> fields = new ArrayList<>();
fields.add(new ItemConfigField(References.BOOLEAN_ID, slot, References.ENABLED).readFromItem(stack, false));
fields.add(new ItemConfigField(References.BOOLEAN_ID, slot, References.MAGNET_SNEAK).readFromItem(stack, true));
return fields;
}
@Override
public boolean hasProfiles() {
return false;
}
}
@@ -13,8 +13,6 @@ import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import cofh.api.energy.IEnergyReceiver;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModItems;
@@ -24,6 +22,7 @@ import com.brandon3055.draconicevolution.common.tileentities.energynet.TileRemot
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileWirelessEnergyTransceiver;
import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem;
import cofh.api.energy.IEnergyReceiver;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -47,11 +46,6 @@ public class Wrench extends ItemDE implements IHudDisplayItem {
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
// if (world.isRemote)FMLCommonHandler.instance().bus().register(new UpdateChecker());
// player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.BLUE + "[Draconic Evolution]" +
// EnumChatFormatting.RESET + " New version available:"));
if (player.isSneaking()) cycleMode(stack, world, player);
else if (ItemNBTHelper.getCompound(stack).hasKey("LinkData")
&& ItemNBTHelper.getCompound(stack).getCompoundTag("LinkData").getBoolean("Bound"))
@@ -12,8 +12,6 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.brandonscore.common.utills.InfoHelper;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.brandonscore.common.utills.Utills;
@@ -24,6 +22,7 @@ import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem;
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
import cofh.api.energy.IEnergyContainerItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -15,7 +15,11 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.network.play.server.S23PacketBlockChange;
import net.minecraft.util.*;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import com.brandon3055.draconicevolution.common.ModItems;
@@ -14,8 +14,6 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
import net.minecraftforge.event.entity.player.ArrowNockEvent;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.entity.EntityCustomArrow;
import com.brandon3055.draconicevolution.common.entity.EntityEnderArrow;
@@ -23,6 +21,8 @@ import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler;
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
import cofh.api.energy.IEnergyContainerItem;
public class BowHandler {
public static ItemStack onBowRightClick(Item bow, ItemStack stack, World world, EntityPlayer player) {
@@ -34,7 +34,11 @@ import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHand
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.network.ToolModePacket;
import com.brandon3055.draconicevolution.common.utills.*;
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem;
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
import com.google.common.collect.Multimap;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -35,7 +35,11 @@ import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHand
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.network.ToolModePacket;
import com.brandon3055.draconicevolution.common.utills.*;
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem;
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
import com.google.common.collect.Multimap;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -12,6 +12,7 @@ import net.minecraftforge.oredict.OreDictionary;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.items.DraconiumBlend;
import cpw.mods.fml.common.registry.GameRegistry;
/**
Loaded 100 of 158 files, more files were not shown because too many files have changed in this diff. Show more