mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-15 01:25:13 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
948a021f3e | ||
|
|
346bbf4e53 | ||
|
|
5769ebe3cb | ||
|
|
4558f194be | ||
|
|
e12142890e | ||
|
|
e6ebb5dfec | ||
|
|
1d4f6831dd | ||
|
|
726ce46475 | ||
|
|
d01de95e8e | ||
|
|
b15d357f1a | ||
|
|
0fbf6f05ba | ||
|
|
bf9c2cd2c7 | ||
|
|
51b4c4e74c | ||
|
|
cf6b678dd9 | ||
|
|
6c205150b1 | ||
|
|
e39a1e1eb6 | ||
|
|
4a94c1ba90 | ||
|
|
0fc382dd13 | ||
|
|
04964e15e4 | ||
|
|
085ccc9d21 | ||
|
|
1903589e29 | ||
|
|
46971bbe0e | ||
|
|
4ccecf7bc0 | ||
|
|
92fb58f0c6 | ||
|
|
54c6db0afc | ||
|
|
84d9dcaf00 | ||
|
|
af923d1977 | ||
|
|
efb918fc6d | ||
|
|
6447ffb4d5 | ||
|
|
fb4c9bde59 | ||
|
|
bd47a39c83 | ||
|
|
43d74c9a7a | ||
|
|
6d3a631bb0 | ||
|
|
ccdef03296 | ||
|
|
56e163c234 | ||
|
|
8ecec5b096 | ||
|
|
4e3fbc7667 | ||
|
|
845f277497 | ||
|
|
94fb952cb0 | ||
|
|
29554c6a40 | ||
|
|
fc5cba342c | ||
|
|
05d31b2e70 | ||
|
|
5265340e3c | ||
|
|
37e239ae81 | ||
|
|
a725ebf120 | ||
|
|
6affe75674 | ||
|
|
19f19d348b | ||
|
|
3154d03b4f | ||
|
|
9e84167012 | ||
|
|
d1a1bf1ed5 | ||
|
|
c1309fa37d | ||
|
|
6a0785e1da |
No files matched your search
+2
-1607
File diff suppressed because it is too large.
Load diff
+15
-13
@@ -1,26 +1,28 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:EnderCore:0.3.0:dev')
|
||||
implementation('com.github.GTNewHorizons:ForestryMC:4.7.1:dev')
|
||||
implementation('com.github.GTNewHorizons:NotEnoughItems:2.4.13-GTNH:dev')
|
||||
implementation("com.github.GTNewHorizons:GTNHLib:0.0.13:dev")
|
||||
api('com.github.GTNewHorizons:BuildCraft:7.1.38:dev')
|
||||
api('com.github.GTNewHorizons:EnderCore:0.4.6:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.10.0:dev')
|
||||
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.7.8-GTNH:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.6.0:dev")
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.39:dev')
|
||||
api('curse.maven:cofh-lib-220333:2388748') // https://www.curseforge.com/minecraft/mc-mods/cofh-lib/files/2388748
|
||||
shadowImplementation('cglib:cglib-nodep:3.3.0')
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.6.5:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-304-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Baubles:1.0.3:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.06:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.15.3:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.12.2-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Chisel:2.12.3-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.10.0-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.8.2:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-511-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Baubles:1.0.4:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.36:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.16.0:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.0.5-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Chisel:2.16.0-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.1-GTNH:api') {transitive = false}
|
||||
compileOnly('curse.maven:minefactory-reloaded-66672:2366150') // https://www.curseforge.com/minecraft/mc-mods/minefactory-reloaded/files/2366150
|
||||
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
compileOnly('curse.maven:ee3-65509:2305023') // https://www.curseforge.com/minecraft/mc-mods/ee3/files/2305023
|
||||
compileOnly(rfg.deobf('curse.maven:computercraft-67504:2269339')) // https://www.curseforge.com/minecraft/mc-mods/computercraft/files/2269339
|
||||
compileOnly(rfg.deobf('curse.maven:mekanism-268560:2475797')) // https://www.curseforge.com/minecraft/mc-mods/mekanism/files/2475797
|
||||
compileOnly(rfg.deobf('maven.modrinth:immibis-microblocks:59.1.2')) // https://modrinth.com/mod/immibis-microblocks/version/59.1.2
|
||||
|
||||
compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-beta28:api') {transitive = false}
|
||||
}
|
||||
+160
-27
@@ -1,63 +1,109 @@
|
||||
# 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 = Ender IO
|
||||
|
||||
# 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 = EnderIO
|
||||
|
||||
# Root package of the mod, used to find various classes in other properties,
|
||||
# mcmod.info substitution, enabling assertions in run tasks, etc.
|
||||
modGroup = crazypants.enderio
|
||||
|
||||
# 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
|
||||
|
||||
# Specify a MCP channel and mappings version for dependency deobfuscation and the deobfParams task.
|
||||
# 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
|
||||
|
||||
# Define other MCP mappings for dependency deobfuscation
|
||||
remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
||||
# Defines other MCP mappings for dependency deobfuscation.
|
||||
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
||||
|
||||
# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name each time you
|
||||
# restart Minecraft in development. Choose this dependent on your mod:
|
||||
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
|
||||
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
|
||||
# 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:
|
||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
# The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's
|
||||
# version in @Mod([...], version = VERSION, [...])
|
||||
# Leave these properties empty to skip individual token replacements
|
||||
replaceGradleTokenInFile = EnderIO.java
|
||||
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
||||
# See https://github.com/bsideup/jabel for details on how this works.
|
||||
enableModernJavaSyntax = false
|
||||
|
||||
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
||||
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||
enableGenericInjection = false
|
||||
|
||||
# Generate a class with a String field for the mod version named as defined below.
|
||||
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
|
||||
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
|
||||
generateGradleTokenClass = crazypants.enderio.Tags
|
||||
|
||||
# Name of the token containing the project's current version to generate/replace.
|
||||
gradleTokenVersion = VERSION
|
||||
|
||||
# [DEPRECATED] Mod ID replacement token.
|
||||
gradleTokenModId =
|
||||
|
||||
# [DEPRECATED] Mod name replacement token.
|
||||
gradleTokenModName =
|
||||
gradleTokenVersion = GRADLETOKEN_VERSION
|
||||
|
||||
# [DEPRECATED] Mod Group replacement token.
|
||||
gradleTokenGroupName =
|
||||
|
||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can
|
||||
# [DEPRECATED]
|
||||
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
|
||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
|
||||
# version in @Mod([...], version = VERSION, [...]).
|
||||
# Leave these properties empty to skip individual token replacements.
|
||||
replaceGradleTokenInFile =
|
||||
|
||||
# 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 compatability only
|
||||
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
|
||||
# This parameter is for legacy compatibility only
|
||||
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
|
||||
coreModClass =
|
||||
|
||||
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
||||
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||
containsMixinsAndOrCoreModOnly = false
|
||||
@@ -65,6 +111,93 @@ containsMixinsAndOrCoreModOnly = false
|
||||
# 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 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your
|
||||
# responsibility check the licence and request permission for distribution, if required.
|
||||
# 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 = true
|
||||
|
||||
# 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 =
|
||||
|
||||
# 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
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -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,7 +85,9 @@ done
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||
' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -144,7 +148,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 +156,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
|
||||
@@ -201,11 +205,11 @@ fi
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, 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.
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
|
||||
Vendored
+12
-10
@@ -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
|
||||
|
||||
|
||||
+5
-10
@@ -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.30'
|
||||
}
|
||||
|
||||
blowdryerSetup {
|
||||
repoSubfolder 'gtnhShared'
|
||||
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
|
||||
//devLocal '.' // Use this when testing config updates locally
|
||||
}
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package crazypants.enderio;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -30,39 +27,29 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.conduit.BlockConduitBundle;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.TileConduitBundle;
|
||||
import crazypants.enderio.conduit.facade.FacadeRenderer;
|
||||
import crazypants.enderio.conduit.gas.GasConduit;
|
||||
import crazypants.enderio.conduit.gas.GasConduitRenderer;
|
||||
import crazypants.enderio.conduit.gas.GasUtil;
|
||||
import crazypants.enderio.conduit.item.ItemConduit;
|
||||
import crazypants.enderio.conduit.liquid.AbstractEnderLiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.AdvancedLiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.AdvancedLiquidConduitRenderer;
|
||||
import crazypants.enderio.conduit.liquid.CrystallineEnderLiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.CrystallinePinkSlimeEnderLiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.EnderLiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.EnderLiquidConduitRenderer;
|
||||
import crazypants.enderio.conduit.liquid.LiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.LiquidConduitRenderer;
|
||||
import crazypants.enderio.conduit.liquid.MelodicEnderLiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.StellarEnderLiquidConduit;
|
||||
import crazypants.enderio.conduit.me.MEConduit;
|
||||
import crazypants.enderio.conduit.me.MEUtil;
|
||||
import crazypants.enderio.conduit.oc.OCConduit;
|
||||
import crazypants.enderio.conduit.oc.OCConduitRenderer;
|
||||
import crazypants.enderio.conduit.oc.OCUtil;
|
||||
import crazypants.enderio.conduit.power.PowerConduit;
|
||||
import crazypants.enderio.conduit.power.PowerConduitRenderer;
|
||||
import crazypants.enderio.conduit.power.endergy.PowerConduitEndergy;
|
||||
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduitRenderer;
|
||||
import crazypants.enderio.conduit.redstone.RedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.RedstoneSwitch;
|
||||
import crazypants.enderio.conduit.redstone.RedstoneSwitchRenderer;
|
||||
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
|
||||
import crazypants.enderio.conduit.render.ItemConduitRenderer;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.enderface.EnderIoRenderer;
|
||||
@@ -166,10 +153,6 @@ public class ClientProxy extends CommonProxy {
|
||||
};
|
||||
// @formatter:on
|
||||
|
||||
private final List<ConduitRenderer> conduitRenderers = new ArrayList<ConduitRenderer>();
|
||||
|
||||
private final DefaultConduitRenderer dcr = new DefaultConduitRenderer();
|
||||
|
||||
private ConduitBundleRenderer cbr;
|
||||
|
||||
private boolean checkedNei = false;
|
||||
@@ -394,7 +377,6 @@ public class ClientProxy extends CommonProxy {
|
||||
cbr = new ConduitBundleRenderer((float) Config.conduitScale);
|
||||
BlockConduitBundle.rendererId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(cbr);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileConduitBundle.class, cbr);
|
||||
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileTravelAnchor.class, new TravelEntitySpecialRenderer());
|
||||
|
||||
@@ -403,20 +385,6 @@ public class ClientProxy extends CommonProxy {
|
||||
RenderingRegistry.registerBlockHandler(esk);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockEndermanSkull), esk);
|
||||
|
||||
conduitRenderers.add(RedstoneSwitchRenderer.getInstance());
|
||||
conduitRenderers.add(new AdvancedLiquidConduitRenderer());
|
||||
conduitRenderers.add(LiquidConduitRenderer.create());
|
||||
conduitRenderers.add(new PowerConduitRenderer());
|
||||
conduitRenderers.add(new InsulatedRedstoneConduitRenderer());
|
||||
conduitRenderers.add(new EnderLiquidConduitRenderer());
|
||||
conduitRenderers.add(new crazypants.enderio.conduit.item.ItemConduitRenderer());
|
||||
if (GasUtil.isGasConduitEnabled()) {
|
||||
conduitRenderers.add(new GasConduitRenderer());
|
||||
}
|
||||
if (OCUtil.isOCEnabled()) {
|
||||
conduitRenderers.add(new OCConduitRenderer());
|
||||
}
|
||||
|
||||
EnderIoRenderer eior = new EnderIoRenderer();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEnderIO.class, eior);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockEnderIo), eior);
|
||||
@@ -480,12 +448,7 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
@Override
|
||||
public ConduitRenderer getRendererForConduit(IConduit conduit) {
|
||||
for (ConduitRenderer renderer : conduitRenderers) {
|
||||
if (renderer.isRendererForConduit(conduit)) {
|
||||
return renderer;
|
||||
}
|
||||
}
|
||||
return dcr;
|
||||
return conduit.getRenderer();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,6 +34,7 @@ public class CommonProxy {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ConduitRenderer getRendererForConduit(IConduit conduit) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -186,14 +186,14 @@ import crazypants.util.EE3Util;
|
||||
modid = MODID,
|
||||
name = MOD_NAME,
|
||||
version = VERSION,
|
||||
dependencies = "after:endercore;after:MineFactoryReloaded;after:Forestry;after:Waila@[1.5.8,);after:Thaumcraft;after:appliedenergistics2@[rv2-beta-8,);after:chisel",
|
||||
dependencies = "required-after:CoFHLib@(1.0.3B3,);after:endercore;after:MineFactoryReloaded;after:Forestry;after:Waila@[1.5.8,);after:Thaumcraft;after:appliedenergistics2@[rv2-beta-8,);after:chisel;required-after:gtnhlib@[0.2.10,)",
|
||||
guiFactory = "crazypants.enderio.config.ConfigFactoryEIO")
|
||||
public class EnderIO {
|
||||
|
||||
public static final String MODID = "EnderIO";
|
||||
public static final String DOMAIN = MODID.toLowerCase(Locale.US);
|
||||
public static final String MOD_NAME = "Ender IO";
|
||||
public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
public static final String VERSION = Tags.VERSION;
|
||||
|
||||
@Instance(MODID)
|
||||
public static EnderIO instance;
|
||||
|
||||
@@ -81,7 +81,7 @@ public enum TravelSource {
|
||||
return 0;
|
||||
}
|
||||
|
||||
TravelSource source = TravelController.instance.getTravelItemTravelSource(player);
|
||||
TravelSource source = TravelController.instance.getTravelItemTravelSource(player, false);
|
||||
if (source == null) {
|
||||
return TravelSource.BLOCK.getMaxDistanceTravelledSq();
|
||||
} else {
|
||||
|
||||
@@ -67,7 +67,6 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
|
||||
if (MicroblocksUtil.supportMicroblocks() && tryAddToMicroblocks(stack, player, world, x, y, z, side)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
BlockCoord placeAt = Util.canPlaceItem(stack, EnderIO.blockConduitBundle, player, world, x, y, z, side);
|
||||
if (placeAt != null) {
|
||||
if (!world.isRemote) {
|
||||
@@ -84,9 +83,7 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
|
||||
stack.stackSize--;
|
||||
}
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
ForgeDirection dir = ForgeDirection.values()[side];
|
||||
int placeX = x + dir.offsetX;
|
||||
int placeY = y + dir.offsetY;
|
||||
@@ -116,7 +113,6 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -162,8 +158,7 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
|
||||
System.out.println("AbstractItemConduit.onItemUse: Conduit null.");
|
||||
return false;
|
||||
}
|
||||
bundle.removeConduit(existingConduit);
|
||||
bundle.addConduit(newConduit);
|
||||
bundle.replaceConduit(existingConduit, newConduit);
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
stack.stackSize--;
|
||||
for (ItemStack drop : existingConduit.getDrops()) {
|
||||
|
||||
@@ -697,10 +697,6 @@ public class ConduitRecipes {
|
||||
|
||||
res.stackSize = 1;
|
||||
ItemStack resDense = new ItemStack(EnderIO.itemMEConduit, 1, 1);
|
||||
ItemStack resUltra = new ItemStack(EnderIO.itemMEConduit, 1, 2);
|
||||
addShaped(resDense, "bCb", "CbC", "bCb", 'b', conduitBinder, 'C', res);
|
||||
if (Config.enableMEUltraDenseConduits) {
|
||||
addShaped(resUltra, "bCb", "CbC", "bCb", 'b', conduitBinder, 'C', resDense);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,7 +158,7 @@ public class ConduitUtil {
|
||||
}
|
||||
|
||||
public static boolean isFacadeHidden(IConduitBundle bundle, EntityPlayer player) {
|
||||
return bundle.getFacadeId() != null && shouldHeldItemHideFacades(player);
|
||||
return bundle != null && bundle.getFacadeId() != null && shouldHeldItemHideFacades(player);
|
||||
}
|
||||
|
||||
public static ConduitDisplayMode getDisplayMode(EntityPlayer player) {
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
import crazypants.enderio.conduit.geom.CollidableCache.CacheKey;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
|
||||
public interface IConduit {
|
||||
|
||||
@@ -141,4 +142,6 @@ public interface IConduit {
|
||||
* Should the texture of the conduit connectors be mirrored around the conduit node?
|
||||
*/
|
||||
boolean shouldMirrorTexture();
|
||||
|
||||
ConduitRenderer getRenderer();
|
||||
}
|
||||
@@ -49,6 +49,8 @@ public interface IConduitBundle extends IInternalPowerHandler, IFluidHandler, II
|
||||
|
||||
void addConduit(IConduit conduit);
|
||||
|
||||
void replaceConduit(IConduit original, IConduit replacement);
|
||||
|
||||
void removeConduit(IConduit conduit);
|
||||
|
||||
Collection<IConduit> getConduits();
|
||||
|
||||
@@ -25,6 +25,7 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
import com.gtnewhorizon.gtnhlib.concurrent.cas.CasList;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.util.AECableType;
|
||||
@@ -66,7 +67,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
|
||||
public static final short NBT_VERSION = 1;
|
||||
|
||||
private final List<IConduit> conduits = new ArrayList<IConduit>();
|
||||
private final List<IConduit> conduits = new CasList<>();
|
||||
|
||||
private Block facadeId = null;
|
||||
private int facadeMeta = 0;
|
||||
@@ -74,9 +75,9 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
|
||||
private boolean facadeChanged;
|
||||
|
||||
private final List<CollidableComponent> cachedCollidables = new ArrayList<CollidableComponent>();
|
||||
private final List<CollidableComponent> cachedCollidables = new ArrayList<>();
|
||||
|
||||
private final List<CollidableComponent> cachedConnectors = new ArrayList<CollidableComponent>();
|
||||
private final List<CollidableComponent> cachedConnectors = new ArrayList<>();
|
||||
|
||||
private boolean conduitsDirty = true;
|
||||
private boolean collidablesDirty = true;
|
||||
@@ -404,6 +405,29 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
dirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replaceConduit(IConduit original, IConduit replacement) {
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
// If you're wondering why I am not using conduit.writeToNBT, it is because there is some data that should not
|
||||
// persist, some of which causes crashes with energy conduits.
|
||||
NBTTagCompound[] originalData = new NBTTagCompound[ForgeDirection.values().length];
|
||||
for (ForgeDirection conduitConnection : original.getExternalConnections()) {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
original.writeConnectionSettingsToNBT(conduitConnection, tag);
|
||||
originalData[conduitConnection.ordinal()] = tag;
|
||||
}
|
||||
removeConduit(original);
|
||||
addConduit(replacement);
|
||||
for (int i = 0; i < originalData.length; i++) {
|
||||
NBTTagCompound nbt = originalData[i];
|
||||
if (nbt != null) {
|
||||
replacement.readConduitSettingsFromNBT(ForgeDirection.values()[i], nbt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeConduit(IConduit conduit) {
|
||||
if (conduit != null) {
|
||||
@@ -428,7 +452,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
List<IConduit> copy = new ArrayList<IConduit>(conduits);
|
||||
List<IConduit> copy = new ArrayList<>(conduits);
|
||||
for (IConduit con : copy) {
|
||||
removeConduit(con, false);
|
||||
}
|
||||
@@ -513,7 +537,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
|
||||
@Override
|
||||
public List<CollidableComponent> getConnectors() {
|
||||
List<CollidableComponent> result = new ArrayList<CollidableComponent>();
|
||||
List<CollidableComponent> result = new ArrayList<>();
|
||||
addConnectors(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.machine.painter.IPaintedBlock;
|
||||
|
||||
public class BlockConduitFacade extends BlockEio implements IPaintedBlock {
|
||||
public class BlockConduitFacade extends BlockEio implements IPaintedBlock, Cloneable {
|
||||
|
||||
public static BlockConduitFacade create() {
|
||||
BlockConduitFacade result = new BlockConduitFacade();
|
||||
@@ -24,6 +24,10 @@ public class BlockConduitFacade extends BlockEio implements IPaintedBlock {
|
||||
return result;
|
||||
}
|
||||
|
||||
public BlockConduitFacade clone() throws CloneNotSupportedException {
|
||||
return (BlockConduitFacade) super.clone();
|
||||
}
|
||||
|
||||
private Block blockOverride;
|
||||
|
||||
private BlockConduitFacade() {
|
||||
|
||||
@@ -20,6 +20,7 @@ import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import crazypants.enderio.config.Config;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasStack;
|
||||
@@ -34,7 +35,12 @@ public class GasConduit extends AbstractGasTankConduit {
|
||||
public static final String ICON_INSERT_KEY = "enderio:gasConduitOutput";
|
||||
public static final String ICON_EMPTY_EDGE = "enderio:gasConduitEdge";
|
||||
|
||||
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
|
||||
static final Map<String, IIcon> ICONS = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public ConduitRenderer getRenderer() {
|
||||
return GasConduitRenderer.instance.get();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void initIcons() {
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import static com.enderio.core.client.render.CubeRenderer.addVecWithUV;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
import com.enderio.core.client.render.CubeRenderer;
|
||||
import com.enderio.core.client.render.RenderUtil;
|
||||
import com.enderio.core.common.vecmath.Vector3d;
|
||||
import com.enderio.core.common.vecmath.Vertex;
|
||||
@@ -22,15 +20,13 @@ import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.geom.ConnectionModeGeometry;
|
||||
import crazypants.enderio.conduit.geom.Offset;
|
||||
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
|
||||
import mekanism.api.gas.GasStack;
|
||||
|
||||
public class GasConduitRenderer extends DefaultConduitRenderer {
|
||||
|
||||
@Override
|
||||
public boolean isRendererForConduit(IConduit conduit) {
|
||||
return conduit instanceof GasConduit;
|
||||
}
|
||||
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(GasConduitRenderer::new);
|
||||
|
||||
@Override
|
||||
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x,
|
||||
@@ -58,6 +54,8 @@ public class GasConduitRenderer extends DefaultConduitRenderer {
|
||||
@Override
|
||||
protected void renderConduit(IIcon tex, IConduit conduit, CollidableComponent component, float brightness) {
|
||||
super.renderConduit(tex, conduit, component, brightness);
|
||||
final CubeRenderer cr = CubeRenderer.get();
|
||||
int i;
|
||||
|
||||
if (isNSEWUD(component.dir)) {
|
||||
GasConduit lc = (GasConduit) conduit;
|
||||
@@ -103,15 +101,17 @@ public class GasConduitRenderer extends DefaultConduitRenderer {
|
||||
List<Vertex> corners = bb.getCornersWithUvForFace(d, minU, maxU, minV, maxV);
|
||||
moveEdgeCorners(corners, vDir, width);
|
||||
moveEdgeCorners(corners, component.dir.getOpposite(), sideScale);
|
||||
for (Vertex c : corners) {
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
for (i = 0; i < corners.size(); i++) {
|
||||
final Vertex c = corners.get(i);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
|
||||
corners = bb.getCornersWithUvForFace(d, minU, maxU, minV, maxV);
|
||||
moveEdgeCorners(corners, vDir.getOpposite(), width);
|
||||
moveEdgeCorners(corners, component.dir.getOpposite(), sideScale);
|
||||
for (Vertex c : corners) {
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
for (i = 0; i < corners.size(); i++) {
|
||||
final Vertex c = corners.get(i);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,14 +124,15 @@ public class GasConduitRenderer extends DefaultConduitRenderer {
|
||||
tex.getMaxU(),
|
||||
tex.getMinV(),
|
||||
tex.getMaxV());
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
for (Vertex c : corners) {
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
|
||||
for (i = 0; i < corners.size(); i++) {
|
||||
final Vertex c = corners.get(i);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
// back face
|
||||
for (int i = corners.size() - 1; i >= 0; i--) {
|
||||
Vertex c = corners.get(i);
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
for (i = corners.size() - 1; i >= 0; i--) {
|
||||
final Vertex c = corners.get(i);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,9 +11,15 @@ import cofh.api.transport.IItemDuct;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IExtractor;
|
||||
import crazypants.enderio.conduit.item.filter.IItemFilter;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
|
||||
public interface IItemConduit extends IConduit, IItemDuct, IExtractor {
|
||||
|
||||
@Override
|
||||
default ConduitRenderer getRenderer() {
|
||||
return ItemConduitRenderer.instance.get();
|
||||
}
|
||||
|
||||
IIcon getTextureForInputMode();
|
||||
|
||||
IIcon getTextureForOutputMode();
|
||||
|
||||
@@ -13,17 +13,12 @@ import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.conduit.geom.ConnectionModeGeometry;
|
||||
import crazypants.enderio.conduit.geom.Offset;
|
||||
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
|
||||
|
||||
public class ItemConduitRenderer extends DefaultConduitRenderer {
|
||||
|
||||
@Override
|
||||
public boolean isRendererForConduit(IConduit conduit) {
|
||||
if (conduit instanceof IItemConduit) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(ItemConduitRenderer::new);
|
||||
|
||||
@Override
|
||||
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x,
|
||||
|
||||
@@ -34,6 +34,7 @@ import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.RaytraceResult;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.item.ItemConduit;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.enderio.tool.ToolUtil;
|
||||
@@ -46,9 +47,14 @@ public abstract class AbstractEnderLiquidConduit extends AbstractLiquidConduit {
|
||||
public static final String ICON_KEY_IN_OUT_OUT = ItemConduit.ICON_KEY_IN_OUT_OUT;
|
||||
public static final String ICON_KEY_IN_OUT_IN = ItemConduit.ICON_KEY_IN_OUT_IN;
|
||||
|
||||
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
|
||||
static final Map<String, IIcon> ICONS = new HashMap<>();
|
||||
private final Set<BlockCoord> filledFromThisTick = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public ConduitRenderer getRenderer() {
|
||||
return EnderLiquidConduitRenderer.instance.get();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void initIcons() {
|
||||
IconUtil.addIconProvider(new IconUtil.IIconProvider() {
|
||||
|
||||
@@ -23,6 +23,7 @@ import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
|
||||
@@ -37,7 +38,12 @@ public class AdvancedLiquidConduit extends AbstractTankConduit {
|
||||
public static final String ICON_INSERT_KEY = "enderio:liquidConduitAdvancedOutput";
|
||||
public static final String ICON_EMPTY_EDGE = "enderio:liquidConduitAdvancedEdge";
|
||||
|
||||
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
|
||||
static final Map<String, IIcon> ICONS = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public ConduitRenderer getRenderer() {
|
||||
return AdvancedLiquidConduitRenderer.instance.get();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void initIcons() {
|
||||
|
||||
+17
-16
@@ -1,16 +1,14 @@
|
||||
package crazypants.enderio.conduit.liquid;
|
||||
|
||||
import static com.enderio.core.client.render.CubeRenderer.addVecWithUV;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
import com.enderio.core.client.render.CubeRenderer;
|
||||
import com.enderio.core.client.render.RenderUtil;
|
||||
import com.enderio.core.common.vecmath.Vector3d;
|
||||
import com.enderio.core.common.vecmath.Vertex;
|
||||
@@ -23,14 +21,13 @@ import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.geom.ConnectionModeGeometry;
|
||||
import crazypants.enderio.conduit.geom.Offset;
|
||||
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
|
||||
|
||||
public class AdvancedLiquidConduitRenderer extends DefaultConduitRenderer {
|
||||
|
||||
@Override
|
||||
public boolean isRendererForConduit(IConduit conduit) {
|
||||
return conduit instanceof AdvancedLiquidConduit;
|
||||
}
|
||||
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal
|
||||
.withInitial(AdvancedLiquidConduitRenderer::new);
|
||||
|
||||
@Override
|
||||
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x,
|
||||
@@ -58,6 +55,8 @@ public class AdvancedLiquidConduitRenderer extends DefaultConduitRenderer {
|
||||
@Override
|
||||
protected void renderConduit(IIcon tex, IConduit conduit, CollidableComponent component, float brightness) {
|
||||
super.renderConduit(tex, conduit, component, brightness);
|
||||
final CubeRenderer cr = CubeRenderer.get();
|
||||
int i;
|
||||
|
||||
if (isNSEWUD(component.dir)) {
|
||||
AdvancedLiquidConduit lc = (AdvancedLiquidConduit) conduit;
|
||||
@@ -106,15 +105,17 @@ public class AdvancedLiquidConduitRenderer extends DefaultConduitRenderer {
|
||||
List<Vertex> corners = bb.getCornersWithUvForFace(d, minU, maxU, minV, maxV);
|
||||
moveEdgeCorners(corners, vDir, width);
|
||||
moveEdgeCorners(corners, component.dir.getOpposite(), sideScale);
|
||||
for (Vertex c : corners) {
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
for (i = 0; i < corners.size(); i++) {
|
||||
final Vertex c = corners.get(i);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
|
||||
corners = bb.getCornersWithUvForFace(d, minU, maxU, minV, maxV);
|
||||
moveEdgeCorners(corners, vDir.getOpposite(), width);
|
||||
moveEdgeCorners(corners, component.dir.getOpposite(), sideScale);
|
||||
for (Vertex c : corners) {
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
for (i = 0; i < corners.size(); i++) {
|
||||
final Vertex c = corners.get(i);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,14 +128,14 @@ public class AdvancedLiquidConduitRenderer extends DefaultConduitRenderer {
|
||||
tex.getMaxU(),
|
||||
tex.getMinV(),
|
||||
tex.getMaxV());
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
for (Vertex c : corners) {
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
for (i = 0; i < corners.size(); i++) {
|
||||
final Vertex c = corners.get(i);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
// back face
|
||||
for (int i = corners.size() - 1; i >= 0; i--) {
|
||||
for (i = corners.size() - 1; i >= 0; i--) {
|
||||
Vertex c = corners.get(i);
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,17 +13,13 @@ import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.conduit.geom.ConnectionModeGeometry;
|
||||
import crazypants.enderio.conduit.geom.Offset;
|
||||
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
|
||||
|
||||
public class EnderLiquidConduitRenderer extends DefaultConduitRenderer {
|
||||
|
||||
@Override
|
||||
public boolean isRendererForConduit(IConduit conduit) {
|
||||
if (conduit instanceof AbstractEnderLiquidConduit) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal
|
||||
.withInitial(EnderLiquidConduitRenderer::new);
|
||||
|
||||
@Override
|
||||
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x,
|
||||
|
||||
@@ -27,6 +27,7 @@ import crazypants.enderio.conduit.ConduitUtil;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
|
||||
@@ -42,7 +43,12 @@ public class LiquidConduit extends AbstractTankConduit {
|
||||
public static final String ICON_INSERT_KEY = "enderio:liquidConduitInsert";
|
||||
public static final String ICON_EMPTY_INSERT_KEY = "enderio:emptyLiquidConduitInsert";
|
||||
|
||||
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
|
||||
static final Map<String, IIcon> ICONS = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public ConduitRenderer getRenderer() {
|
||||
return LiquidConduitRenderer.instance.get();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void initIcons() {
|
||||
@@ -137,7 +143,7 @@ public class LiquidConduit extends AbstractTankConduit {
|
||||
}
|
||||
}
|
||||
if (!foundFluid) {
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
FluidStack couldDrain = extTank.drain(dir.getOpposite(), MAX_EXTRACT_PER_TICK, false);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package crazypants.enderio.conduit.liquid;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
@@ -31,32 +31,22 @@ import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
|
||||
|
||||
public class LiquidConduitRenderer extends DefaultConduitRenderer implements IResourceManagerReloadListener {
|
||||
|
||||
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(LiquidConduitRenderer::new);
|
||||
|
||||
private float downRatio;
|
||||
|
||||
private float flatRatio;
|
||||
|
||||
private float upRatio;
|
||||
|
||||
private LiquidConduitRenderer() {
|
||||
public LiquidConduitRenderer() {
|
||||
super();
|
||||
}
|
||||
|
||||
public static LiquidConduitRenderer create() {
|
||||
LiquidConduitRenderer result = new LiquidConduitRenderer();
|
||||
RenderUtil.registerReloadListener(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRendererForConduit(IConduit conduit) {
|
||||
if (conduit instanceof LiquidConduit) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
RenderUtil.registerReloadListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,10 +56,17 @@ public class LiquidConduitRenderer extends DefaultConduitRenderer implements IRe
|
||||
super.renderEntity(conduitBundleRenderer, te, conduit, x, y, z, partialTick, worldLight, rb);
|
||||
}
|
||||
|
||||
public void renderDynamicEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit,
|
||||
double x, double y, double z, float partialTick, float worldLight) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderConduit(IIcon tex, IConduit conduit, CollidableComponent component, float brightness) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
if (isNSEWUD(component.dir)) {
|
||||
LiquidConduit lc = (LiquidConduit) conduit;
|
||||
IIcon fluidTex = conduit.getTransmitionTextureForState(component);
|
||||
FluidStack fluid = lc.getFluidType();
|
||||
if (fluid != null) {
|
||||
renderFluidOutline(component, fluid);
|
||||
@@ -77,30 +74,40 @@ public class LiquidConduitRenderer extends DefaultConduitRenderer implements IRe
|
||||
BoundingBox[] cubes = toCubes(component.bound);
|
||||
for (BoundingBox cube : cubes) {
|
||||
drawSection(cube, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV(), component.dir, false);
|
||||
// This check is kinda broken, but whatever, it was like that when this was done in a TESR too
|
||||
if (lc.getTank().getFilledRatio() <= 0) {
|
||||
continue;
|
||||
}
|
||||
tessellator.setColorOpaque_F(0.7f, 0.7f, 0.7f);
|
||||
drawSection(
|
||||
cube,
|
||||
fluidTex.getMinU(),
|
||||
fluidTex.getMaxU(),
|
||||
fluidTex.getMinV(),
|
||||
fluidTex.getMaxV(),
|
||||
component.dir,
|
||||
true);
|
||||
}
|
||||
|
||||
} else {
|
||||
drawSection(
|
||||
component.bound,
|
||||
tex.getMinU(),
|
||||
tex.getMaxU(),
|
||||
tex.getMinV(),
|
||||
tex.getMaxV(),
|
||||
component.dir,
|
||||
true);
|
||||
}
|
||||
|
||||
if (conduit.getConnectionMode(component.dir) == ConnectionMode.DISABLED) {
|
||||
tex = EnderIO.blockConduitBundle.getConnectorIcon(component.data);
|
||||
List<Vertex> corners = component.bound
|
||||
.getCornersWithUvForFace(component.dir, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV());
|
||||
for (Vertex c : corners) {
|
||||
CubeRenderer.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
// back face
|
||||
for (int i = corners.size() - 1; i >= 0; i--) {
|
||||
Vertex c = corners.get(i);
|
||||
CubeRenderer.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
if (conduit.getConnectionMode(component.dir) == ConnectionMode.DISABLED) {
|
||||
final CubeRenderer cr = CubeRenderer.get();
|
||||
int i;
|
||||
tex = EnderIO.blockConduitBundle.getConnectorIcon(component.data);
|
||||
List<Vertex> corners = component.bound.getCornersWithUvForFace(
|
||||
component.dir,
|
||||
tex.getMinU(),
|
||||
tex.getMaxU(),
|
||||
tex.getMinV(),
|
||||
tex.getMaxV());
|
||||
for (i = corners.size() - 1; i >= 0; i--) {
|
||||
Vertex c = corners.get(i);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
// back face
|
||||
for (i = corners.size() - 1; i >= 0; i--) {
|
||||
Vertex c = corners.get(i);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -120,27 +127,29 @@ public class LiquidConduitRenderer extends DefaultConduitRenderer implements IRe
|
||||
}
|
||||
}
|
||||
|
||||
private static Map<CollidableComponent, Map<Fluid, List<CachableRenderStatement>>> cache = new WeakHashMap<CollidableComponent, Map<Fluid, List<CachableRenderStatement>>>();
|
||||
private static final Map<CollidableComponent, Map<Fluid, List<CachableRenderStatement>>> cache = Collections
|
||||
.synchronizedMap(new WeakHashMap<>());
|
||||
|
||||
public static List<CachableRenderStatement> computeFluidOutlineToCache(CollidableComponent component, Fluid fluid,
|
||||
double scaleFactor, float outlineWidth) {
|
||||
|
||||
Map<Fluid, List<CachableRenderStatement>> cache0 = cache.get(component);
|
||||
if (cache0 == null) {
|
||||
cache0 = new HashMap<Fluid, List<CachableRenderStatement>>();
|
||||
cache.put(component, cache0);
|
||||
}
|
||||
// Only init once per component across all threads so the cache stays accurate.
|
||||
Map<Fluid, List<CachableRenderStatement>> cache0 = cache
|
||||
.computeIfAbsent(component, _k -> new ConcurrentHashMap<>());
|
||||
// The rest of this function 'should' be in a `computeIfAbsent` as well for:
|
||||
// `cache0.computeIfAbsent(fluid, _k -> ...)` but that won't cause a bug in this case,
|
||||
// just a bit more garbage.
|
||||
List<CachableRenderStatement> data = cache0.get(fluid);
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
data = new ArrayList<CachableRenderStatement>();
|
||||
cache0.put(fluid, data);
|
||||
data = new ArrayList<>();
|
||||
|
||||
IIcon texture = fluid.getStillIcon();
|
||||
if (texture == null) {
|
||||
texture = fluid.getIcon();
|
||||
if (texture == null) {
|
||||
cache0.put(fluid, data);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -199,6 +208,7 @@ public class LiquidConduitRenderer extends DefaultConduitRenderer implements IRe
|
||||
}
|
||||
}
|
||||
}
|
||||
cache0.put(fluid, data);
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -246,49 +256,6 @@ public class LiquidConduitRenderer extends DefaultConduitRenderer implements IRe
|
||||
// done in the dynamic section
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDynamic() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderDynamicEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit,
|
||||
double x, double y, double z, float partialTick, float worldLight) {
|
||||
|
||||
if (((LiquidConduit) conduit).getTank().getFilledRatio() <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Collection<CollidableComponent> components = conduit.getCollidableComponents();
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
calculateRatios((LiquidConduit) conduit);
|
||||
transmissionScaleFactor = conduit.getTransmitionGeometryScale();
|
||||
|
||||
IIcon tex;
|
||||
for (CollidableComponent component : components) {
|
||||
if (renderComponent(component)) {
|
||||
if (isNSEWUD(component.dir) && conduit.getTransmitionTextureForState(component) != null) {
|
||||
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
tex = conduit.getTransmitionTextureForState(component);
|
||||
|
||||
BoundingBox[] cubes = toCubes(component.bound);
|
||||
for (BoundingBox cube : cubes) {
|
||||
drawSection(
|
||||
cube,
|
||||
tex.getMinU(),
|
||||
tex.getMaxU(),
|
||||
tex.getMinV(),
|
||||
tex.getMaxV(),
|
||||
component.dir,
|
||||
true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setVerticesForTransmission(BoundingBox bound, ForgeDirection id) {
|
||||
|
||||
@@ -303,7 +270,7 @@ public class LiquidConduitRenderer extends DefaultConduitRenderer implements IRe
|
||||
float transY = (bound.sizeY() - sizeY) / 2;
|
||||
|
||||
Vector3d translation = new Vector3d(0, transY, 0);
|
||||
CubeRenderer.setupVertices(bound.translate(translation));
|
||||
CubeRenderer.get().setupVertices(bound.translate(translation));
|
||||
}
|
||||
|
||||
private void calculateRatios(LiquidConduit conduit) {
|
||||
|
||||
@@ -14,7 +14,5 @@ public interface IMEConduit extends IConduit {
|
||||
|
||||
boolean isDense();
|
||||
|
||||
boolean isDenseUltra();
|
||||
|
||||
int getChannelsInUse();
|
||||
}
|
||||
@@ -15,8 +15,7 @@ public class ItemMEConduit extends AbstractItemConduit {
|
||||
|
||||
private static ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
|
||||
new ItemConduitSubtype(ModObject.itemMEConduit.name(), "enderio:itemMeConduit"),
|
||||
new ItemConduitSubtype(ModObject.itemMEConduit.name() + "Dense", "enderio:itemMeConduitDense"),
|
||||
new ItemConduitSubtype(ModObject.itemMEConduit.name() + "DenseUltra", "enderio:itemMeConduitDenseUltra") };
|
||||
new ItemConduitSubtype(ModObject.itemMEConduit.name() + "Dense", "enderio:itemMeConduitDense") };
|
||||
|
||||
public static ItemMEConduit create() {
|
||||
ItemMEConduit result = new ItemMEConduit();
|
||||
|
||||
@@ -16,7 +16,6 @@ import com.enderio.core.client.render.IconUtil;
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.IGridConnection;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
@@ -33,10 +32,17 @@ import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.conduit.RaytraceResult;
|
||||
import crazypants.enderio.conduit.TileConduitBundle;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
|
||||
import crazypants.enderio.tool.ToolUtil;
|
||||
|
||||
public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
|
||||
@Override
|
||||
public ConduitRenderer getRenderer() {
|
||||
return DefaultConduitRenderer.instance.get();
|
||||
}
|
||||
|
||||
protected MEConduitNetwork network;
|
||||
protected MEConduitGrid grid;
|
||||
|
||||
@@ -44,7 +50,6 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
public static IIcon[] longTextures;
|
||||
|
||||
private boolean isDense;
|
||||
private boolean isDenseUltra;
|
||||
private int playerID = -1;
|
||||
|
||||
public MEConduit() {
|
||||
@@ -52,7 +57,6 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
}
|
||||
|
||||
public MEConduit(int itemDamage) {
|
||||
isDenseUltra = itemDamage == 2;
|
||||
isDense = itemDamage == 1;
|
||||
}
|
||||
|
||||
@@ -61,16 +65,14 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
coreTextures = new IIcon[3];
|
||||
longTextures = new IIcon[3];
|
||||
coreTextures = new IIcon[2];
|
||||
longTextures = new IIcon[2];
|
||||
|
||||
coreTextures[0] = register.registerIcon(EnderIO.DOMAIN + ":meConduitCore");
|
||||
coreTextures[1] = register.registerIcon(EnderIO.DOMAIN + ":meConduitCoreDense");
|
||||
coreTextures[2] = register.registerIcon(EnderIO.DOMAIN + ":meConduitCoreDenseUltra");
|
||||
|
||||
longTextures[0] = register.registerIcon(EnderIO.DOMAIN + ":meConduit");
|
||||
longTextures[1] = register.registerIcon(EnderIO.DOMAIN + ":meConduitDense");
|
||||
longTextures[2] = register.registerIcon(EnderIO.DOMAIN + ":meConduitDenseUltra");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,10 +82,7 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
});
|
||||
}
|
||||
|
||||
public static int getDamageForState(boolean isDense, boolean isDenseUltra) {
|
||||
if (isDenseUltra) {
|
||||
return 2;
|
||||
}
|
||||
public static int getDamageForState(boolean isDense) {
|
||||
if (isDense) {
|
||||
return 1;
|
||||
}
|
||||
@@ -97,7 +96,7 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
|
||||
@Override
|
||||
public ItemStack createItem() {
|
||||
return new ItemStack(EnderIO.itemMEConduit, 1, getDamageForState(isDense, isDenseUltra));
|
||||
return new ItemStack(EnderIO.itemMEConduit, 1, getDamageForState(isDense));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -115,7 +114,6 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
public void writeToNBT(NBTTagCompound nbtRoot) {
|
||||
super.writeToNBT(nbtRoot);
|
||||
nbtRoot.setBoolean("isDense", isDense);
|
||||
nbtRoot.setBoolean("isDenseUltra", isDenseUltra);
|
||||
nbtRoot.setInteger("playerID", playerID);
|
||||
}
|
||||
|
||||
@@ -128,9 +126,6 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
} else {
|
||||
playerID = -1;
|
||||
}
|
||||
if (nbtRoot.hasKey("isDenseUltra")) {
|
||||
isDenseUltra = nbtRoot.getBoolean("isDenseUltra");
|
||||
}
|
||||
}
|
||||
|
||||
public void setPlayerID(int playerID) {
|
||||
@@ -201,22 +196,12 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
|
||||
@Method(modid = "appliedenergistics2")
|
||||
private Boolean canConnectToGridNode(IGridNode node, ForgeDirection dir) {
|
||||
if (node.getGridBlock().getConnectableSides().contains(dir.getOpposite())) {
|
||||
if (isDenseUltra()) {
|
||||
return node.hasFlag(GridFlags.ULTRA_DENSE_CAPACITY)
|
||||
|| ((node.hasFlag(GridFlags.DENSE_CAPACITY)) && !node.hasFlag(GridFlags.CANNOT_CARRY));
|
||||
} else if (isDense()) {
|
||||
return true;
|
||||
} else {
|
||||
return !node.hasFlag(GridFlags.ULTRA_DENSE_CAPACITY);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return node.getGridBlock().getConnectableSides().contains(dir.getOpposite());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTextureForState(CollidableComponent component) {
|
||||
int state = getDamageForState(isDense, isDenseUltra);
|
||||
int state = getDamageForState(isDense);
|
||||
if (component.dir == ForgeDirection.UNKNOWN) {
|
||||
return coreTextures[state];
|
||||
} else {
|
||||
@@ -393,9 +378,4 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
public boolean isDense() {
|
||||
return isDense;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDenseUltra() {
|
||||
return isDenseUltra;
|
||||
}
|
||||
}
|
||||
@@ -43,9 +43,6 @@ public class MEConduitGrid implements IGridBlock {
|
||||
|
||||
@Override
|
||||
public EnumSet<GridFlags> getFlags() {
|
||||
if (conduit.isDenseUltra()) {
|
||||
return EnumSet.of(GridFlags.ULTRA_DENSE_CAPACITY);
|
||||
}
|
||||
if (conduit.isDense()) {
|
||||
return EnumSet.of(GridFlags.DENSE_CAPACITY);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.enderio.core.common.util.DyeColor;
|
||||
import cpw.mods.fml.common.Optional.Interface;
|
||||
import cpw.mods.fml.common.Optional.InterfaceList;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import li.cil.oc.api.network.Environment;
|
||||
import li.cil.oc.api.network.SidedEnvironment;
|
||||
|
||||
@@ -14,11 +15,16 @@ import li.cil.oc.api.network.SidedEnvironment;
|
||||
@Interface(iface = "li.cil.oc.api.network.SidedEnvironment", modid = "OpenComputersAPI|Network") })
|
||||
public interface IOCConduit extends IConduit, Environment, SidedEnvironment {
|
||||
|
||||
public static final String COLOR_CONTROLLER_ID = "ColorController";
|
||||
String COLOR_CONTROLLER_ID = "ColorController";
|
||||
|
||||
@Override
|
||||
default ConduitRenderer getRenderer() {
|
||||
return OCConduitRenderer.instance.get();
|
||||
}
|
||||
|
||||
void invalidate();
|
||||
|
||||
public abstract void setSignalColor(ForgeDirection dir, DyeColor col);
|
||||
void setSignalColor(ForgeDirection dir, DyeColor col);
|
||||
|
||||
public abstract DyeColor getSignalColor(ForgeDirection dir);
|
||||
DyeColor getSignalColor(ForgeDirection dir);
|
||||
}
|
||||
@@ -7,14 +7,12 @@ import com.enderio.core.client.render.CubeRenderer;
|
||||
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
|
||||
|
||||
public class OCConduitRenderer extends DefaultConduitRenderer {
|
||||
|
||||
@Override
|
||||
public boolean isRendererForConduit(IConduit conduit) {
|
||||
return conduit instanceof IOCConduit;
|
||||
}
|
||||
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(OCConduitRenderer::new);
|
||||
|
||||
@Override
|
||||
protected void renderConduit(IIcon tex, IConduit conduit, CollidableComponent component, float selfIllum) {
|
||||
@@ -23,7 +21,7 @@ public class OCConduitRenderer extends DefaultConduitRenderer {
|
||||
int c = ((IOCConduit) conduit).getSignalColor(component.dir).getColor();
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setColorOpaque_I(c);
|
||||
CubeRenderer.render(component.bound, tex);
|
||||
CubeRenderer.get().render(component.bound, tex);
|
||||
tessellator.setColorOpaque(255, 255, 255);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -5,19 +5,25 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IExtractor;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import crazypants.enderio.power.ICapacitor;
|
||||
import crazypants.enderio.power.IInternalPowerHandler;
|
||||
import crazypants.enderio.power.IPowerInterface;
|
||||
|
||||
public interface IPowerConduit extends IConduit, IInternalPowerHandler, IExtractor {
|
||||
|
||||
public static final String ICON_KEY = "enderio:powerConduit";
|
||||
public static final String ICON_KEY_INPUT = "enderio:powerConduitInput";
|
||||
public static final String ICON_KEY_OUTPUT = "enderio:powerConduitOutput";
|
||||
public static final String ICON_CORE_KEY = "enderio:powerConduitCore";
|
||||
public static final String ICON_TRANSMISSION_KEY = "enderio:powerConduitTransmission";
|
||||
String ICON_KEY = "enderio:powerConduit";
|
||||
String ICON_KEY_INPUT = "enderio:powerConduitInput";
|
||||
String ICON_KEY_OUTPUT = "enderio:powerConduitOutput";
|
||||
String ICON_CORE_KEY = "enderio:powerConduitCore";
|
||||
String ICON_TRANSMISSION_KEY = "enderio:powerConduitTransmission";
|
||||
|
||||
public static final String COLOR_CONTROLLER_ID = "ColorController";
|
||||
String COLOR_CONTROLLER_ID = "ColorController";
|
||||
|
||||
@Override
|
||||
default ConduitRenderer getRenderer() {
|
||||
return PowerConduitRenderer.instance.get();
|
||||
}
|
||||
|
||||
IPowerInterface getExternalPowerReceptor(ForgeDirection direction);
|
||||
|
||||
|
||||
@@ -17,15 +17,13 @@ import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.geom.ConnectionModeGeometry;
|
||||
import crazypants.enderio.conduit.geom.Offset;
|
||||
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
|
||||
public class PowerConduitRenderer extends DefaultConduitRenderer {
|
||||
|
||||
@Override
|
||||
public boolean isRendererForConduit(IConduit conduit) {
|
||||
return conduit instanceof IPowerConduit;
|
||||
}
|
||||
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(PowerConduitRenderer::new);
|
||||
|
||||
@Override
|
||||
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x,
|
||||
@@ -68,7 +66,7 @@ public class PowerConduitRenderer extends DefaultConduitRenderer {
|
||||
Vector3d trans = ForgeDirectionOffsets.offsetScaled(component.dir, -0.075);
|
||||
bound = bound.translate(trans);
|
||||
}
|
||||
CubeRenderer.render(bound, tex);
|
||||
CubeRenderer.get().render(bound, tex);
|
||||
tessellator.setColorOpaque(255, 255, 255);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -5,14 +5,20 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
|
||||
public interface IInsulatedRedstoneConduit extends IRedstoneConduit {
|
||||
|
||||
static final String KEY_INS_CONDUIT_ICON = "enderio:redstoneInsulatedConduit";
|
||||
static final String KEY_INS_CORE_OFF_ICON = "enderio:redstoneInsulatedConduitCoreOff";
|
||||
static final String KEY_INS_CORE_ON_ICON = "enderio:redstoneInsulatedConduitCoreOn";
|
||||
String KEY_INS_CONDUIT_ICON = "enderio:redstoneInsulatedConduit";
|
||||
String KEY_INS_CORE_OFF_ICON = "enderio:redstoneInsulatedConduitCoreOff";
|
||||
String KEY_INS_CORE_ON_ICON = "enderio:redstoneInsulatedConduitCoreOn";
|
||||
|
||||
public static final String COLOR_CONTROLLER_ID = "ColorController";
|
||||
String COLOR_CONTROLLER_ID = "ColorController";
|
||||
|
||||
@Override
|
||||
default ConduitRenderer getRenderer() {
|
||||
return InsulatedRedstoneConduitRenderer.instance.get();
|
||||
}
|
||||
|
||||
void onInputsChanged(ForgeDirection side, int[] inputValues);
|
||||
|
||||
|
||||
+4
-5
@@ -7,14 +7,13 @@ import com.enderio.core.client.render.CubeRenderer;
|
||||
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
|
||||
|
||||
public class InsulatedRedstoneConduitRenderer extends DefaultConduitRenderer {
|
||||
|
||||
@Override
|
||||
public boolean isRendererForConduit(IConduit conduit) {
|
||||
return conduit instanceof IInsulatedRedstoneConduit;
|
||||
}
|
||||
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal
|
||||
.withInitial(InsulatedRedstoneConduitRenderer::new);
|
||||
|
||||
@Override
|
||||
protected void renderConduit(IIcon tex, IConduit conduit, CollidableComponent component, float selfIllum) {
|
||||
@@ -24,7 +23,7 @@ public class InsulatedRedstoneConduitRenderer extends DefaultConduitRenderer {
|
||||
int c = ((IInsulatedRedstoneConduit) conduit).getSignalColor(component.dir).getColor();
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setColorOpaque_I(c);
|
||||
CubeRenderer.render(component.bound, tex);
|
||||
CubeRenderer.get().render(component.bound, tex);
|
||||
tessellator.setColorOpaque(255, 255, 255);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -33,12 +33,19 @@ import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
import crazypants.enderio.conduit.ConduitUtil;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
|
||||
import dan200.computercraft.api.ComputerCraftAPI;
|
||||
import powercrystals.minefactoryreloaded.api.rednet.IRedNetOutputNode;
|
||||
|
||||
public class RedstoneConduit extends AbstractConduit implements IRedstoneConduit {
|
||||
|
||||
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
|
||||
static final Map<String, IIcon> ICONS = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public ConduitRenderer getRenderer() {
|
||||
return DefaultConduitRenderer.instance.get();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void initIcons() {
|
||||
|
||||
@@ -24,6 +24,7 @@ import crazypants.enderio.conduit.RaytraceResult;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.geom.ConduitGeometryUtil;
|
||||
import crazypants.enderio.conduit.geom.Offset;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
|
||||
public class RedstoneSwitch extends RedstoneConduit {
|
||||
|
||||
@@ -33,6 +34,11 @@ public class RedstoneSwitch extends RedstoneConduit {
|
||||
|
||||
private boolean isOn;
|
||||
|
||||
@Override
|
||||
public ConduitRenderer getRenderer() {
|
||||
return RedstoneSwitchRenderer.instance.get();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void initIcons() {
|
||||
IconUtil.addIconProvider(new IconUtil.IIconProvider() {
|
||||
@@ -97,7 +103,7 @@ public class RedstoneSwitch extends RedstoneConduit {
|
||||
Vector3d trans = ConduitGeometryUtil.instance.getTranslation(ForgeDirection.UNKNOWN, o);
|
||||
|
||||
List<CollidableComponent> result = super.getCollidableComponents();
|
||||
BoundingBox[] aabb = RedstoneSwitchBounds.getInstance().getAABB();
|
||||
BoundingBox[] aabb = RedstoneSwitchBounds.get().getAABB();
|
||||
|
||||
for (BoundingBox bb : aabb) {
|
||||
result.add(
|
||||
|
||||
@@ -9,13 +9,11 @@ import crazypants.enderio.config.Config;
|
||||
|
||||
public class RedstoneSwitchBounds {
|
||||
|
||||
private static RedstoneSwitchBounds instance;
|
||||
private static final ThreadLocal<RedstoneSwitchBounds> instance = ThreadLocal
|
||||
.withInitial(RedstoneSwitchBounds::new);
|
||||
|
||||
public static final RedstoneSwitchBounds getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new RedstoneSwitchBounds();
|
||||
}
|
||||
return instance;
|
||||
public static RedstoneSwitchBounds get() {
|
||||
return RedstoneSwitchBounds.instance.get();
|
||||
}
|
||||
|
||||
final VertexTransform[] xForms;
|
||||
|
||||
@@ -17,29 +17,21 @@ import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.geom.ConduitConnectorType;
|
||||
import crazypants.enderio.conduit.geom.ConduitGeometryUtil;
|
||||
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
|
||||
import crazypants.enderio.conduit.render.ConduitRenderer;
|
||||
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
|
||||
|
||||
public class RedstoneSwitchRenderer extends DefaultConduitRenderer {
|
||||
|
||||
private static final RedstoneSwitchRenderer instance = new RedstoneSwitchRenderer();
|
||||
|
||||
public static RedstoneSwitchRenderer getInstance() {
|
||||
return instance;
|
||||
}
|
||||
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(RedstoneSwitchRenderer::new);
|
||||
|
||||
private final VertexTransform[] xForms;
|
||||
private final BoundingBox switchBounds;
|
||||
private final BoundingBox connectorBounds;
|
||||
|
||||
private RedstoneSwitchRenderer() {
|
||||
xForms = RedstoneSwitchBounds.getInstance().xForms;
|
||||
switchBounds = RedstoneSwitchBounds.getInstance().switchBounds;
|
||||
connectorBounds = RedstoneSwitchBounds.getInstance().connectorBounds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRendererForConduit(IConduit conduit) {
|
||||
return conduit.getClass() == RedstoneSwitch.class;
|
||||
public RedstoneSwitchRenderer() {
|
||||
xForms = RedstoneSwitchBounds.get().xForms;
|
||||
switchBounds = RedstoneSwitchBounds.get().switchBounds;
|
||||
connectorBounds = RedstoneSwitchBounds.get().connectorBounds;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,13 +41,15 @@ public class RedstoneSwitchRenderer extends DefaultConduitRenderer {
|
||||
super.renderEntity(conduitBundleRenderer, bundle, conduit, x, y, z, partialTick, worldLight, rb);
|
||||
|
||||
RedstoneSwitch sw = (RedstoneSwitch) conduit;
|
||||
int i;
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
final CubeRenderer cr = CubeRenderer.get();
|
||||
float selfIllum = Math.max(worldLight, conduit.getSelfIlluminationForState(null));
|
||||
tessellator.setColorOpaque_F(selfIllum, selfIllum, selfIllum);
|
||||
|
||||
IIcon[] icons = new IIcon[6];
|
||||
for (int i = 0; i < icons.length; i++) {
|
||||
for (i = 0; i < icons.length; i++) {
|
||||
icons[i] = EnderIO.blockConduitBundle.getConnectorIcon(ConduitConnectorType.INTERNAL);
|
||||
}
|
||||
icons[3] = sw.getSwitchIcon();
|
||||
@@ -65,12 +59,12 @@ public class RedstoneSwitchRenderer extends DefaultConduitRenderer {
|
||||
bundle.getOffset(IRedstoneConduit.class, ForgeDirection.UNKNOWN));
|
||||
BoundingBox bb = switchBounds.translate(trans);
|
||||
|
||||
for (VertexTransform tf : xForms) {
|
||||
CubeRenderer.render(bb, icons, tf, null);
|
||||
for (i = 0; i < xForms.length; i++) {
|
||||
cr.render(bb, icons, xForms[i], null);
|
||||
}
|
||||
bb = connectorBounds.translate(trans);
|
||||
for (VertexTransform tf : xForms) {
|
||||
CubeRenderer.render(bb, icons[0], tf);
|
||||
for (i = 0; i < xForms.length; i++) {
|
||||
cr.render(bb, icons[0], xForms[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -19,16 +18,13 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
import com.enderio.core.client.render.CubeRenderer;
|
||||
import com.enderio.core.client.render.IconUtil;
|
||||
import com.enderio.core.client.render.RenderUtil;
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import com.enderio.core.common.util.IBlockAccessWrapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -51,59 +47,18 @@ import crazypants.enderio.config.Config;
|
||||
import crazypants.util.RenderPassHelper;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler {
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
public class ConduitBundleRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public ConduitBundleRenderer(float conduitScale) {}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTick) {
|
||||
IConduitBundle bundle = (IConduitBundle) te;
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
if (bundle.hasFacade() && bundle.getFacadeId().isOpaqueCube() && !ConduitUtil.isFacadeHidden(bundle, player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
float brightness = -1;
|
||||
for (IConduit con : bundle.getConduits()) {
|
||||
if (ConduitUtil.renderConduit(player, con)) {
|
||||
ConduitRenderer renderer = EnderIO.proxy.getRendererForConduit(con);
|
||||
if (renderer.isDynamic()) {
|
||||
if (brightness == -1) {
|
||||
BlockCoord loc = bundle.getLocation();
|
||||
brightness = bundle.getEntity().getWorldObj()
|
||||
.getLightBrightnessForSkyBlocks(loc.x, loc.y, loc.z, 0);
|
||||
|
||||
RenderUtil.bindBlockTexture();
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_LIGHTING_BIT);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
}
|
||||
renderer.renderDynamicEntity(this, bundle, con, x, y, z, partialTick, brightness);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (brightness != -1) {
|
||||
Tessellator.instance.draw();
|
||||
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
}
|
||||
public ConduitBundleRenderer() {}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
|
||||
RenderBlocks rb) {
|
||||
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
int pass = RenderPassHelper.getBlockRenderPass();
|
||||
if (pass == 1) {
|
||||
// If the MC renderer is told that an alpha pass is required ( see
|
||||
@@ -113,10 +68,10 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
// around is to ensure we always render something in this pass. Throwing
|
||||
// in a polygon with a 0 area does the job
|
||||
// See: https://github.com/MinecraftForge/MinecraftForge/issues/981
|
||||
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
|
||||
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
|
||||
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
|
||||
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
|
||||
tessellator.addVertexWithUV(x, y, z, 0, 0);
|
||||
tessellator.addVertexWithUV(x, y, z, 0, 0);
|
||||
tessellator.addVertexWithUV(x, y, z, 0, 0);
|
||||
tessellator.addVertexWithUV(x, y, z, 0, 0);
|
||||
}
|
||||
|
||||
IConduitBundle bundle = (IConduitBundle) world.getTileEntity(x, y, z);
|
||||
@@ -125,7 +80,7 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
boolean renderedFacade = renderFacade(x, y, z, pass, rb, bundle, player);
|
||||
boolean renderConduit = !renderedFacade || ConduitUtil.isFacadeHidden(bundle, player);
|
||||
|
||||
if (renderConduit && (pass == 0 || rb.overrideBlockTexture != null)) {
|
||||
if (bundle != null && renderConduit && (pass == 0 || rb.overrideBlockTexture != null)) {
|
||||
BlockCoord loc = bundle.getLocation();
|
||||
float brightness;
|
||||
if (!Config.updateLightingWhenHidingFacades && bundle.hasFacade()
|
||||
@@ -138,21 +93,34 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
return true;
|
||||
}
|
||||
|
||||
return renderedFacade || (bundle.hasFacade() && !bundle.getFacadeId().isOpaqueCube());
|
||||
return renderedFacade || (bundle != null && bundle.hasFacade() && !bundle.getFacadeId().isOpaqueCube());
|
||||
}
|
||||
|
||||
private static final ThreadLocal<BlockConduitFacade> facade = ThreadLocal.withInitial(() -> {
|
||||
try {
|
||||
return EnderIO.blockConduitFacade.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
private boolean renderFacade(int x, int y, int z, int pass, RenderBlocks rb, IConduitBundle bundle,
|
||||
EntityClientPlayerMP player) {
|
||||
boolean res = false;
|
||||
if (bundle == null) {
|
||||
return false;
|
||||
}
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
if (bundle.hasFacade()) {
|
||||
res = true;
|
||||
Block facadeId = bundle.getFacadeId();
|
||||
if (ConduitUtil.isFacadeHidden(bundle, player)) {
|
||||
Tessellator.instance.setColorOpaque_F(1, 1, 1);
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
bundle.setFacadeId(null, false);
|
||||
bundle.setFacadeRenderAs(FacadeRenderState.WIRE_FRAME);
|
||||
|
||||
BlockConduitFacade facb = EnderIO.blockConduitFacade;
|
||||
BlockConduitFacade facb = facade.get();
|
||||
facb.setBlockOverride(bundle);
|
||||
facb.setBlockBounds(0, 0, 0, 1, 1, 1);
|
||||
if (!rb.hasOverrideBlockTexture()) {
|
||||
@@ -192,20 +160,23 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
public void renderConduits(IConduitBundle bundle, double x, double y, double z, float partialTick, float brightness,
|
||||
RenderBlocks rb) {
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
if (bundle == null) return;
|
||||
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
final CubeRenderer cr = CubeRenderer.get();
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
tessellator.addTranslation((float) x, (float) y, (float) z);
|
||||
|
||||
// Conduits
|
||||
Set<ForgeDirection> externals = new HashSet<ForgeDirection>();
|
||||
Set<ForgeDirection> externals = new HashSet<>();
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
List<BoundingBox> wireBounds = new ArrayList<BoundingBox>();
|
||||
List<BoundingBox> wireBounds = new ArrayList<>();
|
||||
|
||||
for (IConduit con : bundle.getConduits()) {
|
||||
|
||||
if (ConduitUtil.renderConduit(player, con)) {
|
||||
ConduitRenderer renderer = EnderIO.proxy.getRendererForConduit(con);
|
||||
final ConduitRenderer renderer = con.getRenderer();
|
||||
renderer.renderEntity(this, bundle, con, x, y, z, partialTick, brightness, rb);
|
||||
Set<ForgeDirection> extCons = con.getExternalConnections();
|
||||
for (ForgeDirection dir : extCons) {
|
||||
@@ -225,7 +196,8 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
// Internal conectors between conduits
|
||||
List<CollidableComponent> connectors = bundle.getConnectors();
|
||||
List<CollidableComponent> rendered = Lists.newArrayList();
|
||||
for (CollidableComponent component : connectors) {
|
||||
for (int i = 0; i < connectors.size(); i++) {
|
||||
final CollidableComponent component = connectors.get(i);
|
||||
if (component.conduitType != null) {
|
||||
IConduit conduit = bundle.getConduit(component.conduitType);
|
||||
if (conduit != null) {
|
||||
@@ -243,12 +215,12 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
if (r.component.conduitType == component.conduitType
|
||||
&& !rendered.contains(r.component)) {
|
||||
rendered.add(r.component);
|
||||
CubeRenderer.render(component.bound, rb.overrideBlockTexture, true);
|
||||
cr.render(component.bound, rb.overrideBlockTexture, true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tessellator.setBrightness((int) (brightness));
|
||||
CubeRenderer.render(component.bound, conduit.getTextureForState(component), true);
|
||||
cr.render(component.bound, conduit.getTextureForState(component), true);
|
||||
}
|
||||
} else {
|
||||
wireBounds.add(component.bound);
|
||||
@@ -257,16 +229,18 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
|
||||
} else if (ConduitUtil.getDisplayMode(player) == ConduitDisplayMode.ALL && !rb.hasOverrideBlockTexture()) {
|
||||
IIcon tex = EnderIO.blockConduitBundle.getConnectorIcon(component.data);
|
||||
CubeRenderer.render(component.bound, tex);
|
||||
cr.render(component.bound, tex);
|
||||
}
|
||||
}
|
||||
// render these after the 'normal' conduits so help with proper blending
|
||||
for (BoundingBox wireBound : wireBounds) {
|
||||
Tessellator.instance.setColorRGBA_F(1, 1, 1, 0.25f);
|
||||
CubeRenderer.render(wireBound, EnderIO.blockConduitFacade.getIcon(0, 0));
|
||||
BlockConduitFacade facb = facade.get();
|
||||
for (int i = 0; i < wireBounds.size(); i++) {
|
||||
final BoundingBox wireBound = wireBounds.get(i);
|
||||
tessellator.setColorRGBA_F(1, 1, 1, 0.25f);
|
||||
cr.render(wireBound, facb.getIcon(0, 0));
|
||||
}
|
||||
|
||||
Tessellator.instance.setColorRGBA_F(1, 1, 1, 1f);
|
||||
tessellator.setColorRGBA_F(1, 1, 1, 1f);
|
||||
// External connection terminations
|
||||
if (rb.overrideBlockTexture == null) {
|
||||
for (ForgeDirection dir : externals) {
|
||||
@@ -279,8 +253,10 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
private void renderExternalConnection(ForgeDirection dir) {
|
||||
IIcon tex = EnderIO.blockConduitBundle.getConnectorIcon(ConduitConnectorType.EXTERNAL);
|
||||
BoundingBox[] bbs = ConduitGeometryUtil.instance.getExternalConnectorBoundingBoxes(dir);
|
||||
for (BoundingBox bb : bbs) {
|
||||
CubeRenderer.render(bb, tex, true);
|
||||
final CubeRenderer cr = CubeRenderer.get();
|
||||
for (int i = 0; i < bbs.length; i++) {
|
||||
final BoundingBox bb = bbs[i];
|
||||
cr.render(bb, tex, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,13 +7,7 @@ import crazypants.enderio.conduit.IConduitBundle;
|
||||
|
||||
public interface ConduitRenderer {
|
||||
|
||||
boolean isRendererForConduit(IConduit conduit);
|
||||
|
||||
void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit con, double x, double y,
|
||||
double z, float partialTick, float worldLight, RenderBlocks rb);
|
||||
|
||||
boolean isDynamic();
|
||||
|
||||
void renderDynamicEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit con, double x,
|
||||
double y, double z, float partialTick, float worldLight);
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
package crazypants.enderio.conduit.render;
|
||||
|
||||
import static com.enderio.core.client.render.CubeRenderer.addVecWithUV;
|
||||
import static com.enderio.core.client.render.CubeRenderer.setupVertices;
|
||||
import static com.enderio.core.client.render.CubeRenderer.verts;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.DOWN;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.EAST;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.NORTH;
|
||||
@@ -19,6 +16,7 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
import com.enderio.core.client.render.CubeRenderer;
|
||||
import com.enderio.core.client.render.RenderUtil;
|
||||
import com.enderio.core.common.vecmath.Vertex;
|
||||
|
||||
@@ -30,12 +28,9 @@ import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
|
||||
public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
|
||||
protected float transmissionScaleFactor;
|
||||
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(DefaultConduitRenderer::new);
|
||||
|
||||
@Override
|
||||
public boolean isRendererForConduit(IConduit conduit) {
|
||||
return true;
|
||||
}
|
||||
protected float transmissionScaleFactor;
|
||||
|
||||
@Override
|
||||
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x,
|
||||
@@ -68,11 +63,8 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderDynamicEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit con,
|
||||
double x, double y, double z, float partialTick, float worldLight) {}
|
||||
|
||||
protected void renderConduit(IIcon tex, IConduit conduit, CollidableComponent component, float brightness) {
|
||||
final CubeRenderer cr = CubeRenderer.get();
|
||||
|
||||
if (isNSEWUD(component.dir)) {
|
||||
|
||||
@@ -103,7 +95,7 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
tex.getMaxV());
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
for (Vertex c : corners) {
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,12 +142,13 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
protected void drawSection(BoundingBox bound, float minU, float maxU, float minV, float maxV, ForgeDirection dir,
|
||||
boolean isTransmission, boolean mirrorTexture) {
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
final CubeRenderer cr = CubeRenderer.get();
|
||||
|
||||
if (isTransmission) {
|
||||
setVerticesForTransmission(bound, dir);
|
||||
} else {
|
||||
setupVertices(bound);
|
||||
cr.setupVertices(bound);
|
||||
}
|
||||
|
||||
if (mirrorTexture && (dir == NORTH || dir == UP || dir == EAST)) {
|
||||
@@ -175,15 +168,15 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
tessellator.setColorOpaque_F(cm, cm, cm);
|
||||
}
|
||||
if (rotateSides) {
|
||||
addVecWithUV(verts[1], maxU, maxV);
|
||||
addVecWithUV(verts[0], maxU, minV);
|
||||
addVecWithUV(verts[3], minU, minV);
|
||||
addVecWithUV(verts[2], minU, maxV);
|
||||
cr.addVecWithUV(cr.verts[1], maxU, maxV);
|
||||
cr.addVecWithUV(cr.verts[0], maxU, minV);
|
||||
cr.addVecWithUV(cr.verts[3], minU, minV);
|
||||
cr.addVecWithUV(cr.verts[2], minU, maxV);
|
||||
} else {
|
||||
addVecWithUV(verts[1], minU, minV);
|
||||
addVecWithUV(verts[0], maxU, minV);
|
||||
addVecWithUV(verts[3], maxU, maxV);
|
||||
addVecWithUV(verts[2], minU, maxV);
|
||||
cr.addVecWithUV(cr.verts[1], minU, minV);
|
||||
cr.addVecWithUV(cr.verts[0], maxU, minV);
|
||||
cr.addVecWithUV(cr.verts[3], maxU, maxV);
|
||||
cr.addVecWithUV(cr.verts[2], minU, maxV);
|
||||
}
|
||||
if (dir == WEST || dir == EAST) {
|
||||
float tmp = minU;
|
||||
@@ -196,15 +189,15 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
tessellator.setColorOpaque_F(cm, cm, cm);
|
||||
}
|
||||
if (rotateSides) {
|
||||
addVecWithUV(verts[4], maxU, maxV);
|
||||
addVecWithUV(verts[5], maxU, minV);
|
||||
addVecWithUV(verts[6], minU, minV);
|
||||
addVecWithUV(verts[7], minU, maxV);
|
||||
cr.addVecWithUV(cr.verts[4], maxU, maxV);
|
||||
cr.addVecWithUV(cr.verts[5], maxU, minV);
|
||||
cr.addVecWithUV(cr.verts[6], minU, minV);
|
||||
cr.addVecWithUV(cr.verts[7], minU, maxV);
|
||||
} else {
|
||||
addVecWithUV(verts[4], minU, minV);
|
||||
addVecWithUV(verts[5], maxU, minV);
|
||||
addVecWithUV(verts[6], maxU, maxV);
|
||||
addVecWithUV(verts[7], minU, maxV);
|
||||
cr.addVecWithUV(cr.verts[4], minU, minV);
|
||||
cr.addVecWithUV(cr.verts[5], maxU, minV);
|
||||
cr.addVecWithUV(cr.verts[6], maxU, maxV);
|
||||
cr.addVecWithUV(cr.verts[7], minU, maxV);
|
||||
}
|
||||
if (dir == WEST || dir == EAST) {
|
||||
float tmp = minU;
|
||||
@@ -221,15 +214,15 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
tessellator.setColorOpaque_F(cm, cm, cm);
|
||||
}
|
||||
if (rotateTopBottom) {
|
||||
addVecWithUV(verts[6], maxU, maxV);
|
||||
addVecWithUV(verts[2], minU, maxV);
|
||||
addVecWithUV(verts[3], minU, minV);
|
||||
addVecWithUV(verts[7], maxU, minV);
|
||||
cr.addVecWithUV(cr.verts[6], maxU, maxV);
|
||||
cr.addVecWithUV(cr.verts[2], minU, maxV);
|
||||
cr.addVecWithUV(cr.verts[3], minU, minV);
|
||||
cr.addVecWithUV(cr.verts[7], maxU, minV);
|
||||
} else {
|
||||
addVecWithUV(verts[6], minU, minV);
|
||||
addVecWithUV(verts[2], minU, maxV);
|
||||
addVecWithUV(verts[3], maxU, maxV);
|
||||
addVecWithUV(verts[7], maxU, minV);
|
||||
cr.addVecWithUV(cr.verts[6], minU, minV);
|
||||
cr.addVecWithUV(cr.verts[2], minU, maxV);
|
||||
cr.addVecWithUV(cr.verts[3], maxU, maxV);
|
||||
cr.addVecWithUV(cr.verts[7], maxU, minV);
|
||||
}
|
||||
|
||||
tessellator.setNormal(0, -1, 0);
|
||||
@@ -238,15 +231,15 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
tessellator.setColorOpaque_F(cm, cm, cm);
|
||||
}
|
||||
if (rotateTopBottom) {
|
||||
addVecWithUV(verts[0], minU, minV);
|
||||
addVecWithUV(verts[1], minU, maxV);
|
||||
addVecWithUV(verts[5], maxU, maxV);
|
||||
addVecWithUV(verts[4], maxU, minV);
|
||||
cr.addVecWithUV(cr.verts[0], minU, minV);
|
||||
cr.addVecWithUV(cr.verts[1], minU, maxV);
|
||||
cr.addVecWithUV(cr.verts[5], maxU, maxV);
|
||||
cr.addVecWithUV(cr.verts[4], maxU, minV);
|
||||
} else {
|
||||
addVecWithUV(verts[0], maxU, maxV);
|
||||
addVecWithUV(verts[1], minU, maxV);
|
||||
addVecWithUV(verts[5], minU, minV);
|
||||
addVecWithUV(verts[4], maxU, minV);
|
||||
cr.addVecWithUV(cr.verts[0], maxU, maxV);
|
||||
cr.addVecWithUV(cr.verts[1], minU, maxV);
|
||||
cr.addVecWithUV(cr.verts[5], minU, minV);
|
||||
cr.addVecWithUV(cr.verts[4], maxU, minV);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,15 +251,15 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
tessellator.setColorOpaque_F(cm, cm, cm);
|
||||
}
|
||||
if (rotateSides) {
|
||||
addVecWithUV(verts[2], minU, maxV);
|
||||
addVecWithUV(verts[6], minU, minV);
|
||||
addVecWithUV(verts[5], maxU, minV);
|
||||
addVecWithUV(verts[1], maxU, maxV);
|
||||
cr.addVecWithUV(cr.verts[2], minU, maxV);
|
||||
cr.addVecWithUV(cr.verts[6], minU, minV);
|
||||
cr.addVecWithUV(cr.verts[5], maxU, minV);
|
||||
cr.addVecWithUV(cr.verts[1], maxU, maxV);
|
||||
} else {
|
||||
addVecWithUV(verts[2], minU, maxV);
|
||||
addVecWithUV(verts[6], maxU, maxV);
|
||||
addVecWithUV(verts[5], maxU, minV);
|
||||
addVecWithUV(verts[1], minU, minV);
|
||||
cr.addVecWithUV(cr.verts[2], minU, maxV);
|
||||
cr.addVecWithUV(cr.verts[6], maxU, maxV);
|
||||
cr.addVecWithUV(cr.verts[5], maxU, minV);
|
||||
cr.addVecWithUV(cr.verts[1], minU, minV);
|
||||
}
|
||||
|
||||
tessellator.setNormal(-1, 0, 0);
|
||||
@@ -275,15 +268,15 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
tessellator.setColorOpaque_F(cm, cm, cm);
|
||||
}
|
||||
if (rotateSides) {
|
||||
addVecWithUV(verts[0], maxU, maxV);
|
||||
addVecWithUV(verts[4], maxU, minV);
|
||||
addVecWithUV(verts[7], minU, minV);
|
||||
addVecWithUV(verts[3], minU, maxV);
|
||||
cr.addVecWithUV(cr.verts[0], maxU, maxV);
|
||||
cr.addVecWithUV(cr.verts[4], maxU, minV);
|
||||
cr.addVecWithUV(cr.verts[7], minU, minV);
|
||||
cr.addVecWithUV(cr.verts[3], minU, maxV);
|
||||
} else {
|
||||
addVecWithUV(verts[0], minU, minV);
|
||||
addVecWithUV(verts[4], maxU, minV);
|
||||
addVecWithUV(verts[7], maxU, maxV);
|
||||
addVecWithUV(verts[3], minU, maxV);
|
||||
cr.addVecWithUV(cr.verts[0], minU, minV);
|
||||
cr.addVecWithUV(cr.verts[4], maxU, minV);
|
||||
cr.addVecWithUV(cr.verts[7], maxU, maxV);
|
||||
cr.addVecWithUV(cr.verts[3], minU, maxV);
|
||||
}
|
||||
}
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
@@ -293,7 +286,7 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
float xs = dir.offsetX == 0 ? transmissionScaleFactor : 1;
|
||||
float ys = dir.offsetY == 0 ? transmissionScaleFactor : 1;
|
||||
float zs = dir.offsetZ == 0 ? transmissionScaleFactor : 1;
|
||||
setupVertices(bound.scale(xs, ys, zs));
|
||||
CubeRenderer.get().setupVertices(bound.scale(xs, ys, zs));
|
||||
}
|
||||
|
||||
// TODO: This is a really hacky, imprecise and slow way to do this
|
||||
@@ -352,8 +345,4 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
return new BoundingBox[] { bb };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDynamic() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -62,8 +62,9 @@ public class ItemConduitRenderer implements IItemRenderer {
|
||||
}
|
||||
|
||||
private void renderToInventory(ItemStack item, RenderBlocks renderBlocks) {
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
CubeRenderer.render(bb, item.getItem().getIconFromDamage(item.getItemDamage()));
|
||||
Tessellator.instance.draw();
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
CubeRenderer.get().render(bb, item.getItem().getIconFromDamage(item.getItemDamage()));
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
@@ -175,6 +175,34 @@ public final class Config {
|
||||
*/
|
||||
public static int teleportStaffFailedBlinkDistance = 64;
|
||||
|
||||
/**
|
||||
* Sets the teleport staff right-click action.
|
||||
*
|
||||
* <p>
|
||||
* Values:
|
||||
* <ul>
|
||||
* <li><b>0:</b> Do nothing
|
||||
* <li><b>1:</b> Teleport to look
|
||||
* <li><b>2:</b> Teleport to anchor
|
||||
* <li><b>3:</b> Teleport to anchor, or to look if no anchor <em>(default)</em>
|
||||
* </ul>
|
||||
*/
|
||||
public static int teleportStaffAction = 3;
|
||||
|
||||
/**
|
||||
* Sets the teleport staff sneak right-click action.
|
||||
*
|
||||
* <p>
|
||||
* Values:
|
||||
* <ul>
|
||||
* <li><b>0:</b> Do nothing
|
||||
* <li><b>1:</b> Teleport to look <em>(default)</em>
|
||||
* <li><b>2:</b> Teleport to anchor
|
||||
* <li><b>3:</b> Teleport to anchor, or to look if no anchor
|
||||
* </ul>
|
||||
*/
|
||||
public static int teleportStaffSneakAction = 1;
|
||||
|
||||
public static int enderIoRange = 8;
|
||||
public static boolean enderIoMeAccessEnabled = true;
|
||||
|
||||
@@ -361,6 +389,8 @@ public final class Config {
|
||||
"TwilightForest:item.steeleafHoe", "TwilightForest:item.ironwoodHoe", "IC2:itemToolBronzeHoe" };
|
||||
public static List<ItemStack> farmHoes = new ArrayList<ItemStack>();
|
||||
public static int farmSaplingReserveAmount = 8;
|
||||
public static double farmParticlesMaxRange = 64;
|
||||
public static int farmParticlesCount = 15;
|
||||
|
||||
public static int magnetPowerUsePerSecondRF = 1;
|
||||
public static int magnetPowerCapacityRF = 100000;
|
||||
@@ -445,7 +475,6 @@ public final class Config {
|
||||
|
||||
public static boolean isGasConduitEnabled = true;
|
||||
public static boolean enableMEConduits = true;
|
||||
public static boolean enableMEUltraDenseConduits = false;
|
||||
public static boolean enableOCConduits = true;
|
||||
public static boolean enableOCConduitsAnimatedTexture = true;
|
||||
|
||||
@@ -1269,6 +1298,27 @@ public final class Config {
|
||||
"Number of blocks teleported when no block is being looked at.")
|
||||
.getInt(teleportStaffFailedBlinkDistance);
|
||||
|
||||
teleportStaffAction = config.get(
|
||||
sectionStaff.name,
|
||||
"teleportStaffAction",
|
||||
teleportStaffAction,
|
||||
"Sets the action for right-click with the staff of teleportation. Values:\n" + " 0: Do nothing\n"
|
||||
+ " 1: Teleport to look\n"
|
||||
+ " 2: Teleport to anchor\n"
|
||||
+ " 3: Teleport to anchor, or look if no anchor (default)")
|
||||
.getInt(teleportStaffAction);
|
||||
|
||||
teleportStaffSneakAction = config.get(
|
||||
sectionStaff.name,
|
||||
"teleportStaffSneakAction",
|
||||
teleportStaffSneakAction,
|
||||
"Sets the action for sneak right-click with the staff of teleportation. Values:\n"
|
||||
+ " 0: Do nothing\n"
|
||||
+ " 1: Teleport to look (default)\n"
|
||||
+ " 2: Teleport to anchor\n"
|
||||
+ " 3: Teleport to anchor, or look if no anchor")
|
||||
.getInt(teleportStaffSneakAction);
|
||||
|
||||
enderIoRange = config.get(
|
||||
sectionEfficiency.name,
|
||||
"enderIoRange",
|
||||
@@ -2060,6 +2110,18 @@ public final class Config {
|
||||
+ "always shear all leaves.")
|
||||
.getInt(farmSaplingReserveAmount);
|
||||
|
||||
farmParticlesMaxRange = config.get(
|
||||
sectionFarm.name,
|
||||
"farmParticlesMaxRange",
|
||||
farmParticlesMaxRange,
|
||||
"The max range of the farm action particles.").getDouble(farmParticlesMaxRange);
|
||||
|
||||
farmParticlesCount = config.get(
|
||||
sectionFarm.name,
|
||||
"farmParticlesCount",
|
||||
farmParticlesCount,
|
||||
"The number of particles produces by farm action.").getInt(farmParticlesCount);
|
||||
|
||||
combustionGeneratorUseOpaqueModel = config
|
||||
.get(
|
||||
sectionAesthetic.name,
|
||||
@@ -2352,11 +2414,6 @@ public final class Config {
|
||||
sectionItems.name,
|
||||
enableMEConduits,
|
||||
"Allows ME conduits. Only has an effect with AE2 installed.");
|
||||
enableMEUltraDenseConduits = config.getBoolean(
|
||||
"enableMEUltraDenseConduits",
|
||||
sectionItems.name,
|
||||
enableMEUltraDenseConduits,
|
||||
"Allows ME Ultra Dense conduits. Only has an effect with AE2 installed.");
|
||||
enableOCConduits = config.getBoolean(
|
||||
"enableOCConduits",
|
||||
sectionItems.name,
|
||||
|
||||
@@ -55,7 +55,7 @@ public class EnderIoRenderer extends TileEntitySpecialRenderer implements IItemR
|
||||
}
|
||||
|
||||
public void render(double x, double y, double z, Matrix4d lookMat, int brightness) {
|
||||
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
|
||||
|
||||
@@ -111,8 +111,8 @@ public class EnderIoRenderer extends TileEntitySpecialRenderer implements IItemR
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
RenderUtil.bindBlockTexture();
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
Tessellator.instance.setBrightness(brightness);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setBrightness(brightness);
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
@@ -120,8 +120,8 @@ public class EnderIoRenderer extends TileEntitySpecialRenderer implements IItemR
|
||||
GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||
GL11.glPolygonOffset(-1.0f, -1.0f);
|
||||
|
||||
CubeRenderer.render(BoundingBox.UNIT_CUBE, EnderIO.blockEnderIo.frameIcon);
|
||||
Tessellator.instance.draw();
|
||||
CubeRenderer.get().render(BoundingBox.UNIT_CUBE, EnderIO.blockEnderIo.frameIcon);
|
||||
tessellator.draw();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||
|
||||
@@ -154,7 +154,8 @@ public class KeyTracker {
|
||||
if (player != null) {
|
||||
ItemStack travelItem = player.getHeldItem();
|
||||
if (travelItem == null || travelItem.getItem() == null
|
||||
|| !(travelItem.getItem() instanceof IItemOfTravel)) {
|
||||
|| !(travelItem.getItem() instanceof IItemOfTravel)
|
||||
|| !((IItemOfTravel) travelItem.getItem()).isActive(player, travelItem)) {
|
||||
travelItem = TravelController.instance.findTravelItemInInventoryOrBaubles(player);
|
||||
}
|
||||
|
||||
|
||||
@@ -386,7 +386,15 @@ public class ItemDarkSteelSword extends ItemSword
|
||||
|
||||
@Override
|
||||
public boolean isActive(EntityPlayer ep, ItemStack equipped) {
|
||||
return isTravelUpgradeActive(ep, equipped);
|
||||
if (ep != null && equipped != null && isTravelUpgradeActive(ep, equipped)) {
|
||||
// Only "active" if held while sneaking. But still "active" for the purposes of travel keybind if not held
|
||||
if (isEquipped(ep)) {
|
||||
return ep.isSneaking();
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -400,12 +408,12 @@ public class ItemDarkSteelSword extends ItemSword
|
||||
}
|
||||
|
||||
private boolean isTravelUpgradeActive(EntityPlayer ep, ItemStack equipped) {
|
||||
return isEquipped(ep) && ep.isSneaking() && TravelUpgrade.loadFromItem(equipped) != null;
|
||||
return ep != null && equipped != null && TravelUpgrade.loadFromItem(equipped) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (isTravelUpgradeActive(player, stack)) {
|
||||
if (isActive(player, stack)) {
|
||||
if (world.isRemote) {
|
||||
if (TravelController.instance.activateTravelAccessable(stack, world, player, TravelSource.STAFF)) {
|
||||
player.swingItem();
|
||||
|
||||
@@ -17,10 +17,12 @@ import com.enderio.core.client.render.CubeRenderer;
|
||||
import com.enderio.core.client.render.RenderUtil;
|
||||
import com.enderio.core.client.render.VertexRotation;
|
||||
import com.enderio.core.common.vecmath.Vector3d;
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import crazypants.enderio.EnderIO;
|
||||
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
public class EndermanSkullRenderer implements ISimpleBlockRenderingHandler, IItemRenderer {
|
||||
|
||||
public EndermanSkullRenderer() {}
|
||||
@@ -75,9 +77,9 @@ public class EndermanSkullRenderer implements ISimpleBlockRenderingHandler, IIte
|
||||
float height = 0.5f;
|
||||
BoundingBox bb = new BoundingBox(size, 0, size, 1 - size, height, 1 - size);
|
||||
if (renderer.hasOverrideBlockTexture()) {
|
||||
CubeRenderer.render(bb, renderer.overrideBlockTexture, rot);
|
||||
CubeRenderer.get().render(bb, renderer.overrideBlockTexture, rot);
|
||||
} else {
|
||||
CubeRenderer.render(bb, icons, rot, true);
|
||||
CubeRenderer.get().render(bb, icons, rot, true);
|
||||
|
||||
if (meta > 1) {
|
||||
renderBolts(rot, size);
|
||||
@@ -94,27 +96,28 @@ public class EndermanSkullRenderer implements ISimpleBlockRenderingHandler, IIte
|
||||
float boltSize = size / 3;
|
||||
BoundingBox baseBolt = BoundingBox.UNIT_CUBE.scale(boltSize, boltSize, boltSize);
|
||||
IIcon icon = EnderIO.blockSoulFuser.getIcon(ForgeDirection.EAST.ordinal(), 0);
|
||||
final CubeRenderer cr = CubeRenderer.get();
|
||||
|
||||
float offset = 0.15f;
|
||||
bb = baseBolt.translate(size + boltSize / 2, -0.15f, offset);
|
||||
CubeRenderer.render(bb, icon, rot, true);
|
||||
cr.render(bb, icon, rot, true);
|
||||
bb = baseBolt.translate(size + boltSize / 2, -0.15f, -offset);
|
||||
CubeRenderer.render(bb, icon, rot, true);
|
||||
cr.render(bb, icon, rot, true);
|
||||
|
||||
bb = baseBolt.translate(-(size + boltSize / 2), -0.15f, offset);
|
||||
CubeRenderer.render(bb, icon, rot, true);
|
||||
cr.render(bb, icon, rot, true);
|
||||
bb = baseBolt.translate(-(size + boltSize / 2), -0.15f, -offset);
|
||||
CubeRenderer.render(bb, icon, rot, true);
|
||||
cr.render(bb, icon, rot, true);
|
||||
|
||||
bb = baseBolt.translate(-offset, -0.15f, -(size + boltSize / 2));
|
||||
CubeRenderer.render(bb, icon, rot, true);
|
||||
cr.render(bb, icon, rot, true);
|
||||
bb = baseBolt.translate(offset, -0.15f, -(size + boltSize / 2));
|
||||
CubeRenderer.render(bb, icon, rot, true);
|
||||
cr.render(bb, icon, rot, true);
|
||||
|
||||
bb = baseBolt.translate(offset, -0.15f, (size + boltSize / 2));
|
||||
CubeRenderer.render(bb, icon, rot, true);
|
||||
cr.render(bb, icon, rot, true);
|
||||
bb = baseBolt.translate(-offset, -0.15f, (size + boltSize / 2));
|
||||
CubeRenderer.render(bb, icon, rot, true);
|
||||
cr.render(bb, icon, rot, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -168,7 +168,8 @@ public abstract class AbstractMachineEntity extends TileEntityEio
|
||||
public final boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
if (slotDefinition.isUpgradeSlot(i)) {
|
||||
return itemstack != null && itemstack.getItem() == EnderIO.itemBasicCapacitor
|
||||
&& itemstack.getItemDamage() > 0;
|
||||
&& itemstack.getItemDamage() > 0
|
||||
&& itemstack.getItemDamage() != 7;
|
||||
}
|
||||
return isMachineItemValidForSlot(i, itemstack);
|
||||
}
|
||||
|
||||
@@ -19,12 +19,14 @@ import com.enderio.core.client.render.CustomRenderBlocks;
|
||||
import com.enderio.core.client.render.IconUtil;
|
||||
import com.enderio.core.client.render.RenderUtil;
|
||||
import com.enderio.core.common.vecmath.Vertex;
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import crazypants.enderio.machine.painter.IPaintableTileEntity;
|
||||
import crazypants.enderio.machine.painter.PaintedBlockRenderer;
|
||||
import crazypants.enderio.machine.painter.PainterUtil;
|
||||
|
||||
@ThreadSafeISBRH(perThread = true)
|
||||
public class AbstractMachineRenderer implements ISimpleBlockRenderingHandler, IItemRenderer {
|
||||
|
||||
private OverlayRenderer overlayRenderer = new OverlayRenderer() {
|
||||
@@ -40,7 +42,7 @@ public class AbstractMachineRenderer implements ISimpleBlockRenderingHandler, II
|
||||
|
||||
private CustomCubeRenderer ccr = new CustomCubeRenderer();
|
||||
|
||||
private PaintedBlockRenderer paintedRenderer = new PaintedBlockRenderer(this.getRenderId(), null); // passthrough
|
||||
private final PaintedBlockRenderer paintedRenderer = new PaintedBlockRenderer(this.getRenderId(), null);
|
||||
// renderer for
|
||||
// paintable
|
||||
// machines
|
||||
@@ -75,8 +77,9 @@ public class AbstractMachineRenderer implements ISimpleBlockRenderingHandler, II
|
||||
|
||||
BoundingBox bb = BoundingBox.UNIT_CUBE;
|
||||
bb = bb.translate(0, -0.1f, 0);
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
tessellator.startDrawingQuads();
|
||||
|
||||
IIcon[] textures = RenderUtil.getBlockTextures(block, metadata);
|
||||
|
||||
@@ -84,8 +87,8 @@ public class AbstractMachineRenderer implements ISimpleBlockRenderingHandler, II
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
brightnessPerSide[dir.ordinal()] = Math.max(RenderUtil.getColorMultiplierForFace(dir) + 0.1f, 1f);
|
||||
}
|
||||
CubeRenderer.render(bb, textures, null, brightnessPerSide);
|
||||
Tessellator.instance.draw();
|
||||
CubeRenderer.get().render(bb, textures, null, brightnessPerSide);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.enderio.core.common.vecmath.Vertex;
|
||||
|
||||
public class OverlayRenderer implements IRenderFace {
|
||||
|
||||
private static final CustomCubeRenderer ccr = CustomCubeRenderer.instance;
|
||||
private AbstractMachineEntity te;
|
||||
|
||||
public void setTile(AbstractMachineEntity te) {
|
||||
@@ -30,6 +29,7 @@ public class OverlayRenderer implements IRenderFace {
|
||||
@Override
|
||||
public void renderFace(CustomRenderBlocks rb, ForgeDirection face, Block par1Block, double x, double y, double z,
|
||||
IIcon texture, List<Vertex> refVertices, boolean translateToXyz) {
|
||||
CustomCubeRenderer ccr = CustomCubeRenderer.get();
|
||||
|
||||
if (te != null && par1Block instanceof AbstractMachineBlock) {
|
||||
BlockCoord bc = new BlockCoord(x, y, z);
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.enderio.core.client.render.ConnectedTextureRenderer;
|
||||
import com.enderio.core.client.render.CubeRenderer;
|
||||
import com.enderio.core.client.render.CustomCubeRenderer;
|
||||
import com.enderio.core.client.render.RenderUtil;
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -36,6 +37,7 @@ import crazypants.enderio.machine.capbank.render.FillGauge.GaugeKey;
|
||||
import crazypants.enderio.power.PowerHandlerUtil;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@ThreadSafeISBRH(perThread = true)
|
||||
public class CapBankRenderer extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler, IItemRenderer {
|
||||
|
||||
private ConnectedTextureRenderer connectedTexRenderer;
|
||||
@@ -47,7 +49,7 @@ public class CapBankRenderer extends TileEntitySpecialRenderer implements ISimpl
|
||||
connectedTexRenderer = new ConnectedTextureRenderer();
|
||||
connectedTexRenderer.setMatchMeta(true);
|
||||
fillGaugeRenderer = new FillGauge();
|
||||
infoRenderers = new HashMap<InfoDisplayType, IInfoRenderer>();
|
||||
infoRenderers = new HashMap<>();
|
||||
infoRenderers.put(InfoDisplayType.LEVEL_BAR, fillGaugeRenderer);
|
||||
infoRenderers.put(InfoDisplayType.IO, new IoDisplay());
|
||||
}
|
||||
@@ -60,6 +62,7 @@ public class CapBankRenderer extends TileEntitySpecialRenderer implements ISimpl
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
|
||||
RenderBlocks renderer) {
|
||||
CustomCubeRenderer ccr = CustomCubeRenderer.get();
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
meta = MathHelper.clamp_int(meta, 0, CapBankType.types().size() - 1);
|
||||
@@ -70,13 +73,13 @@ public class CapBankRenderer extends TileEntitySpecialRenderer implements ISimpl
|
||||
connectedTexRenderer.setForceAllEdges(false);
|
||||
}
|
||||
connectedTexRenderer.setEdgeTexture(EnderIO.blockCapBank.getBorderIcon(0, meta));
|
||||
CustomCubeRenderer.instance.setOverrideTexture(renderer.overrideBlockTexture);
|
||||
ccr.setOverrideTexture(renderer.overrideBlockTexture);
|
||||
if (renderer.overrideBlockTexture == null) {
|
||||
CustomCubeRenderer.instance.renderBlock(world, block, x, y, z, connectedTexRenderer);
|
||||
ccr.renderBlock(world, block, x, y, z, connectedTexRenderer);
|
||||
} else {
|
||||
CustomCubeRenderer.instance.renderBlock(world, block, x, y, z);
|
||||
ccr.renderBlock(world, block, x, y, z);
|
||||
}
|
||||
CustomCubeRenderer.instance.setOverrideTexture(null);
|
||||
ccr.setOverrideTexture(null);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -108,7 +111,7 @@ public class CapBankRenderer extends TileEntitySpecialRenderer implements ISimpl
|
||||
Tessellator tes = Tessellator.instance;
|
||||
|
||||
tes.startDrawingQuads();
|
||||
CubeRenderer.render(EnderIO.blockCapBank, item.getItemDamage());
|
||||
CubeRenderer.get().render(EnderIO.blockCapBank, item.getItemDamage());
|
||||
tes.draw();
|
||||
|
||||
GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||
@@ -126,7 +129,7 @@ public class CapBankRenderer extends TileEntitySpecialRenderer implements ISimpl
|
||||
nw.setMaxEnergyStoredL(CapBankType.getTypeFromMeta(item.getItemDamage()).getMaxEnergyStored());
|
||||
nw.setEnergyStored(PowerHandlerUtil.getStoredEnergyForItem(item));
|
||||
|
||||
GaugeInfo gi = new GaugeInfo(1, 0);
|
||||
GaugeInfo gi = GaugeInfo.DEFAULT;
|
||||
GaugeKey key = new GaugeKey(ForgeDirection.SOUTH, FillGauge.Type.SINGLE);
|
||||
fillGaugeRenderer.doRender(nw, RenderUtil.BRIGHTNESS_MAX, gi, key);
|
||||
// key = new GaugeKey(ForgeDirection.EAST, FillGauge.Type.SINGLE);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package crazypants.enderio.machine.capbank.render;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -32,6 +31,7 @@ public class FillGauge implements IInfoRenderer, IResourceManagerReloadListener
|
||||
private static final double HEIGHT = 0.75;
|
||||
private static final double VERT_BORDER = (1 - HEIGHT) / 2;
|
||||
private static final double WIDTH = 0.25;
|
||||
private final Vertex[] newVerts = new Vertex[] { new Vertex(), new Vertex(), new Vertex(), new Vertex() };
|
||||
|
||||
enum Type {
|
||||
SINGLE,
|
||||
@@ -95,8 +95,8 @@ public class FillGauge implements IInfoRenderer, IResourceManagerReloadListener
|
||||
if (ratio <= 0) {
|
||||
return;
|
||||
}
|
||||
double maxY = ratio * info.height;
|
||||
if (maxY <= info.yPosition) {
|
||||
double maxY = ratio * info.getHeight();
|
||||
if (maxY <= info.getyPosition()) {
|
||||
// empty
|
||||
return;
|
||||
}
|
||||
@@ -105,26 +105,24 @@ public class FillGauge implements IInfoRenderer, IResourceManagerReloadListener
|
||||
Tessellator.instance.addTranslation((float) offset.x, (float) offset.y, (float) offset.z);
|
||||
|
||||
List<Vertex> verts = levelVertexCache.get(key);
|
||||
if (maxY >= info.yPosition + 1) {
|
||||
if (maxY >= info.getyPosition() + 1) {
|
||||
// full bar
|
||||
RenderUtil.addVerticesToTessellator(verts, Tessellator.instance);
|
||||
|
||||
} else {
|
||||
// need to render partial bar
|
||||
double myMaxY = maxY - info.yPosition;
|
||||
double myMaxY = maxY - info.getyPosition();
|
||||
|
||||
if (info.type == Type.BOTTOM || info.type == Type.SINGLE) {
|
||||
// If we have some power and we are the bottom bit of the display,
|
||||
// always show at least a little bit in the bar
|
||||
myMaxY = Math.max(0.2, myMaxY);
|
||||
}
|
||||
List<Vertex> newVerts = new ArrayList<Vertex>();
|
||||
for (Vertex v : verts) {
|
||||
v = new Vertex(v);
|
||||
newVerts.add(v);
|
||||
if (v.y() > myMaxY) {
|
||||
v.setXYZ(v.x(), myMaxY, v.z());
|
||||
v.setUV(v.u(), barMinV + (float) (myMaxY * barHeightV));
|
||||
for (int i = 0; i < verts.size(); i++) {
|
||||
newVerts[i].set(verts.get(i));
|
||||
if (newVerts[i].y() > myMaxY) {
|
||||
newVerts[i].setXYZ(newVerts[i].x(), myMaxY, newVerts[i].z());
|
||||
newVerts[i].setUV(newVerts[i].u(), barMinV + (float) (myMaxY * barHeightV));
|
||||
}
|
||||
}
|
||||
RenderUtil.addVerticesToTessellator(newVerts, Tessellator.instance);
|
||||
@@ -136,7 +134,7 @@ public class FillGauge implements IInfoRenderer, IResourceManagerReloadListener
|
||||
private GaugeInfo getGaugeInfo(TileCapBank cb, ForgeDirection dir) {
|
||||
|
||||
if (!cb.getType().isMultiblock()) {
|
||||
return new GaugeInfo(1, 0);
|
||||
return GaugeInfo.DEFAULT;
|
||||
}
|
||||
|
||||
int height = 1;
|
||||
@@ -240,8 +238,10 @@ public class FillGauge implements IInfoRenderer, IResourceManagerReloadListener
|
||||
|
||||
static class GaugeInfo {
|
||||
|
||||
int height;
|
||||
int yPosition;
|
||||
public static final GaugeInfo DEFAULT = new GaugeInfo(1, 0);
|
||||
|
||||
private int height;
|
||||
private int yPosition;
|
||||
Type type;
|
||||
|
||||
GaugeInfo(int height, int position) {
|
||||
@@ -262,6 +262,14 @@ public class FillGauge implements IInfoRenderer, IResourceManagerReloadListener
|
||||
}
|
||||
return Type.MIDDLE;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public int getyPosition() {
|
||||
return yPosition;
|
||||
}
|
||||
}
|
||||
|
||||
static class GaugeKey {
|
||||
|
||||
@@ -21,6 +21,14 @@ import crazypants.enderio.machine.power.PowerDisplayUtil;
|
||||
|
||||
public class IoDisplay implements IInfoRenderer {
|
||||
|
||||
private float previousAverageInput;
|
||||
private float previousAverageOutput;
|
||||
|
||||
String averageInputText = "0";
|
||||
String averageOutputText = "0";
|
||||
HeadingText heading1;
|
||||
HeadingText heading2;
|
||||
|
||||
@Override
|
||||
public void render(TileCapBank cb, ForgeDirection dir, double x, double y, double z, float partialTick) {
|
||||
if (dir.offsetY != 0) {
|
||||
@@ -137,10 +145,8 @@ public class IoDisplay implements IInfoRenderer {
|
||||
|
||||
nw.requestPowerUpdate(cb, 20);
|
||||
|
||||
HeadingText heading1 = HeadingText.STABLE;
|
||||
HeadingText heading2 = null;
|
||||
String text1;
|
||||
String text2 = "";
|
||||
heading1 = HeadingText.STABLE;
|
||||
heading2 = null;
|
||||
|
||||
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
|
||||
float size = 0.15f * Math.min(info.width, info.height);
|
||||
@@ -150,8 +156,14 @@ public class IoDisplay implements IInfoRenderer {
|
||||
if (info.height * 3 >= info.width * 4) {
|
||||
heading1 = HeadingText.INPUT;
|
||||
heading2 = HeadingText.OUTPUT;
|
||||
text1 = getChangeText(nw.getAverageInputPerTick(), fr);
|
||||
text2 = getChangeText(nw.getAverageOutputPerTick(), fr);
|
||||
if (previousAverageInput != nw.getAverageInputPerTick()) {
|
||||
averageInputText = getChangeText(nw.getAverageInputPerTick(), fr);
|
||||
previousAverageInput = nw.getAverageInputPerTick();
|
||||
}
|
||||
if (previousAverageOutput != nw.getAverageOutputPerTick()) {
|
||||
averageOutputText = getChangeText(nw.getAverageOutputPerTick(), fr);
|
||||
previousAverageOutput = nw.getAverageOutputPerTick();
|
||||
}
|
||||
offset = -size * 2.5f;
|
||||
} else {
|
||||
int change = Math.round(nw.getAverageChangePerTick());
|
||||
@@ -160,7 +172,10 @@ public class IoDisplay implements IInfoRenderer {
|
||||
} else if (change < 0) {
|
||||
heading1 = HeadingText.LOSS;
|
||||
}
|
||||
text1 = getChangeText(change, fr);
|
||||
if (change != previousAverageInput) {
|
||||
averageInputText = getChangeText(change, fr);
|
||||
previousAverageInput = change;
|
||||
}
|
||||
offset = -size;
|
||||
}
|
||||
|
||||
@@ -184,9 +199,9 @@ public class IoDisplay implements IInfoRenderer {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
|
||||
|
||||
offset = drawText(heading1, text1, offset, scale, size, fr);
|
||||
offset = drawText(heading1, averageInputText, offset, scale, size, fr);
|
||||
if (heading2 != null) {
|
||||
drawText(heading2, text2, offset, scale, size, fr);
|
||||
drawText(heading2, averageOutputText, offset, scale, size, fr);
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
@@ -28,13 +28,19 @@ public class FarmingStationRenderer extends TechneMachineRenderer<TileFarmStatio
|
||||
if (world != null) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te instanceof TileFarmStation && ((TileFarmStation) te).isActive()) {
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
BoundingBox bb = BoundingBox.UNIT_CUBE.scale(10D / 16D, 0.25, 10D / 16D);
|
||||
bb = bb.scale(1.01, 1, 1.01);
|
||||
bb = bb.translate(0, 5f / 16f, 0);
|
||||
bb = bb.translate(x, y, z);
|
||||
Tessellator.instance.setColorOpaque_F(1, 1, 1);
|
||||
Tessellator.instance.setBrightness(0xF000F0);
|
||||
CubeRenderer.render(bb, override != null ? override : Blocks.portal.getBlockTextureFromSide(1));
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
tessellator.setBrightness(0xF000F0);
|
||||
IIcon ico = override != null ? override : Blocks.portal.getBlockTextureFromSide(1);
|
||||
float x1 = ico.getInterpolatedU(3);
|
||||
float x2 = ico.getInterpolatedU(13);
|
||||
float y1 = ico.getInterpolatedV(6);
|
||||
float y2 = ico.getInterpolatedV(10);
|
||||
CubeRenderer.get().render(bb, x1, x2, y1, y2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.enderio.core.common.util.BlockCoord;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.util.ClientUtil;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
@@ -51,11 +52,7 @@ public class PacketFarmAction implements IMessage, IMessageHandler<PacketFarmAct
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketFarmAction message, MessageContext ctx) {
|
||||
for (BlockCoord bc : message.coords) {
|
||||
for (int i = 0; i < 15; i++) {
|
||||
ClientUtil.spawnFarmParcticles(rand, bc);
|
||||
}
|
||||
}
|
||||
ClientUtil.spawnFarmParticles(rand, message.coords, Config.farmParticlesCount);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -458,8 +458,9 @@ public class TileFarmStation extends AbstractPoweredTaskEntity {
|
||||
IHarvestResult harvest = FarmersCommune.instance.harvestBlock(this, bc, block, meta);
|
||||
if (harvest != null && harvest.getDrops() != null) {
|
||||
PacketFarmAction pkt = new PacketFarmAction(harvest.getHarvestedBlocks());
|
||||
PacketHandler.INSTANCE
|
||||
.sendToAllAround(pkt, new TargetPoint(worldObj.provider.dimensionId, bc.x, bc.y, bc.z, 64));
|
||||
PacketHandler.INSTANCE.sendToAllAround(
|
||||
pkt,
|
||||
new TargetPoint(worldObj.provider.dimensionId, bc.x, bc.y, bc.z, Config.farmParticlesMaxRange));
|
||||
for (EntityItem ei : harvest.getDrops()) {
|
||||
if (ei != null) {
|
||||
insertHarvestDrop(ei, bc);
|
||||
@@ -487,7 +488,12 @@ public class TileFarmStation extends AbstractPoweredTaskEntity {
|
||||
inventory[minFirtSlot] = farmerJoe.inventory.mainInventory[0];
|
||||
PacketHandler.INSTANCE.sendToAllAround(
|
||||
new PacketFarmAction(bc),
|
||||
new TargetPoint(worldObj.provider.dimensionId, bc.x, bc.y, bc.z, 64));
|
||||
new TargetPoint(
|
||||
worldObj.provider.dimensionId,
|
||||
bc.x,
|
||||
bc.y,
|
||||
bc.z,
|
||||
Config.farmParticlesMaxRange));
|
||||
if (inventory[minFirtSlot] != null && inventory[minFirtSlot].stackSize == 0) {
|
||||
inventory[minFirtSlot] = null;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,11 @@ public class TileZombieGenerator extends AbstractGeneratorEntity
|
||||
public String getMachineName() {
|
||||
return ModObject.blockFrankenzombieGenerator.unlocalisedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratorType getGeneratorType() {
|
||||
return GeneratorType.FRANKENZOMBIE;
|
||||
}
|
||||
}
|
||||
|
||||
public static class TileEnderGenerator extends TileZombieGenerator {
|
||||
@@ -58,6 +63,11 @@ public class TileZombieGenerator extends AbstractGeneratorEntity
|
||||
protected Fluid getFluidType() {
|
||||
return EnderIO.fluidEnderDistillation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratorType getGeneratorType() {
|
||||
return GeneratorType.ENDER;
|
||||
}
|
||||
}
|
||||
|
||||
private static int IO_MB_TICK = 250;
|
||||
@@ -326,7 +336,7 @@ public class TileZombieGenerator extends AbstractGeneratorEntity
|
||||
}
|
||||
|
||||
public GeneratorType getGeneratorType() {
|
||||
return ((BlockZombieGenerator) worldObj.getBlock(xCoord, yCoord, zCoord)).getGeneratorType();
|
||||
return GeneratorType.ZOMBIE;
|
||||
}
|
||||
|
||||
public int getOutputPerTick() {
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ public class ZombieGeneratorRenderer extends TileEntitySpecialRenderer implement
|
||||
}
|
||||
tes.setBrightness(brightness);
|
||||
|
||||
CubeRenderer.render(bb, icon);
|
||||
CubeRenderer.get().render(bb, icon);
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
@@ -111,7 +111,7 @@ public class HyperCubeRenderer extends TileEntitySpecialRenderer implements IIte
|
||||
} else {
|
||||
GL11.glColor4f(1, 1, 1, 1f);
|
||||
}
|
||||
CubeRenderer.render(bb, icon);
|
||||
CubeRenderer.get().render(bb, icon);
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
@@ -142,7 +142,7 @@ public class KillerJoeRenderer extends TileEntitySpecialRenderer implements IIte
|
||||
tes.setBrightness(brightness);
|
||||
tes.setColorOpaque_F(1, 1, 1);
|
||||
|
||||
CubeRenderer.render(bb, icon);
|
||||
CubeRenderer.get().render(bb, icon);
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
@@ -56,9 +57,10 @@ public class BlockLightNode extends BlockEio {
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6) {
|
||||
TileLightNode te = (TileLightNode) world.getTileEntity(x, y, z);
|
||||
if (te != null) {
|
||||
te.onBlockRemoved();
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te instanceof TileLightNode) {
|
||||
TileLightNode light = (TileLightNode) te;
|
||||
light.onBlockRemoved();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,9 +9,11 @@ import net.minecraft.world.IBlockAccess;
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
import com.enderio.core.client.render.CubeRenderer;
|
||||
import com.enderio.core.client.render.RenderUtil;
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
public class ElectricLightRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
@@ -19,13 +21,13 @@ public class ElectricLightRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
BoundingBox bb = new BoundingBox(0, 0, 0, 1, 0.2, 1);
|
||||
boolean doDraw = false;
|
||||
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
|
||||
IIcon[] textures = RenderUtil.getBlockTextures(block, metadata);
|
||||
CubeRenderer.render(bb, textures, null, null);
|
||||
CubeRenderer.get().render(bb, textures, null, null);
|
||||
|
||||
Tessellator.instance.draw();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -45,9 +47,9 @@ public class ElectricLightRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
IIcon[] textures = RenderUtil.getBlockTextures(world, x, y, z);
|
||||
if (renderer.hasOverrideBlockTexture()) {
|
||||
CubeRenderer.render(bb, renderer.overrideBlockTexture);
|
||||
CubeRenderer.get().render(bb, renderer.overrideBlockTexture);
|
||||
} else {
|
||||
CubeRenderer.render(bb, textures, null, null);
|
||||
CubeRenderer.get().render(bb, textures, null, null);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -17,13 +17,15 @@ import com.enderio.core.client.render.RenderUtil;
|
||||
import com.enderio.core.common.vecmath.Vector3d;
|
||||
import com.enderio.core.common.vecmath.Vector3f;
|
||||
import com.enderio.core.common.vecmath.Vertex;
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
|
||||
@ThreadSafeISBRH(perThread = true)
|
||||
public class ObeliskRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
private static final VertXForm2 xform2 = new VertXForm2();
|
||||
private static final VertXForm3 xform3 = new VertXForm3();
|
||||
private final VertXForm2 xform2 = new VertXForm2();
|
||||
private final VertXForm3 xform3 = new VertXForm3();
|
||||
|
||||
private static final float WIDE_PINCH = 0.9f;
|
||||
private static final float WIDTH = 18f / 32f * WIDE_PINCH;
|
||||
@@ -39,11 +41,12 @@ public class ObeliskRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
tessellator.startDrawingQuads();
|
||||
renderWorldBlock(null, 0, 0, 0, block, 0, renderer);
|
||||
Tessellator.instance.draw();
|
||||
tessellator.draw();
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
@@ -66,6 +69,8 @@ public class ObeliskRenderer implements ISimpleBlockRenderingHandler {
|
||||
} else { // item
|
||||
icons = RenderUtil.getBlockTextures(block, 0);
|
||||
}
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
final CubeRenderer cr = CubeRenderer.get();
|
||||
|
||||
// bottom texture goes into its own BB
|
||||
IIcon[] bottomIcons = new IIcon[6];
|
||||
@@ -75,18 +80,18 @@ public class ObeliskRenderer implements ISimpleBlockRenderingHandler {
|
||||
bottomIcons[BOTTOM] = icons[BOTTOM];
|
||||
icons[BOTTOM] = IconUtil.blankTexture;
|
||||
|
||||
Tessellator.instance.addTranslation(x, y, z);
|
||||
tessellator.addTranslation(x, y, z);
|
||||
|
||||
xform2.isX = false;
|
||||
CubeRenderer.render(bb1, icons, xform2, true);
|
||||
cr.render(bb1, icons, xform2, true);
|
||||
|
||||
xform2.isX = true;
|
||||
icons[TOP] = IconUtil.blankTexture;
|
||||
CubeRenderer.render(bb2, icons, xform2, true);
|
||||
cr.render(bb2, icons, xform2, true);
|
||||
|
||||
CubeRenderer.render(BoundingBox.UNIT_CUBE, bottomIcons, xform3, true);
|
||||
cr.render(BoundingBox.UNIT_CUBE, bottomIcons, xform3, true);
|
||||
|
||||
Tessellator.instance.addTranslation(-x, -y, -z);
|
||||
tessellator.addTranslation(-x, -y, -z);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -7,9 +7,12 @@ import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import crazypants.enderio.EnderIO;
|
||||
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
public class BlockPaintedFenceGateRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,10 +11,13 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import com.enderio.core.client.render.CubeRenderer;
|
||||
import com.enderio.core.client.render.IconUtil;
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRHFactory;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
public class PaintedBlockRenderer implements ISimpleBlockRenderingHandler {
|
||||
@Optional.Interface(modid = "angelica", iface = "com.gtnewhorizons.angelica.api.ThreadSafeISBRHFactory")
|
||||
public class PaintedBlockRenderer implements ISimpleBlockRenderingHandler, ThreadSafeISBRHFactory {
|
||||
|
||||
private int renderId;
|
||||
private Block defaultBlock;
|
||||
@@ -22,6 +25,13 @@ public class PaintedBlockRenderer implements ISimpleBlockRenderingHandler {
|
||||
public PaintedBlockRenderer(int renderId, Block defaultBlock) {
|
||||
this.renderId = renderId;
|
||||
this.defaultBlock = defaultBlock;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "angelica")
|
||||
public ThreadSafeISBRHFactory newInstance() {
|
||||
return new PaintedBlockRenderer(renderId, defaultBlock);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -31,9 +41,10 @@ public class PaintedBlockRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block blk, int meta, int modelId, RenderBlocks arg3) {
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
CubeRenderer.render(blk, meta);
|
||||
Tessellator.instance.draw();
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
CubeRenderer.get().render(blk, meta);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,18 +24,20 @@ import com.enderio.core.common.vecmath.Vector3d;
|
||||
import com.enderio.core.common.vecmath.Vector4d;
|
||||
import com.enderio.core.common.vecmath.Vector4f;
|
||||
import com.enderio.core.common.vecmath.Vertex;
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.machine.power.GaugeBounds.VPos;
|
||||
|
||||
@ThreadSafeISBRH(perThread = true)
|
||||
public class CapBankRenderer2 implements ISimpleBlockRenderingHandler {
|
||||
|
||||
private static final BlockCoord DEFAULT_BC = new BlockCoord(0, 0, 0);
|
||||
private static final BlockCoord[] DEFAULT_MB = new BlockCoord[] { DEFAULT_BC };
|
||||
private static final double PIXEL_SIZE = 1 / 16d;
|
||||
|
||||
private final List<IRenderFace> renderers = new ArrayList<IRenderFace>(2);
|
||||
private final List<IRenderFace> renderers = new ArrayList<>(2);
|
||||
|
||||
private ConnectedTextureRenderer connectedTexRenderer;
|
||||
|
||||
@@ -67,7 +69,7 @@ public class CapBankRenderer2 implements ISimpleBlockRenderingHandler {
|
||||
connectedTexRenderer.setEdgeTexture(EnderIO.blockAlloySmelter.getBlockTextureFromSide(3));
|
||||
connectedTexRenderer.setForceAllEdges(false);
|
||||
}
|
||||
CustomCubeRenderer.instance.renderBlock(world, block, x, y, z, renderers);
|
||||
CustomCubeRenderer.get().renderBlock(world, block, x, y, z, renderers);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,8 @@ public class CapacitorBankRenderer extends TileEntitySpecialRenderer implements
|
||||
}
|
||||
|
||||
tes.startDrawingQuads();
|
||||
CubeRenderer.render(BoundingBox.UNIT_CUBE, EnderIO.blockCapacitorBank.getIcon(0, 0), null, brightness, true);
|
||||
CubeRenderer.get()
|
||||
.render(BoundingBox.UNIT_CUBE, EnderIO.blockCapacitorBank.getIcon(0, 0), null, brightness, true);
|
||||
tes.draw();
|
||||
|
||||
GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||
|
||||
@@ -21,6 +21,7 @@ public class RangeRenerer extends RenderEntity {
|
||||
public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float p_76986_9_) {
|
||||
|
||||
RangeEntity se = ((RangeEntity) entity);
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
@@ -43,10 +44,10 @@ public class RangeRenerer extends RenderEntity {
|
||||
GL11.glColor4f(1, 1, 1, 0.4f);
|
||||
|
||||
RenderUtil.bindBlockTexture();
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
Tessellator.instance.setBrightness(15 << 20 | 15 << 4);
|
||||
CubeRenderer.render(BoundingBox.UNIT_CUBE, IconUtil.whiteTexture);
|
||||
Tessellator.instance.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setBrightness(15 << 20 | 15 << 4);
|
||||
CubeRenderer.get().render(BoundingBox.UNIT_CUBE, IconUtil.whiteTexture);
|
||||
tessellator.draw();
|
||||
|
||||
RenderUtil.bindItemTexture();
|
||||
|
||||
|
||||
@@ -74,18 +74,19 @@ public class ReservoirRenderer extends TileEntitySpecialRenderer implements IRes
|
||||
GL11.glTranslatef((float) x + offset.x, (float) y + offset.y, (float) z + offset.z);
|
||||
|
||||
BoundingBox bb = res.getLiquidRenderBounds();
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
if (res.isAutoEject()) {
|
||||
|
||||
// switch
|
||||
RenderUtil.bindBlockTexture();
|
||||
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
Tessellator.instance.setColorRGBA_F(val, val, val, 1);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA_F(val, val, val, 1);
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
drawSwitch(dir, bb);
|
||||
}
|
||||
Tessellator.instance.draw();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
if (fullness > 0) {
|
||||
@@ -96,9 +97,9 @@ public class ReservoirRenderer extends TileEntitySpecialRenderer implements IRes
|
||||
IIcon tex = getLiquidTexture();
|
||||
float maxV = tex.getMinV() + ((tex.getMaxV() - tex.getMinV()) * fullness);
|
||||
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
Tessellator.instance.setColorRGBA_F(val, val, val, 1);
|
||||
CubeRenderer.render(
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA_F(val, val, val, 1);
|
||||
CubeRenderer.get().render(
|
||||
new BoundingBox(
|
||||
bb.minX + margin,
|
||||
bb.minY + margin,
|
||||
@@ -110,7 +111,7 @@ public class ReservoirRenderer extends TileEntitySpecialRenderer implements IRes
|
||||
tex.getMaxU(),
|
||||
tex.getMinV(),
|
||||
maxV);
|
||||
Tessellator.instance.draw();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
GL11.glPopAttrib();
|
||||
@@ -119,10 +120,10 @@ public class ReservoirRenderer extends TileEntitySpecialRenderer implements IRes
|
||||
Minecraft.getMinecraft().entityRenderer.enableLightmap(0);
|
||||
}
|
||||
|
||||
private Vector3d forward = new Vector3d();
|
||||
private Vector3d left = new Vector3d();
|
||||
private Vector3d up = new Vector3d();
|
||||
private Vector3d offset = new Vector3d();
|
||||
private final Vector3d forward = new Vector3d();
|
||||
private final Vector3d left = new Vector3d();
|
||||
private final Vector3d up = new Vector3d();
|
||||
private final Vector3d offset = new Vector3d();
|
||||
|
||||
private void drawSwitch(ForgeDirection dir, BoundingBox bb) {
|
||||
Tessellator tes = Tessellator.instance;
|
||||
|
||||
@@ -18,13 +18,15 @@ import com.enderio.core.client.render.CubeRenderer;
|
||||
import com.enderio.core.client.render.CustomCubeRenderer;
|
||||
import com.enderio.core.client.render.IconUtil;
|
||||
import com.enderio.core.client.render.RenderUtil;
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import crazypants.enderio.EnderIO;
|
||||
|
||||
@ThreadSafeISBRH(perThread = true)
|
||||
public class SolarPanelRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
private ConnectedTextureRenderer ctr;
|
||||
private final ConnectedTextureRenderer ctr;
|
||||
|
||||
public SolarPanelRenderer() {
|
||||
ctr = new ConnectedTextureRenderer();
|
||||
@@ -40,7 +42,7 @@ public class SolarPanelRenderer implements ISimpleBlockRenderingHandler {
|
||||
float offset = -0.5f;
|
||||
tes.addTranslation(offset, 0, offset);
|
||||
tes.startDrawingQuads();
|
||||
CubeRenderer.render(
|
||||
CubeRenderer.get().render(
|
||||
new BoundingBox(EnderIO.blockSolarPanel),
|
||||
RenderUtil.getBlockTextures(EnderIO.blockSolarPanel, metadata),
|
||||
false);
|
||||
@@ -62,19 +64,23 @@ public class SolarPanelRenderer implements ISimpleBlockRenderingHandler {
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
|
||||
RenderBlocks renderer) {
|
||||
CustomCubeRenderer ccr = CustomCubeRenderer.get();
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
Tessellator.instance.addTranslation(0, 0.0001f, 0);
|
||||
tessellator.addTranslation(0, 0.0001f, 0);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
meta = MathHelper.clamp_int(meta, 0, 1);
|
||||
ctr.setEdgeTexture(EnderIO.blockSolarPanel.getBorderIcon(0, meta));
|
||||
CustomCubeRenderer.instance.setOverrideTexture(IconUtil.blankTexture);
|
||||
|
||||
ccr.setOverrideTexture(IconUtil.blankTexture);
|
||||
if (!renderer.hasOverrideBlockTexture()) {
|
||||
CustomCubeRenderer.instance.renderBlock(world, block, x, y, z, ctr);
|
||||
ccr.renderBlock(world, block, x, y, z, ctr);
|
||||
} else {
|
||||
CustomCubeRenderer.instance.renderBlock(world, block, x, y, z);
|
||||
ccr.renderBlock(world, block, x, y, z);
|
||||
}
|
||||
CustomCubeRenderer.instance.setOverrideTexture(null);
|
||||
Tessellator.instance.addTranslation(0, -0.0001f, 0);
|
||||
ccr.setOverrideTexture(null);
|
||||
tessellator.addTranslation(0, -0.0001f, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,11 +14,13 @@ import com.enderio.core.client.render.BoundingBox;
|
||||
import com.enderio.core.client.render.CubeRenderer;
|
||||
import com.enderio.core.client.render.IconUtil;
|
||||
import com.enderio.core.common.util.ForgeDirectionOffsets;
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import crazypants.enderio.ClientProxy;
|
||||
import crazypants.enderio.EnderIO;
|
||||
|
||||
@ThreadSafeISBRH(perThread = true)
|
||||
public class SoulBinderRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
private float skullScale = 0.5f;
|
||||
@@ -30,9 +32,10 @@ public class SoulBinderRenderer implements ISimpleBlockRenderingHandler {
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
renderWorldBlock(null, 0, 0, 0, block, 0, renderer);
|
||||
Tessellator.instance.draw();
|
||||
tessellator.draw();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
@@ -42,6 +45,8 @@ public class SoulBinderRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
IIcon soulariumIcon = EnderIO.blockSoulFuser.getIcon(ForgeDirection.EAST.ordinal(), 0);
|
||||
override = renderer.overrideBlockTexture;
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
final CubeRenderer cr = CubeRenderer.get();
|
||||
|
||||
// Horrible hack to get the MC lighting engine to set the correct values for me
|
||||
if (renderer != null && world != null) {
|
||||
@@ -51,23 +56,23 @@ public class SoulBinderRenderer implements ISimpleBlockRenderingHandler {
|
||||
}
|
||||
BoundingBox bb;
|
||||
|
||||
Tessellator.instance.addTranslation(x, y, z);
|
||||
tessellator.addTranslation(x, y, z);
|
||||
|
||||
bb = BoundingBox.UNIT_CUBE.scale(0.85, 0.85, 0.85);
|
||||
setIcons(soulariumIcon, soulariumIcon, ForgeDirection.NORTH);
|
||||
CubeRenderer.render(bb, icons, true);
|
||||
cr.render(bb, icons, true);
|
||||
|
||||
float slabWidth = 0.15f;
|
||||
bb = BoundingBox.UNIT_CUBE.scale(1, slabWidth, 1);
|
||||
bb = bb.translate(0, 0.5f - (slabWidth / 2), 0);
|
||||
setIcons(soulariumIcon, EnderIO.blockSoulFuser.getIcon(ForgeDirection.UP.ordinal(), 0), ForgeDirection.UP);
|
||||
CubeRenderer.render(bb, icons, true);
|
||||
cr.render(bb, icons, true);
|
||||
|
||||
bb = BoundingBox.UNIT_CUBE.scale(1, slabWidth, 1);
|
||||
bb = bb.translate(0, -0.5f + (slabWidth / 2), 0);
|
||||
setIcons(soulariumIcon, soulariumIcon, ForgeDirection.NORTH);
|
||||
|
||||
CubeRenderer.render(bb, icons, true);
|
||||
cr.render(bb, icons, true);
|
||||
|
||||
IIcon endermanIcon;
|
||||
int facing = ForgeDirection.SOUTH.ordinal();
|
||||
@@ -86,7 +91,7 @@ public class SoulBinderRenderer implements ISimpleBlockRenderingHandler {
|
||||
renderSkull(forFacing(ForgeDirection.NORTH, facing), soulariumIcon, EnderIO.blockSoulFuser.zombieSkullIcon);
|
||||
renderSkull(forFacing(ForgeDirection.EAST, facing), soulariumIcon, EnderIO.blockSoulFuser.creeperSkullIcon);
|
||||
|
||||
Tessellator.instance.addTranslation(-x, -y, -z);
|
||||
tessellator.addTranslation(-x, -y, -z);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -99,7 +104,7 @@ public class SoulBinderRenderer implements ISimpleBlockRenderingHandler {
|
||||
BoundingBox bb;
|
||||
bb = scaledBB.translate(ForgeDirectionOffsets.offsetScaled(face, 0.5 - skullScale / 2));
|
||||
setIcons(soulariumIcon, faceIcon, face);
|
||||
CubeRenderer.render(bb, icons, true);
|
||||
CubeRenderer.get().render(bb, icons, true);
|
||||
}
|
||||
|
||||
private void setIcons(IIcon defaultIcon, IIcon faceIcon, ForgeDirection faceSide) {
|
||||
|
||||
@@ -34,6 +34,7 @@ public class TankFluidRenderer extends TileEntitySpecialRenderer {
|
||||
}
|
||||
IIcon icon = tank.getFluid().getFluid().getStillIcon();
|
||||
if (icon != null) {
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
float fullness = tank.getFilledRatio();
|
||||
y += 0.01f; // prevent bottom side z-fighting
|
||||
float scale = 0.98f;
|
||||
@@ -49,11 +50,11 @@ public class TankFluidRenderer extends TileEntitySpecialRenderer {
|
||||
|
||||
RenderUtil.bindBlockTexture();
|
||||
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
Tessellator.instance.addTranslation(x, y, z);
|
||||
CubeRenderer.render(bb, icon);
|
||||
Tessellator.instance.addTranslation(-x, -y, -z);
|
||||
Tessellator.instance.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addTranslation(x, y, z);
|
||||
CubeRenderer.get().render(bb, icon);
|
||||
tessellator.addTranslation(-x, -y, -z);
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
@@ -42,11 +42,12 @@ public class TankItemRenderer implements IItemRenderer {
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
Block block = EnderIO.blockTank;
|
||||
int meta = item.getItemDamage();
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
IIcon[] icons = RenderUtil.getBlockTextures(block, meta);
|
||||
BoundingBox bb = BoundingBox.UNIT_CUBE.translate(0, -0.1f, 0);
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
CubeRenderer.render(bb, icons, null, RenderUtil.getDefaultPerSideBrightness());
|
||||
Tessellator.instance.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
CubeRenderer.get().render(bb, icons, null, RenderUtil.getDefaultPerSideBrightness());
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -162,7 +162,7 @@ public class TransceiverRenderer extends TileEntitySpecialRenderer implements II
|
||||
} else {
|
||||
GL11.glColor4f(1, 1, 1, 1f);
|
||||
}
|
||||
CubeRenderer.render(bb, icon);
|
||||
CubeRenderer.get().render(bb, icon);
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
@@ -11,18 +11,22 @@ import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
import com.enderio.core.client.render.CubeRenderer;
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import crazypants.enderio.EnderIO;
|
||||
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
public class VacuumChestRenderer implements ISimpleBlockRenderingHandler, IItemRenderer {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
CubeRenderer.render(BoundingBox.UNIT_CUBE.scale(0.6, 0.6, 0.6), EnderIO.blockHyperCube.getIcon(0, 0));
|
||||
CubeRenderer.render(BoundingBox.UNIT_CUBE.scale(0.90, 0.90, 0.90), EnderIO.blockVacuumChest.getIcon(0, 0));
|
||||
Tessellator.instance.draw();
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
final CubeRenderer cr = CubeRenderer.get();
|
||||
tessellator.startDrawingQuads();
|
||||
cr.render(BoundingBox.UNIT_CUBE.scale(0.6, 0.6, 0.6), EnderIO.blockHyperCube.getIcon(0, 0));
|
||||
cr.render(BoundingBox.UNIT_CUBE.scale(0.90, 0.90, 0.90), EnderIO.blockVacuumChest.getIcon(0, 0));
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,10 +13,12 @@ import com.enderio.core.client.render.VertexRotation;
|
||||
import com.enderio.core.client.render.VertexTransformComposite;
|
||||
import com.enderio.core.client.render.VertexTranslation;
|
||||
import com.enderio.core.common.vecmath.Vector3d;
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import crazypants.enderio.EnderIO;
|
||||
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
public class WirelessChargerRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
@@ -37,7 +39,8 @@ public class WirelessChargerRenderer implements ISimpleBlockRenderingHandler {
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
|
||||
RenderBlocks renderer) {
|
||||
|
||||
Tessellator tes = Tessellator.instance;
|
||||
final Tessellator tes = Tessellator.instance;
|
||||
final CubeRenderer cr = CubeRenderer.get();
|
||||
|
||||
IIcon baseIcon = EnderIO.blockWirelessCharger.getIcon(0, 0);
|
||||
|
||||
@@ -50,34 +53,33 @@ public class WirelessChargerRenderer implements ISimpleBlockRenderingHandler {
|
||||
VertexTransform trans = new VertexTranslation(0, -0.5 + 0.025, 0);
|
||||
|
||||
VertexTransformComposite xform = new VertexTransformComposite(rot, trans);
|
||||
CubeRenderer.render(BoundingBox.UNIT_CUBE.scale(0.7, 0.05, 0.7), baseIcon, xform, true);
|
||||
cr.render(BoundingBox.UNIT_CUBE.scale(0.7, 0.05, 0.7), baseIcon, xform, true);
|
||||
|
||||
trans = new VertexTranslation(0, 0.5 - 0.025, 0);
|
||||
xform = new VertexTransformComposite(rot, trans);
|
||||
CubeRenderer.render(BoundingBox.UNIT_CUBE.scale(0.7, 0.05, 0.7), baseIcon, xform, true);
|
||||
cr.render(BoundingBox.UNIT_CUBE.scale(0.7, 0.05, 0.7), baseIcon, xform, true);
|
||||
|
||||
CubeRenderer
|
||||
.render(BoundingBox.UNIT_CUBE.scale(0.2, 0.91, 0.2), EnderIO.blockWirelessCharger.getCenterOn(), true);
|
||||
cr.render(BoundingBox.UNIT_CUBE.scale(0.2, 0.91, 0.2), EnderIO.blockWirelessCharger.getCenterOn(), true);
|
||||
|
||||
trans = new VertexTranslation(0, 0, 0.5 - 0.01);
|
||||
xform = new VertexTransformComposite(trans);
|
||||
CubeRenderer.render(BoundingBox.UNIT_CUBE.scale(0.25, 0.25, 0.01), baseIcon, xform, true);
|
||||
CubeRenderer.render(BoundingBox.UNIT_CUBE.scale(0.01, 1, 0.01), baseIcon, xform, true);
|
||||
cr.render(BoundingBox.UNIT_CUBE.scale(0.25, 0.25, 0.01), baseIcon, xform, true);
|
||||
cr.render(BoundingBox.UNIT_CUBE.scale(0.01, 1, 0.01), baseIcon, xform, true);
|
||||
|
||||
rot = new VertexRotation(Math.toRadians(90), new Vector3d(0, 1, 0), new Vector3d(0.5, 0.5, 0.5));
|
||||
xform = new VertexTransformComposite(trans, rot);
|
||||
CubeRenderer.render(BoundingBox.UNIT_CUBE.scale(0.25, 0.25, 0.01), baseIcon, xform, true);
|
||||
CubeRenderer.render(BoundingBox.UNIT_CUBE.scale(0.01, 1, 0.01), baseIcon, xform, true);
|
||||
cr.render(BoundingBox.UNIT_CUBE.scale(0.25, 0.25, 0.01), baseIcon, xform, true);
|
||||
cr.render(BoundingBox.UNIT_CUBE.scale(0.01, 1, 0.01), baseIcon, xform, true);
|
||||
|
||||
rot = new VertexRotation(Math.toRadians(180), new Vector3d(0, 1, 0), new Vector3d(0.5, 0.5, 0.5));
|
||||
xform = new VertexTransformComposite(trans, rot);
|
||||
CubeRenderer.render(BoundingBox.UNIT_CUBE.scale(0.25, 0.25, 0.01), baseIcon, xform, true);
|
||||
CubeRenderer.render(BoundingBox.UNIT_CUBE.scale(0.01, 1, 0.01), baseIcon, xform, true);
|
||||
cr.render(BoundingBox.UNIT_CUBE.scale(0.25, 0.25, 0.01), baseIcon, xform, true);
|
||||
cr.render(BoundingBox.UNIT_CUBE.scale(0.01, 1, 0.01), baseIcon, xform, true);
|
||||
|
||||
rot = new VertexRotation(Math.toRadians(270), new Vector3d(0, 1, 0), new Vector3d(0.5, 0.5, 0.5));
|
||||
xform = new VertexTransformComposite(trans, rot);
|
||||
CubeRenderer.render(BoundingBox.UNIT_CUBE.scale(0.25, 0.25, 0.01), baseIcon, xform, true);
|
||||
CubeRenderer.render(BoundingBox.UNIT_CUBE.scale(0.01, 1, 0.01), baseIcon, xform, true);
|
||||
cr.render(BoundingBox.UNIT_CUBE.scale(0.25, 0.25, 0.01), baseIcon, xform, true);
|
||||
cr.render(BoundingBox.UNIT_CUBE.scale(0.01, 1, 0.01), baseIcon, xform, true);
|
||||
|
||||
tes.addTranslation(-x, -y, -z);
|
||||
|
||||
|
||||
@@ -33,9 +33,10 @@ public enum Alloy {
|
||||
if (oreDictName != null) {
|
||||
this.oreIngots.add("ingot" + StringUtils.capitalize(oreDictName));
|
||||
this.oreBlocks.add("block" + StringUtils.capitalize(oreDictName));
|
||||
} else {
|
||||
this.oreIngots.add("ingot" + StringUtils.capitalize(baseName));
|
||||
this.oreBlocks.add("block" + StringUtils.capitalize(baseName));
|
||||
}
|
||||
this.oreIngots.add("ingot" + StringUtils.capitalize(baseName));
|
||||
this.oreBlocks.add("block" + StringUtils.capitalize(baseName));
|
||||
this.hardness = hardness;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.enderio.core.client.render.ConnectedTextureRenderer;
|
||||
import com.enderio.core.client.render.ConnectedTextureRenderer.DefaultTextureCallback;
|
||||
import com.enderio.core.client.render.CustomCubeRenderer;
|
||||
import com.enderio.core.client.render.RenderUtil;
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import crazypants.enderio.EnderIO;
|
||||
@@ -22,6 +23,7 @@ import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.painter.PainterUtil;
|
||||
import crazypants.enderio.machine.painter.TileEntityPaintedBlock;
|
||||
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
public class FusedQuartzRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
static int renderPass;
|
||||
@@ -115,19 +117,19 @@ public class FusedQuartzRenderer implements ISimpleBlockRenderingHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
CustomCubeRenderer.instance.setOverrideTexture(EnderIO.blockFusedQuartz.getIcon(0, meta));
|
||||
final CustomCubeRenderer ccr = CustomCubeRenderer.get();
|
||||
|
||||
ccr.setOverrideTexture(EnderIO.blockFusedQuartz.getIcon(0, meta));
|
||||
|
||||
if (tecb != null && tecb.getSourceBlock() != null) {
|
||||
connectedTextureRenderer.setEdgeTexureCallback(
|
||||
new DefaultTextureCallback(tecb.getSourceBlock(), tecb.getSourceBlockMetadata()));
|
||||
CustomCubeRenderer.instance
|
||||
.renderBlock(blockAccess, EnderIO.blockFusedQuartz, x, y, z, connectedTextureRenderer);
|
||||
ccr.renderBlock(blockAccess, EnderIO.blockFusedQuartz, x, y, z, connectedTextureRenderer);
|
||||
} else {
|
||||
connectedTextureRenderer.setEdgeTexture(EnderIO.blockFusedQuartz.getDefaultFrameIcon(meta));
|
||||
CustomCubeRenderer.instance
|
||||
.renderBlock(blockAccess, EnderIO.blockFusedQuartz, x, y, z, connectedTextureRenderer);
|
||||
ccr.renderBlock(blockAccess, EnderIO.blockFusedQuartz, x, y, z, connectedTextureRenderer);
|
||||
}
|
||||
|
||||
CustomCubeRenderer.instance.setOverrideTexture(null);
|
||||
ccr.setOverrideTexture(null);
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@ public class ItemCapacitor extends Item implements ICapacitorItem {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
if (par1ItemStack != null && par1ItemStack.getItemDamage() > 0) {
|
||||
if (par1ItemStack != null && par1ItemStack.getItemDamage() > 0 && par1ItemStack.getItemDamage() != 7) {
|
||||
par3List.add(EnderIO.lang.localize("machine.tooltip.upgrade"));
|
||||
if (SpecialTooltipHandler.showAdvancedTooltips()) {
|
||||
SpecialTooltipHandler.addDetailedTooltipFromResources(par3List, "enderio.machine.tooltip.upgrade");
|
||||
|
||||
@@ -15,6 +15,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.api.teleport.TravelSource;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.power.PowerDisplayUtil;
|
||||
|
||||
public class ItemTeleportStaff extends ItemTravelStaff {
|
||||
@@ -56,14 +57,30 @@ public class ItemTeleportStaff extends ItemTravelStaff {
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack equipped, World world, EntityPlayer player) {
|
||||
if (world.isRemote) {
|
||||
if (player.isSneaking()) {
|
||||
TravelController.instance
|
||||
.activateTravelAccessable(equipped, world, player, TravelSource.TELEPORT_STAFF);
|
||||
} else {
|
||||
TravelController.instance.doTeleport(player);
|
||||
int action = player.isSneaking() ? Config.teleportStaffSneakAction : Config.teleportStaffAction;
|
||||
switch (action) {
|
||||
case 0:
|
||||
// Do nothing.
|
||||
break;
|
||||
|
||||
case 1:
|
||||
TravelController.instance.doTeleport(player);
|
||||
player.swingItem();
|
||||
break;
|
||||
|
||||
case 2:
|
||||
TravelController.instance
|
||||
.activateTravelAccessable(equipped, world, player, TravelSource.TELEPORT_STAFF);
|
||||
player.swingItem();
|
||||
break;
|
||||
|
||||
case 3:
|
||||
TravelController.instance
|
||||
.activateTravelAccessable(equipped, world, player, TravelSource.TELEPORT_STAFF, true);
|
||||
player.swingItem();
|
||||
break;
|
||||
}
|
||||
}
|
||||
player.swingItem();
|
||||
return equipped;
|
||||
}
|
||||
|
||||
@@ -89,6 +106,12 @@ public class ItemTeleportStaff extends ItemTravelStaff {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ItemStack item) {
|
||||
// Has infinite energy, always report as being full of energy for any validation-code purposes.
|
||||
return this.capacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
|
||||
@@ -3,10 +3,8 @@ package crazypants.enderio.teleport;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -32,6 +30,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import com.enderio.core.common.util.Util;
|
||||
@@ -41,10 +40,12 @@ import com.enderio.core.common.vecmath.VecmathUtil;
|
||||
import com.enderio.core.common.vecmath.Vector2d;
|
||||
import com.enderio.core.common.vecmath.Vector3d;
|
||||
import com.google.common.collect.MultimapBuilder;
|
||||
import com.google.common.collect.RowSortedTable;
|
||||
import com.google.common.collect.SetMultimap;
|
||||
import com.google.common.collect.Table;
|
||||
import com.google.common.collect.TreeBasedTable;
|
||||
import com.gtnewhorizon.gtnhlib.GTNHLib;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
@@ -148,11 +149,12 @@ public class TravelController {
|
||||
// target must be a valid selectedCoord
|
||||
// selectedCoord can either be a block right above/below when the player is on anchor...
|
||||
if (on.x == x && on.z == z) return null;
|
||||
// or another anchor
|
||||
TileEntity maybeAnchor = target.getTileEntity(toTp.worldObj);
|
||||
// or another anchor. We need to look one block below because TP goes above the anchor.
|
||||
BlockCoord belowTarget = target.getLocation(ForgeDirection.DOWN);
|
||||
TileEntity maybeAnchor = belowTarget.getTileEntity(toTp.worldObj);
|
||||
if (!(maybeAnchor instanceof ITravelAccessable)) return "not anchor";
|
||||
ITravelAccessable anchor = (ITravelAccessable) maybeAnchor;
|
||||
if (!anchor.canBlockBeAccessed(toTp) && isValidTarget(toTp, target, TravelSource.BLOCK)) {
|
||||
if (!isValidTarget(toTp, target, TravelSource.BLOCK)) {
|
||||
return "not valid target";
|
||||
}
|
||||
return null;
|
||||
@@ -160,7 +162,8 @@ public class TravelController {
|
||||
case STAFF_BLINK:
|
||||
if (Config.travelStaffKeybindEnabled) {
|
||||
if (equippedItem == null || equippedItem.getItem() == null
|
||||
|| !(equippedItem.getItem() instanceof IItemOfTravel)) {
|
||||
|| !(equippedItem.getItem() instanceof IItemOfTravel)
|
||||
|| !((IItemOfTravel) equippedItem.getItem()).isActive(toTp, equippedItem)) {
|
||||
equippedItem = findTravelItemInInventoryOrBaubles(toTp);
|
||||
}
|
||||
}
|
||||
@@ -190,12 +193,36 @@ public class TravelController {
|
||||
}
|
||||
|
||||
public boolean activateTravelAccessable(ItemStack equipped, World world, EntityPlayer player, TravelSource source) {
|
||||
return activateTravelAccessable(equipped, world, player, source, false);
|
||||
}
|
||||
|
||||
public boolean activateTravelAccessable(ItemStack equipped, World world, EntityPlayer player, TravelSource source,
|
||||
boolean alsoDoTeleport) {
|
||||
if (!hasTarget()) {
|
||||
if (alsoDoTeleport) {
|
||||
Optional<BlockCoord> destinationOptional = findTeleportDestination(player);
|
||||
if (destinationOptional.isPresent()) {
|
||||
BlockCoord destination = destinationOptional.get();
|
||||
PacketLongDistanceTravelEvent p = new PacketLongDistanceTravelEvent(
|
||||
player,
|
||||
false,
|
||||
source,
|
||||
true,
|
||||
destination.x,
|
||||
destination.y,
|
||||
destination.z);
|
||||
PacketHandler.INSTANCE.sendToServer(p);
|
||||
// We have no way of knowing if it will succeed, so just return false.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
PacketLongDistanceTravelEvent p = new PacketLongDistanceTravelEvent(player, false, source);
|
||||
PacketHandler.INSTANCE.sendToServer(p);
|
||||
// We have no way of knowing if it will succeed, so just return false.
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockCoord target = selectedCoord;
|
||||
TileEntity te = world.getTileEntity(target.x, target.y, target.z);
|
||||
if (te instanceof ITravelAccessable) {
|
||||
@@ -243,7 +270,10 @@ public class TravelController {
|
||||
sample.add(eye);
|
||||
// we test against our feets location
|
||||
sample.y -= playerHeight;
|
||||
if (doBlinkAround(player, source, sample, true)) {
|
||||
|
||||
Optional<BlockCoord> destinationOptional = findNearbyDestination(player, source, sample);
|
||||
if (destinationOptional.isPresent()
|
||||
&& travelToLocation(player, source, destinationOptional.get(), true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -280,7 +310,9 @@ public class TravelController {
|
||||
// we test against our feets location
|
||||
sample.y -= playerHeight;
|
||||
|
||||
if (doBlinkAround(player, source, sample, false)) {
|
||||
Optional<BlockCoord> destinationOptional = findNearbyDestination(player, source, sample);
|
||||
if (destinationOptional.isPresent()
|
||||
&& travelToLocation(player, source, destinationOptional.get(), false)) {
|
||||
return true;
|
||||
}
|
||||
teleDistance++;
|
||||
@@ -296,7 +328,9 @@ public class TravelController {
|
||||
// we test against our feets location
|
||||
sample.y -= playerHeight;
|
||||
|
||||
if (doBlinkAround(player, source, sample, false)) {
|
||||
Optional<BlockCoord> destinationOptional = findNearbyDestination(player, source, sample);
|
||||
if (destinationOptional.isPresent()
|
||||
&& travelToLocation(player, source, destinationOptional.get(), false)) {
|
||||
return true;
|
||||
}
|
||||
sampleDistance--;
|
||||
@@ -308,114 +342,13 @@ public class TravelController {
|
||||
|
||||
/** This is the teleport staff super-teleport. */
|
||||
public boolean doTeleport(EntityPlayer player) {
|
||||
TravelSource source = TravelSource.TELEPORT_STAFF_BLINK;
|
||||
|
||||
Vector3d eye = Util.getEyePositionEio(player);
|
||||
Vector3d look = Util.getLookVecEio(player);
|
||||
|
||||
double playerHeight = player.yOffset;
|
||||
// +2 to compensate for the standard distance decrement of -2
|
||||
double teleDistance = Config.teleportStaffFailedBlinkDistance + 2;
|
||||
Vec3 eye3 = Vec3.createVectorHelper(eye.x, eye.y, eye.z);
|
||||
|
||||
// rayTraceBlocks has a limit of 200 distance.
|
||||
double maxDistance = Config.teleportStaffMaxBlinkDistance;
|
||||
double currDistance = 0;
|
||||
Vec3 pos = eye3;
|
||||
boolean loop = true;
|
||||
while (loop) {
|
||||
double distance = 200;
|
||||
if (maxDistance - currDistance < 200) {
|
||||
distance = maxDistance - currDistance;
|
||||
loop = false;
|
||||
}
|
||||
|
||||
Vector3d sample = new Vector3d(look);
|
||||
sample.scale(distance);
|
||||
sample.add(eye);
|
||||
Vec3 end = Vec3.createVectorHelper(sample.x, sample.y, sample.z);
|
||||
|
||||
MovingObjectPosition p = player.worldObj
|
||||
.rayTraceBlocks(pos, end, !Config.travelStaffBlinkThroughClearBlocksEnabled);
|
||||
if (p != null) {
|
||||
teleDistance = VecmathUtil.distance(eye, new Vector3d(p.blockX + 0.5, p.blockY + 0.5, p.blockZ + 0.5));
|
||||
break;
|
||||
}
|
||||
|
||||
pos = end;
|
||||
currDistance += distance;
|
||||
}
|
||||
|
||||
Vector3d sample = new Vector3d(look);
|
||||
sample.scale(Config.teleportStaffMaxBlinkDistance);
|
||||
sample.add(eye);
|
||||
Vec3 end = Vec3.createVectorHelper(sample.x, sample.y, sample.z);
|
||||
MovingObjectPosition p = player.worldObj
|
||||
.rayTraceBlocks(eye3, end, !Config.travelStaffBlinkThroughClearBlocksEnabled);
|
||||
if (p != null) {
|
||||
teleDistance = VecmathUtil.distance(eye, new Vector3d(p.blockX + 0.5, p.blockY + 0.5, p.blockZ + 0.5));
|
||||
}
|
||||
|
||||
double distanceIncrement = -2;
|
||||
// Special case: if the targeted block is too close, we'll try to teleport through it.
|
||||
if (teleDistance < 3) {
|
||||
distanceIncrement = 2;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
teleDistance += distanceIncrement;
|
||||
|
||||
sample.set(look);
|
||||
sample.scale(teleDistance);
|
||||
sample.add(eye);
|
||||
// we test against our feets location
|
||||
sample.y -= playerHeight;
|
||||
|
||||
if (doBlinkAround(player, source, sample, false)) {
|
||||
return true;
|
||||
}
|
||||
Optional<BlockCoord> destinationOptional = findTeleportDestination(player);
|
||||
if (destinationOptional.isPresent()) {
|
||||
return travelToLocation(player, TravelSource.TELEPORT_STAFF_BLINK, destinationOptional.get(), false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Returns empty optional if no travel destination was found. */
|
||||
public Optional<BlockCoord> findTravelDestination(EntityPlayer player, TravelSource source) {
|
||||
Vector3d eye = Util.getEyePositionEio(player);
|
||||
Vector3d look = Util.getLookVecEio(player);
|
||||
|
||||
// Map of distance to coordinate for eligible travel destinations (within angle).
|
||||
Map<Double, BlockCoord> distanceMap = new TreeMap<>();
|
||||
// Limit the max distance at which we'll display an out of range message.
|
||||
// Otherwise, you could trigger the message for any travel anchor on the entire server.
|
||||
double maxMessageDistance = 1.25 * source.getMaxDistanceTravelled();
|
||||
boolean displayOutOfRangeMessage = false;
|
||||
for (BlockCoord p : travelDestinations.get(player.worldObj.provider.dimensionId)) {
|
||||
Vector3d block = new Vector3d(p.x + 0.5, p.y + 0.5, p.z + 0.5);
|
||||
block.sub(eye);
|
||||
double distance = block.length();
|
||||
if (distance > maxMessageDistance) {
|
||||
continue;
|
||||
}
|
||||
block.normalize();
|
||||
|
||||
double angle = Math.acos(look.dot(block));
|
||||
// Roughly 5 degrees
|
||||
if (angle < 0.087) {
|
||||
if (distance > source.getMaxDistanceTravelled()) {
|
||||
displayOutOfRangeMessage = true;
|
||||
} else {
|
||||
distanceMap.put(distance, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (displayOutOfRangeMessage && distanceMap.isEmpty()) {
|
||||
showMessage(player, new ChatComponentTranslation("enderio.blockTravelPlatform.outOfRange"));
|
||||
}
|
||||
|
||||
return distanceMap.values().stream().findFirst();
|
||||
}
|
||||
|
||||
private boolean isBlackListedBlock(EntityPlayer player, MovingObjectPosition pos, Block hitBlock) {
|
||||
UniqueIdentifier ui = GameRegistry.findUniqueIdentifierFor(hitBlock);
|
||||
if (ui == null) {
|
||||
@@ -426,36 +359,6 @@ public class TravelController {
|
||||
|| !Config.travelStaffBlinkThroughUnbreakableBlocksEnabled);
|
||||
}
|
||||
|
||||
private boolean doBlinkAround(EntityPlayer player, TravelSource source, Vector3d sample, boolean conserveMomentum) {
|
||||
if (travelToLocation(
|
||||
player,
|
||||
source,
|
||||
new BlockCoord((int) Math.floor(sample.x), (int) Math.floor(sample.y), (int) Math.floor(sample.z)),
|
||||
conserveMomentum)) {
|
||||
return true;
|
||||
}
|
||||
if (travelToLocation(
|
||||
player,
|
||||
source,
|
||||
new BlockCoord((int) Math.floor(sample.x), (int) Math.floor(sample.y) + 1, (int) Math.floor(sample.z)),
|
||||
conserveMomentum)) {
|
||||
return true;
|
||||
}
|
||||
if (!Config.travelStaffSearchOptimize) {
|
||||
if (travelToLocation(
|
||||
player,
|
||||
source,
|
||||
new BlockCoord(
|
||||
(int) Math.floor(sample.x),
|
||||
(int) Math.floor(sample.y) - 1,
|
||||
(int) Math.floor(sample.z)),
|
||||
conserveMomentum)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean showTargets() {
|
||||
return showTargets && selectionEnabled;
|
||||
}
|
||||
@@ -492,6 +395,13 @@ public class TravelController {
|
||||
.getBlock(selectedCoord.x, selectedCoord.y, selectedCoord.z) == EnderIO.blockEnderIo;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldLoad(WorldEvent.Load e) {
|
||||
if (!e.world.isRemote) {
|
||||
travelDestinations.removeAll(e.world.provider.dimensionId);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRender(RenderWorldLastEvent event) {
|
||||
@@ -527,7 +437,7 @@ public class TravelController {
|
||||
}
|
||||
onBlockCoord = getActiveTravelBlock(player);
|
||||
boolean onBlock = onBlockCoord != null;
|
||||
showTargets = onBlock || isTravelItemActive(player);
|
||||
showTargets = onBlock || (isTravelItemActive(player, false) && !shouldHideTargets(player));
|
||||
if (showTargets) {
|
||||
updateSelectedTarget(player);
|
||||
} else {
|
||||
@@ -615,22 +525,34 @@ public class TravelController {
|
||||
return ((IItemOfTravel) equipped.getItem()).getEnergyStored(equipped);
|
||||
}
|
||||
|
||||
public boolean isTravelItemActive(EntityPlayer ep) {
|
||||
return getTravelItemTravelSource(ep) != null;
|
||||
public boolean isTravelItemActive(EntityPlayer ep, boolean checkInventoryAndBaubles) {
|
||||
return getTravelItemTravelSource(ep, checkInventoryAndBaubles) != null;
|
||||
}
|
||||
|
||||
/** Currently, we only hide travel targets for the teleport staff, in certain action modes. */
|
||||
public boolean shouldHideTargets(EntityPlayer ep) {
|
||||
if (getTravelItemTravelSource(ep, false) != TravelSource.TELEPORT_STAFF) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int action = ep.isSneaking() ? Config.teleportStaffSneakAction : Config.teleportStaffAction;
|
||||
return action < 2;
|
||||
}
|
||||
|
||||
/** Returns null if no travel item is in inventory/baubles. */
|
||||
@Nullable
|
||||
public TravelSource getTravelItemTravelSource(EntityPlayer ep) {
|
||||
public TravelSource getTravelItemTravelSource(EntityPlayer ep, boolean checkInventoryAndBaubles) {
|
||||
if (ep == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack equipped = ep.getCurrentEquippedItem();
|
||||
if (equipped == null || !(equipped.getItem() instanceof IItemOfTravel)) {
|
||||
equipped = findTravelItemInInventoryOrBaubles(ep);
|
||||
if (checkInventoryAndBaubles) {
|
||||
if (equipped == null || !(equipped.getItem() instanceof IItemOfTravel)
|
||||
|| !((IItemOfTravel) equipped.getItem()).isActive(ep, equipped)) {
|
||||
equipped = findTravelItemInInventoryOrBaubles(ep);
|
||||
}
|
||||
}
|
||||
|
||||
if (equipped != null) {
|
||||
if (equipped.getItem() instanceof ItemTeleportStaff) {
|
||||
if (((ItemTeleportStaff) equipped.getItem()).isActive(ep, equipped)) {
|
||||
@@ -656,7 +578,8 @@ public class TravelController {
|
||||
ItemStack travelItem = null;
|
||||
for (int i = 0; i < ep.inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = ep.inventory.getStackInSlot(i);
|
||||
if (stack != null && stack.getItem() instanceof IItemOfTravel) {
|
||||
if (stack != null && stack.getItem() instanceof IItemOfTravel
|
||||
&& ((IItemOfTravel) stack.getItem()).isActive(ep, stack)) {
|
||||
travelItem = stack;
|
||||
break;
|
||||
}
|
||||
@@ -667,7 +590,8 @@ public class TravelController {
|
||||
if (baubles != null) {
|
||||
for (int i = 0; i < baubles.getSizeInventory(); i++) {
|
||||
ItemStack stack = baubles.getStackInSlot(i);
|
||||
if (stack != null && stack.getItem() instanceof IItemOfTravel) {
|
||||
if (stack != null && stack.getItem() instanceof IItemOfTravel
|
||||
&& ((IItemOfTravel) stack.getItem()).isActive(ep, stack)) {
|
||||
travelItem = stack;
|
||||
break;
|
||||
}
|
||||
@@ -684,14 +608,15 @@ public class TravelController {
|
||||
* Baubles return value is unique/hacky, if <-1 return, then do the following to calculate the baubles slot:
|
||||
* "Math.abs(returnval)-2" <br>
|
||||
* Example: -3 return is Bauble slot 1, -2 return is Bauble slot 0
|
||||
*
|
||||
*
|
||||
* @return -1 if no travel item found. 0 or more if item found in inventory. -2 or less if item found in Baubles.
|
||||
*/
|
||||
public int findTravelItemSlotInInventoryOrBaubles(EntityPlayer ep) {
|
||||
int travelItemSlot = -1;
|
||||
for (int i = 0; i < ep.inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = ep.inventory.getStackInSlot(i);
|
||||
if (stack != null && (stack.getItem() instanceof IItemOfTravel)) {
|
||||
if (stack != null && stack.getItem() instanceof IItemOfTravel
|
||||
&& ((IItemOfTravel) stack.getItem()).isActive(ep, stack)) {
|
||||
travelItemSlot = i;
|
||||
break;
|
||||
}
|
||||
@@ -702,7 +627,8 @@ public class TravelController {
|
||||
if (baubles != null) {
|
||||
for (int i = 0; i < baubles.getSizeInventory(); i++) {
|
||||
ItemStack stack = baubles.getStackInSlot(i);
|
||||
if (stack != null && stack.getItem() instanceof IItemOfTravel) {
|
||||
if (stack != null && stack.getItem() instanceof IItemOfTravel
|
||||
&& ((IItemOfTravel) stack.getItem()).isActive(ep, stack)) {
|
||||
travelItemSlot = -(i + 2);
|
||||
break;
|
||||
}
|
||||
@@ -712,43 +638,201 @@ public class TravelController {
|
||||
return travelItemSlot;
|
||||
}
|
||||
|
||||
/** Finds the destination for the teleport staff super-teleport, or returns empty optional if unsuccessful. */
|
||||
public Optional<BlockCoord> findTeleportDestination(EntityPlayer player) {
|
||||
TravelSource source = TravelSource.TELEPORT_STAFF_BLINK;
|
||||
|
||||
Vector3d eye = Util.getEyePositionEio(player);
|
||||
Vector3d look = Util.getLookVecEio(player);
|
||||
|
||||
double playerHeight = player.yOffset;
|
||||
// +2 to compensate for the standard distance decrement of -2
|
||||
double teleDistance = Config.teleportStaffFailedBlinkDistance + 2;
|
||||
Vec3 eye3 = Vec3.createVectorHelper(eye.x, eye.y, eye.z);
|
||||
|
||||
// rayTraceBlocks has a limit of 200 distance.
|
||||
double maxDistance = Config.teleportStaffMaxBlinkDistance;
|
||||
double currDistance = 0;
|
||||
Vec3 pos = eye3;
|
||||
boolean loop = true;
|
||||
while (loop) {
|
||||
double distance = 200;
|
||||
if (maxDistance - currDistance < 200) {
|
||||
distance = maxDistance - currDistance;
|
||||
loop = false;
|
||||
}
|
||||
|
||||
Vector3d sample = new Vector3d(look);
|
||||
sample.scale(distance);
|
||||
sample.add(eye);
|
||||
Vec3 end = Vec3.createVectorHelper(sample.x, sample.y, sample.z);
|
||||
|
||||
MovingObjectPosition p = player.worldObj
|
||||
.rayTraceBlocks(pos, end, !Config.travelStaffBlinkThroughClearBlocksEnabled);
|
||||
if (p != null) {
|
||||
teleDistance = VecmathUtil.distance(eye, new Vector3d(p.blockX + 0.5, p.blockY + 0.5, p.blockZ + 0.5));
|
||||
break;
|
||||
}
|
||||
|
||||
pos = end;
|
||||
currDistance += distance;
|
||||
}
|
||||
|
||||
Vector3d sample = new Vector3d(look);
|
||||
sample.scale(Config.teleportStaffMaxBlinkDistance);
|
||||
sample.add(eye);
|
||||
Vec3 end = Vec3.createVectorHelper(sample.x, sample.y, sample.z);
|
||||
MovingObjectPosition p = player.worldObj
|
||||
.rayTraceBlocks(eye3, end, !Config.travelStaffBlinkThroughClearBlocksEnabled);
|
||||
if (p != null) {
|
||||
teleDistance = VecmathUtil.distance(eye, new Vector3d(p.blockX + 0.5, p.blockY + 0.5, p.blockZ + 0.5));
|
||||
}
|
||||
|
||||
double distanceIncrement = -2;
|
||||
int maxIter = Math.min(8, (int) teleDistance / 2);
|
||||
// Special case: if the targeted block is too close, we'll try to teleport through it.
|
||||
if (teleDistance < 4) {
|
||||
distanceIncrement = 0.5;
|
||||
maxIter = 32;
|
||||
}
|
||||
|
||||
for (int i = 0; i < maxIter; i++) {
|
||||
teleDistance += distanceIncrement;
|
||||
|
||||
sample.set(look);
|
||||
sample.scale(teleDistance);
|
||||
sample.add(eye);
|
||||
// we test against our feets location
|
||||
sample.y -= playerHeight;
|
||||
|
||||
Optional<BlockCoord> destinationOptional = findNearbyDestination(player, source, sample);
|
||||
if (destinationOptional.isPresent()) {
|
||||
return destinationOptional;
|
||||
}
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
/** Finds a long-distance travel anchor, or returns empty optional if unsuccessful. */
|
||||
public Optional<BlockCoord> findTravelDestination(EntityPlayer player, TravelSource source) {
|
||||
double maxDistance = source.getMaxDistanceTravelled();
|
||||
double maxMessageDistance = 1.25 * maxDistance;
|
||||
// Find possible destinations within about 5 degrees.
|
||||
RowSortedTable<Double, Double, BlockCoord> possibleDestinations = findBlocksWithinAngle(
|
||||
player,
|
||||
travelDestinations.get(player.worldObj.provider.dimensionId),
|
||||
0.087,
|
||||
maxMessageDistance);
|
||||
|
||||
for (Table.Cell<Double, Double, BlockCoord> cell : possibleDestinations.cellSet()) {
|
||||
if (cell.getColumnKey() <= maxDistance) {
|
||||
return Optional.of(cell.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if (!possibleDestinations.isEmpty()) {
|
||||
// We found at least one block within maxMessageDistance, but no blocks within maxDistance.
|
||||
showMessage(player, new ChatComponentTranslation("enderio.blockTravelPlatform.outOfRange"));
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
/** Finds a valid destination near the provided vector, or returns empty optional if unsuccessful. */
|
||||
private Optional<BlockCoord> findNearbyDestination(EntityPlayer player, TravelSource source, Vector3d sample) {
|
||||
Optional<BlockCoord> destinationOptional = findValidDestination(
|
||||
player,
|
||||
source,
|
||||
new BlockCoord((int) Math.floor(sample.x), (int) Math.floor(sample.y), (int) Math.floor(sample.z)));
|
||||
if (destinationOptional.isPresent()) {
|
||||
return destinationOptional;
|
||||
}
|
||||
|
||||
destinationOptional = findValidDestination(
|
||||
player,
|
||||
source,
|
||||
new BlockCoord((int) Math.floor(sample.x), (int) Math.floor(sample.y) + 1, (int) Math.floor(sample.z)));
|
||||
if (destinationOptional.isPresent()) {
|
||||
return destinationOptional;
|
||||
}
|
||||
|
||||
if (!Config.travelStaffSearchOptimize) {
|
||||
destinationOptional = findValidDestination(
|
||||
player,
|
||||
source,
|
||||
new BlockCoord(
|
||||
(int) Math.floor(sample.x),
|
||||
(int) Math.floor(sample.y) - 1,
|
||||
(int) Math.floor(sample.z)));
|
||||
if (destinationOptional.isPresent()) {
|
||||
return destinationOptional;
|
||||
}
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the provided position if it's valid, or returns empty optional if unsuccessful.
|
||||
*
|
||||
* <p>
|
||||
* To be precise: if the destination is a travel anchor or other block, then the returned coordinates will be one
|
||||
* block higher, to place the player on top of the block.
|
||||
*/
|
||||
public Optional<BlockCoord> findValidDestination(EntityPlayer player, TravelSource source, BlockCoord coord) {
|
||||
// Are we trying to travel to a block (anchor or telepad)?
|
||||
boolean travelToBlock = source != TravelSource.STAFF_BLINK && source != TravelSource.TELEPORT_STAFF_BLINK;
|
||||
|
||||
BlockCoord destination = coord;
|
||||
if (travelToBlock) {
|
||||
TileEntity te = player.worldObj.getTileEntity(coord.x, coord.y, coord.z);
|
||||
if (te instanceof ITravelAccessable) {
|
||||
ITravelAccessable ta = (ITravelAccessable) te;
|
||||
if (!ta.canBlockBeAccessed(player)) {
|
||||
showMessage(player, new ChatComponentTranslation("enderio.gui.travelAccessable.unauthorised"));
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
// We actually want to go on top of the block.
|
||||
destination = coord.getLocation(ForgeDirection.UP);
|
||||
}
|
||||
|
||||
if (!isInRangeTarget(player, destination, source.getMaxDistanceTravelledSq())) {
|
||||
if (travelToBlock) {
|
||||
showMessage(player, new ChatComponentTranslation("enderio.blockTravelPlatform.outOfRange"));
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
if (!isValidTarget(player, destination, source)) {
|
||||
if (travelToBlock) {
|
||||
showMessage(player, new ChatComponentTranslation("enderio.blockTravelPlatform.invalidTarget"));
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
return Optional.of(destination);
|
||||
}
|
||||
|
||||
public boolean travelToSelectedTarget(EntityPlayer player, TravelSource source, boolean conserveMomentum) {
|
||||
return travelToLocation(player, source, selectedCoord, conserveMomentum);
|
||||
}
|
||||
|
||||
public boolean travelToLocation(EntityPlayer player, TravelSource source, BlockCoord coord,
|
||||
boolean conserveMomentum) {
|
||||
|
||||
if (source != TravelSource.STAFF_BLINK && source != TravelSource.TELEPORT_STAFF_BLINK) {
|
||||
TileEntity te = player.worldObj.getTileEntity(coord.x, coord.y, coord.z);
|
||||
if (te instanceof ITravelAccessable) {
|
||||
ITravelAccessable ta = (ITravelAccessable) te;
|
||||
if (!ta.canBlockBeAccessed(player)) {
|
||||
showMessage(player, new ChatComponentTranslation("enderio.gui.travelAccessable.unauthorised"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Optional<BlockCoord> destinationOptional = findValidDestination(player, source, coord);
|
||||
if (!destinationOptional.isPresent()) {
|
||||
return false;
|
||||
}
|
||||
BlockCoord destination = destinationOptional.get();
|
||||
|
||||
int requiredPower = 0;
|
||||
requiredPower = getRequiredPower(player, source, coord);
|
||||
requiredPower = getRequiredPower(player, source, destination);
|
||||
if (requiredPower < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isInRangeTarget(player, coord, source.getMaxDistanceTravelledSq())) {
|
||||
if (source != TravelSource.STAFF_BLINK && source != TravelSource.TELEPORT_STAFF_BLINK) {
|
||||
showMessage(player, new ChatComponentTranslation("enderio.blockTravelPlatform.outOfRange"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (!isValidTarget(player, coord, source)) {
|
||||
if (source != TravelSource.STAFF_BLINK && source != TravelSource.TELEPORT_STAFF_BLINK) {
|
||||
showMessage(player, new ChatComponentTranslation("enderio.blockTravelPlatform.invalidTarget"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (doClientTeleport(player, coord, source, requiredPower, conserveMomentum)) {
|
||||
if (doClientTeleport(player, destinationOptional.get(), source, requiredPower, conserveMomentum)) {
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
player.worldObj.spawnParticle(
|
||||
"portal",
|
||||
@@ -763,8 +847,19 @@ public class TravelController {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isValidTarget(EntityPlayer player, BlockCoord bc, TravelSource source) {
|
||||
if (bc == null) {
|
||||
return false;
|
||||
}
|
||||
World w = player.worldObj;
|
||||
BlockCoord baseLoc = bc;
|
||||
|
||||
return canTeleportTo(player, source, baseLoc, w)
|
||||
&& canTeleportTo(player, source, baseLoc.getLocation(ForgeDirection.UP), w);
|
||||
}
|
||||
|
||||
public int getRequiredPower(EntityPlayer player, TravelSource source, BlockCoord coord) {
|
||||
if (!isTravelItemActive(player)) {
|
||||
if (!isTravelItemActive(player, true)) {
|
||||
return 0;
|
||||
}
|
||||
int requiredPower;
|
||||
@@ -807,21 +902,6 @@ public class TravelController {
|
||||
return Math.sqrt(getDistanceSquared(player, coord));
|
||||
}
|
||||
|
||||
private boolean isValidTarget(EntityPlayer player, BlockCoord bc, TravelSource source) {
|
||||
if (bc == null) {
|
||||
return false;
|
||||
}
|
||||
World w = player.worldObj;
|
||||
BlockCoord baseLoc = bc;
|
||||
if (source != TravelSource.STAFF_BLINK && source != TravelSource.TELEPORT_STAFF_BLINK) {
|
||||
// targeting a block so go one up
|
||||
baseLoc = bc.getLocation(ForgeDirection.UP);
|
||||
}
|
||||
|
||||
return canTeleportTo(player, source, baseLoc, w)
|
||||
&& canTeleportTo(player, source, baseLoc.getLocation(ForgeDirection.UP), w);
|
||||
}
|
||||
|
||||
private boolean canTeleportTo(EntityPlayer player, TravelSource source, BlockCoord bc, World w) {
|
||||
if (bc.y < 1) {
|
||||
return false;
|
||||
@@ -903,6 +983,7 @@ public class TravelController {
|
||||
if (selectedBlock instanceof ITravelAccessable) {
|
||||
ITravelAccessable travelBlock = (ITravelAccessable) selectedBlock;
|
||||
BlockCoord targetBlock = new BlockCoord(currentBlock.x, y, currentBlock.z);
|
||||
BlockCoord destination = targetBlock.getLocation(ForgeDirection.UP);
|
||||
|
||||
if (Config.travelAnchorSkipWarning) {
|
||||
if (travelBlock.getRequiresPassword(player)) {
|
||||
@@ -913,55 +994,67 @@ public class TravelController {
|
||||
&& !travelBlock.canUiBeAccessed(player)) {
|
||||
showMessage(player, new ChatComponentTranslation("enderio.gui.travelAccessable.skipPrivate"));
|
||||
}
|
||||
if (!isValidTarget(player, targetBlock, TravelSource.BLOCK)) {
|
||||
if (!isValidTarget(player, destination, TravelSource.BLOCK)) {
|
||||
showMessage(player, new ChatComponentTranslation("enderio.gui.travelAccessable.skipObstructed"));
|
||||
}
|
||||
}
|
||||
if (travelBlock.canBlockBeAccessed(player) && isValidTarget(player, targetBlock, TravelSource.BLOCK)) {
|
||||
if (travelBlock.canBlockBeAccessed(player) && isValidTarget(player, destination, TravelSource.BLOCK)) {
|
||||
return targetBlock;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a row-sorted table with angle in radians as the row, distance as the column, and block coordinate as the
|
||||
* value, holding all blocks which lie within the specified viewing angle and distance.
|
||||
*
|
||||
* <p>
|
||||
* The table is sorted by angle ascending, so the smallest angle will be first.
|
||||
*
|
||||
* @param player The player to search from.
|
||||
* @param blocks The blocks to search through.
|
||||
* @param maxAngle The maximum allowed angle, in radians.
|
||||
* @param maxDistance The maximum allowed distance.
|
||||
*/
|
||||
private RowSortedTable<Double, Double, BlockCoord> findBlocksWithinAngle(EntityPlayer player,
|
||||
Iterable<BlockCoord> blocks, double maxAngle, double maxDistance) {
|
||||
Vector3d eye = Util.getEyePositionEio(player);
|
||||
Vector3d look = Util.getLookVecEio(player);
|
||||
|
||||
// Table of angle, distance, and block coordinate holding found blocks.
|
||||
// Angle is the row, so this table will automatically be sorted by angle ascending.
|
||||
RowSortedTable<Double, Double, BlockCoord> foundBlocks = TreeBasedTable.create();
|
||||
|
||||
for (BlockCoord p : blocks) {
|
||||
Vector3d block = new Vector3d(p.x + 0.5, p.y + 0.5, p.z + 0.5);
|
||||
block.sub(eye);
|
||||
double distance = block.length();
|
||||
if (distance > maxDistance) {
|
||||
continue;
|
||||
}
|
||||
block.normalize();
|
||||
|
||||
double angle = Math.acos(look.dot(block));
|
||||
if (angle <= maxAngle) {
|
||||
foundBlocks.put(angle, distance, p);
|
||||
}
|
||||
}
|
||||
|
||||
return foundBlocks;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void updateSelectedTarget(EntityPlayer player) {
|
||||
selectedCoord = null;
|
||||
if (candidates.isEmpty()) {
|
||||
selectedCoord = null;
|
||||
return;
|
||||
}
|
||||
|
||||
double closestDistance = Double.MAX_VALUE;
|
||||
for (BlockCoord bc : candidates.keySet()) {
|
||||
if (!bc.equals(onBlockCoord)) {
|
||||
|
||||
double d = addRatio(bc);
|
||||
if (d < closestDistance) {
|
||||
selectedCoord = bc;
|
||||
closestDistance = d;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedCoord != null) {
|
||||
|
||||
Vector3d blockCenter = new Vector3d(selectedCoord.x + 0.5, selectedCoord.y + 0.5, selectedCoord.z + 0.5);
|
||||
Vector2d blockCenterPixel = currentView.getScreenPoint(blockCenter);
|
||||
|
||||
Vector2d screenMidPixel = new Vector2d(
|
||||
Minecraft.getMinecraft().displayWidth,
|
||||
Minecraft.getMinecraft().displayHeight);
|
||||
screenMidPixel.scale(0.5);
|
||||
|
||||
double pixDist = blockCenterPixel.distance(screenMidPixel);
|
||||
double rat = pixDist / Minecraft.getMinecraft().displayHeight;
|
||||
if (rat != rat) {
|
||||
rat = 0;
|
||||
}
|
||||
if (rat > 0.07) {
|
||||
selectedCoord = null;
|
||||
}
|
||||
}
|
||||
// Find the nearest travel anchor within roughly 10 degrees.
|
||||
Optional<BlockCoord> selectedBlock = findBlocksWithinAngle(player, candidates.keySet(), 0.175, Double.MAX_VALUE)
|
||||
.values().stream().findFirst();
|
||||
selectedCoord = selectedBlock.orElse(null);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -1063,7 +1156,7 @@ public class TravelController {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private int getMaxTravelDistanceSqForPlayer(EntityPlayer player) {
|
||||
TravelSource source = getTravelItemTravelSource(player);
|
||||
TravelSource source = getTravelItemTravelSource(player, false);
|
||||
if (source == null) {
|
||||
return TravelSource.BLOCK.getMaxDistanceTravelledSq();
|
||||
}
|
||||
@@ -1100,19 +1193,15 @@ public class TravelController {
|
||||
}
|
||||
|
||||
public static void showMessage(EntityPlayer player, IChatComponent chatComponent) {
|
||||
if (Loader.isModLoaded("gtnhlib")) {
|
||||
if (player instanceof EntityPlayerMP) {
|
||||
chatComponent.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.WHITE));
|
||||
GTNHLib.proxy.sendMessageAboveHotbar((EntityPlayerMP) player, chatComponent, 60, true, true);
|
||||
} else {
|
||||
GTNHLib.proxy.printMessageAboveHotbar(
|
||||
EnumChatFormatting.WHITE + chatComponent.getFormattedText(),
|
||||
60,
|
||||
true,
|
||||
true);
|
||||
}
|
||||
if (player instanceof EntityPlayerMP) {
|
||||
chatComponent.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.WHITE));
|
||||
GTNHLib.proxy.sendMessageAboveHotbar((EntityPlayerMP) player, chatComponent, 60, true, true);
|
||||
} else {
|
||||
player.addChatComponentMessage(chatComponent);
|
||||
GTNHLib.proxy.printMessageAboveHotbar(
|
||||
EnumChatFormatting.WHITE + chatComponent.getFormattedText(),
|
||||
60,
|
||||
true,
|
||||
true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -337,6 +337,9 @@ public class TileTravelAnchor extends TileEntityEio implements ITravelAccessable
|
||||
public void validate() {
|
||||
super.validate();
|
||||
if (isTravelSource()) {
|
||||
// Note: travelDestinations is a SetMultimap, which does not allow duplicate entries.
|
||||
// So it's okay if this gets called multiple times with the same BlockCoord.
|
||||
// Though, I think that it's not currently getting called multiple times, anyway.
|
||||
TravelController.instance.travelDestinations.put(worldObj.provider.dimensionId, getLocation());
|
||||
}
|
||||
}
|
||||
@@ -346,10 +349,4 @@ public class TileTravelAnchor extends TileEntityEio implements ITravelAccessable
|
||||
super.invalidate();
|
||||
TravelController.instance.travelDestinations.remove(worldObj.provider.dimensionId, getLocation());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
super.onChunkUnload();
|
||||
TravelController.instance.travelDestinations.remove(worldObj.provider.dimensionId, getLocation());
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,6 @@ public class TravelEntitySpecialRenderer extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
|
||||
|
||||
if (!TravelController.instance.showTargets()) {
|
||||
return;
|
||||
}
|
||||
@@ -65,11 +64,14 @@ public class TravelEntitySpecialRenderer extends TileEntitySpecialRenderer {
|
||||
if (!ta.canSeeBlock(Minecraft.getMinecraft().thePlayer)) {
|
||||
return;
|
||||
}
|
||||
final CubeRenderer cr = CubeRenderer.get();
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
Vector3d eye = Util.getEyePositionEio(Minecraft.getMinecraft().thePlayer);
|
||||
Vector3d loc = new Vector3d(tileentity.xCoord + 0.5, tileentity.yCoord + 0.5, tileentity.zCoord + 0.5);
|
||||
double maxDistance = TravelSource.BLOCK.getMaxDistanceTravelledSq();
|
||||
TravelSource source = TravelController.instance.getTravelItemTravelSource(Minecraft.getMinecraft().thePlayer);
|
||||
TravelSource source = TravelController.instance
|
||||
.getTravelItemTravelSource(Minecraft.getMinecraft().thePlayer, false);
|
||||
if (source != null) {
|
||||
maxDistance = source.getMaxDistanceTravelledSq();
|
||||
}
|
||||
@@ -101,20 +103,20 @@ public class TravelEntitySpecialRenderer extends TileEntitySpecialRenderer {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
tessellator.startDrawingQuads();
|
||||
renderBlock(tileentity.getWorldObj(), sf);
|
||||
Tessellator.instance.draw();
|
||||
tessellator.draw();
|
||||
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
Tessellator.instance.setBrightness(15 << 20 | 15 << 4);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setBrightness(15 << 20 | 15 << 4);
|
||||
if (TravelController.instance.isBlockSelected(bc)) {
|
||||
Tessellator.instance.setColorRGBA_F(selectedColor.x, selectedColor.y, selectedColor.z, selectedColor.w);
|
||||
CubeRenderer.render(BoundingBox.UNIT_CUBE.scale(sf + 0.05, sf + 0.05, sf + 0.05), getSelectedIcon());
|
||||
tessellator.setColorRGBA_F(selectedColor.x, selectedColor.y, selectedColor.z, selectedColor.w);
|
||||
cr.render(BoundingBox.UNIT_CUBE.scale(sf + 0.05, sf + 0.05, sf + 0.05), getSelectedIcon());
|
||||
} else {
|
||||
Tessellator.instance.setColorRGBA_F(highlightColor.x, highlightColor.y, highlightColor.z, highlightColor.w);
|
||||
CubeRenderer.render(BoundingBox.UNIT_CUBE.scale(sf + 0.05, sf + 0.05, sf + 0.05), getHighlightIcon());
|
||||
tessellator.setColorRGBA_F(highlightColor.x, highlightColor.y, highlightColor.z, highlightColor.w);
|
||||
cr.render(BoundingBox.UNIT_CUBE.scale(sf + 0.05, sf + 0.05, sf + 0.05), getHighlightIcon());
|
||||
}
|
||||
Tessellator.instance.draw();
|
||||
tessellator.draw();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
renderLabel(tileentity, x, y, z, ta, sf);
|
||||
@@ -199,7 +201,7 @@ public class TravelEntitySpecialRenderer extends TileEntitySpecialRenderer {
|
||||
|
||||
protected void renderBlock(IBlockAccess world, double sf) {
|
||||
Tessellator.instance.setColorRGBA_F(1, 1, 1, 0.75f);
|
||||
CubeRenderer.render(BoundingBox.UNIT_CUBE.scale(sf, sf, sf), EnderIO.blockTravelPlatform.getIcon(0, 0));
|
||||
CubeRenderer.get().render(BoundingBox.UNIT_CUBE.scale(sf, sf, sf), EnderIO.blockTravelPlatform.getIcon(0, 0));
|
||||
}
|
||||
|
||||
public Vector4f getSelectedColor() {
|
||||
|
||||
+107
-33
@@ -7,7 +7,10 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.play.server.S12PacketEntityVelocity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import com.enderio.core.common.util.Util;
|
||||
@@ -18,6 +21,7 @@ import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import crazypants.enderio.Log;
|
||||
import crazypants.enderio.api.teleport.IItemOfTravel;
|
||||
import crazypants.enderio.api.teleport.ITravelAccessable;
|
||||
import crazypants.enderio.api.teleport.TeleportEntityEvent;
|
||||
import crazypants.enderio.api.teleport.TravelSource;
|
||||
import crazypants.enderio.teleport.ItemTeleportStaff;
|
||||
@@ -30,13 +34,27 @@ public class PacketLongDistanceTravelEvent
|
||||
boolean conserveMotion;
|
||||
int entityId;
|
||||
int source;
|
||||
// Below values are for also attempting a regular blink if the long-distance anchor check fails.
|
||||
boolean alsoDoTeleport;
|
||||
int tpX;
|
||||
int tpY;
|
||||
int tpZ;
|
||||
|
||||
public PacketLongDistanceTravelEvent() {}
|
||||
|
||||
public PacketLongDistanceTravelEvent(Entity entity, boolean conserveMotion, TravelSource source) {
|
||||
this(entity, conserveMotion, source, false, 0, 0, 0);
|
||||
}
|
||||
|
||||
public PacketLongDistanceTravelEvent(Entity entity, boolean conserveMotion, TravelSource source,
|
||||
boolean alsoDoTeleport, int tpX, int tpY, int tpZ) {
|
||||
this.conserveMotion = conserveMotion;
|
||||
this.entityId = entity instanceof EntityPlayer ? -1 : entity.getEntityId();
|
||||
this.source = source.ordinal();
|
||||
this.alsoDoTeleport = alsoDoTeleport;
|
||||
this.tpX = tpX;
|
||||
this.tpY = tpY;
|
||||
this.tpZ = tpZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -44,6 +62,10 @@ public class PacketLongDistanceTravelEvent
|
||||
buf.writeBoolean(conserveMotion);
|
||||
buf.writeInt(entityId);
|
||||
buf.writeInt(source);
|
||||
buf.writeBoolean(alsoDoTeleport);
|
||||
buf.writeInt(tpX);
|
||||
buf.writeInt(tpY);
|
||||
buf.writeInt(tpZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -51,6 +73,10 @@ public class PacketLongDistanceTravelEvent
|
||||
conserveMotion = buf.readBoolean();
|
||||
entityId = buf.readInt();
|
||||
source = buf.readInt();
|
||||
alsoDoTeleport = buf.readBoolean();
|
||||
tpX = buf.readInt();
|
||||
tpY = buf.readInt();
|
||||
tpZ = buf.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,7 +95,14 @@ public class PacketLongDistanceTravelEvent
|
||||
|
||||
TravelSource source = TravelSource.values()[message.source];
|
||||
|
||||
if (!validate(toTp, source)) {
|
||||
if (!validate(
|
||||
toTp,
|
||||
source,
|
||||
message.conserveMotion,
|
||||
message.alsoDoTeleport,
|
||||
message.tpX,
|
||||
message.tpY,
|
||||
message.tpZ)) {
|
||||
Log.LOGGER.warn(
|
||||
Log.securityMarker,
|
||||
"Player {} tried to tp without valid prereq.",
|
||||
@@ -77,35 +110,82 @@ public class PacketLongDistanceTravelEvent
|
||||
return null;
|
||||
}
|
||||
|
||||
doServerTeleport(toTp, message.conserveMotion, source);
|
||||
doServerTeleport(
|
||||
toTp,
|
||||
message.conserveMotion,
|
||||
source,
|
||||
message.alsoDoTeleport,
|
||||
message.tpX,
|
||||
message.tpY,
|
||||
message.tpZ);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean validate(EntityPlayerMP toTp, TravelSource source) {
|
||||
private static boolean validate(EntityPlayerMP toTp, TravelSource source, boolean conserveMotion,
|
||||
boolean alsoDoTeleport, int tpX, int tpY, int tpZ) {
|
||||
ItemStack equippedItem = toTp.getCurrentEquippedItem();
|
||||
switch (source) {
|
||||
case STAFF:
|
||||
// Not allowed to do teleport staff teleport with regular staff.
|
||||
if (alsoDoTeleport) {
|
||||
return false;
|
||||
}
|
||||
return equippedItem != null && equippedItem.getItem() instanceof IItemOfTravel
|
||||
&& ((IItemOfTravel) equippedItem.getItem()).isActive(toTp, equippedItem);
|
||||
case TELEPORT_STAFF:
|
||||
// tp staff is creative version of traveling staff
|
||||
// no energy check or anything else needed
|
||||
// but the player must actually be equipped with one of these
|
||||
if (alsoDoTeleport) {
|
||||
String error = TravelController.instance
|
||||
.validatePacketTravelEvent(toTp, tpX, tpY, tpZ, 0, conserveMotion, source);
|
||||
if (error != null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return equippedItem != null && equippedItem.getItem() instanceof ItemTeleportStaff;
|
||||
|
||||
default:
|
||||
// all other types are not allowed
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean doServerTeleport(Entity toTp, boolean conserveMotion, TravelSource source) {
|
||||
EntityPlayer player = toTp instanceof EntityPlayer ? (EntityPlayer) toTp : null;
|
||||
Optional<BlockCoord> travelDestination = TravelController.instance.findTravelDestination(player, source);
|
||||
if (!travelDestination.isPresent()) {
|
||||
public static boolean doServerTeleport(Entity toTp, boolean conserveMotion, TravelSource source,
|
||||
boolean alsoDoTeleport, int tpX, int tpY, int tpZ) {
|
||||
if (!(toTp instanceof EntityPlayer)) {
|
||||
return false;
|
||||
}
|
||||
BlockCoord destination = travelDestination.get();
|
||||
EntityPlayer player = (EntityPlayer) toTp;
|
||||
|
||||
Optional<BlockCoord> travelDestination = TravelController.instance.findTravelDestination(player, source);
|
||||
if (!travelDestination.isPresent()) {
|
||||
if (alsoDoTeleport) {
|
||||
return PacketTravelEvent.doServerTeleport(toTp, tpX, tpY, tpZ, 0, conserveMotion, source);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockCoord targetBlock = travelDestination.get();
|
||||
TileEntity te = player.worldObj.getTileEntity(targetBlock.x, targetBlock.y, targetBlock.z);
|
||||
if (te instanceof ITravelAccessable) {
|
||||
ITravelAccessable ta = (ITravelAccessable) te;
|
||||
if (!ta.canBlockBeAccessed(player)) {
|
||||
TravelController
|
||||
.showMessage(player, new ChatComponentTranslation("enderio.gui.travelAccessable.unauthorised"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// We're teleporting to a block, so go one above.
|
||||
BlockCoord destination = targetBlock.getLocation(ForgeDirection.UP);
|
||||
if (!TravelController.instance.isValidTarget(player, destination, source)) {
|
||||
TravelController
|
||||
.showMessage(player, new ChatComponentTranslation("enderio.blockTravelPlatform.invalidTarget"));
|
||||
return false;
|
||||
}
|
||||
|
||||
int x = destination.x;
|
||||
int y = destination.y;
|
||||
int z = destination.z;
|
||||
@@ -113,7 +193,7 @@ public class PacketLongDistanceTravelEvent
|
||||
if (powerUse < 0) {
|
||||
return false;
|
||||
}
|
||||
if (player != null && player.getCurrentEquippedItem() != null
|
||||
if (player.getCurrentEquippedItem() != null
|
||||
&& player.getCurrentEquippedItem().getItem() instanceof IItemOfTravel) {
|
||||
int used = ((IItemOfTravel) player.getCurrentEquippedItem().getItem())
|
||||
.canExtractInternal(player.getCurrentEquippedItem(), powerUse);
|
||||
@@ -134,32 +214,26 @@ public class PacketLongDistanceTravelEvent
|
||||
|
||||
toTp.playSound(source.sound, 1.0F, 1.0F);
|
||||
|
||||
if (player != null) {
|
||||
player.setPositionAndUpdate(x + 0.5, y + 1.1, z + 0.5);
|
||||
} else {
|
||||
toTp.setPosition(x, y, z);
|
||||
player.setPositionAndUpdate(x + 0.5, y + 0.1, z + 0.5);
|
||||
|
||||
player.worldObj.playSoundEffect(x, y, z, source.sound, 1.0F, 1.0F);
|
||||
player.fallDistance = 0;
|
||||
|
||||
if (conserveMotion) {
|
||||
Vector3d velocityVex = Util.getLookVecEio(player);
|
||||
S12PacketEntityVelocity p = new S12PacketEntityVelocity(
|
||||
toTp.getEntityId(),
|
||||
velocityVex.x,
|
||||
velocityVex.y,
|
||||
velocityVex.z);
|
||||
((EntityPlayerMP) player).playerNetServerHandler.sendPacket(p);
|
||||
}
|
||||
|
||||
toTp.worldObj.playSoundEffect(x, y, z, source.sound, 1.0F, 1.0F);
|
||||
toTp.fallDistance = 0;
|
||||
|
||||
if (player != null) {
|
||||
if (conserveMotion) {
|
||||
Vector3d velocityVex = Util.getLookVecEio(player);
|
||||
S12PacketEntityVelocity p = new S12PacketEntityVelocity(
|
||||
toTp.getEntityId(),
|
||||
velocityVex.x,
|
||||
velocityVex.y,
|
||||
velocityVex.z);
|
||||
((EntityPlayerMP) player).playerNetServerHandler.sendPacket(p);
|
||||
}
|
||||
|
||||
if (powerUse > 0 && player.getCurrentEquippedItem() != null
|
||||
&& player.getCurrentEquippedItem().getItem() instanceof IItemOfTravel) {
|
||||
ItemStack item = player.getCurrentEquippedItem().copy();
|
||||
((IItemOfTravel) item.getItem()).extractInternal(item, powerUse);
|
||||
toTp.setCurrentItemOrArmor(0, item);
|
||||
}
|
||||
if (powerUse > 0 && player.getCurrentEquippedItem() != null
|
||||
&& player.getCurrentEquippedItem().getItem() instanceof IItemOfTravel) {
|
||||
ItemStack item = player.getCurrentEquippedItem().copy();
|
||||
((IItemOfTravel) item.getItem()).extractInternal(item, powerUse);
|
||||
toTp.setCurrentItemOrArmor(0, item);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -118,7 +118,7 @@ public class PacketTravelEvent implements IMessage, IMessageHandler<PacketTravel
|
||||
toTp.playSound(source.sound, 1.0F, 1.0F);
|
||||
|
||||
if (player != null) {
|
||||
player.setPositionAndUpdate(x + 0.5, y + 1.1, z + 0.5);
|
||||
player.setPositionAndUpdate(x + 0.5, y + 0.1, z + 0.5);
|
||||
} else {
|
||||
toTp.setPosition(x, y, z);
|
||||
}
|
||||
|
||||
@@ -92,8 +92,9 @@ public class TelePadRenderer extends TechneModelRenderer {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
CubeRenderer.render(block, metadata);
|
||||
Tessellator.instance.draw();
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
CubeRenderer.get().render(block, metadata);
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
@@ -82,7 +82,7 @@ public class TelePadSpecialRenderer extends TravelEntitySpecialRenderer {
|
||||
@Override
|
||||
protected void renderBlock(IBlockAccess world, double sf) {
|
||||
Tessellator.instance.setColorRGBA_F(1, 1, 1, 0.75f);
|
||||
CubeRenderer.render(BoundingBox.UNIT_CUBE.scale(sf, sf, sf), EnderIO.blockTelePad.getHighlightIcon());
|
||||
CubeRenderer.get().render(BoundingBox.UNIT_CUBE.scale(sf, sf, sf), EnderIO.blockTelePad.getHighlightIcon());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -140,30 +140,24 @@ public class WailaCompat implements IWailaDataProvider {
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
MovingObjectPosition pos = accessor.getPosition();
|
||||
if (config.getConfig("facades.hidden")) {
|
||||
if (accessor.getBlock() instanceof IFacade) {
|
||||
// If facades are hidden, we need to ignore it
|
||||
if (accessor.getTileEntity() instanceof IConduitBundle && ConduitUtil
|
||||
.isFacadeHidden((IConduitBundle) accessor.getTileEntity(), accessor.getPlayer())) {
|
||||
return null;
|
||||
}
|
||||
IFacade bundle = (IFacade) accessor.getBlock();
|
||||
Block facade = bundle.getFacade(
|
||||
accessor.getWorld(),
|
||||
if (config.getConfig("facades.hidden") && accessor.getBlock() instanceof IFacade) {
|
||||
// If facades are hidden, we need to ignore it
|
||||
if (accessor.getTileEntity() instanceof IConduitBundle
|
||||
&& ConduitUtil.isFacadeHidden((IConduitBundle) accessor.getTileEntity(), accessor.getPlayer())) {
|
||||
return null;
|
||||
}
|
||||
IFacade bundle = (IFacade) accessor.getBlock();
|
||||
Block facade = bundle
|
||||
.getFacade(accessor.getWorld(), pos.blockX, pos.blockY, pos.blockZ, accessor.getSide().ordinal());
|
||||
if (facade != accessor.getBlock()) {
|
||||
ItemStack ret = facade.getPickBlock(
|
||||
pos,
|
||||
new WailaWorldWrapper(accessor.getWorld()),
|
||||
pos.blockX,
|
||||
pos.blockY,
|
||||
pos.blockZ,
|
||||
accessor.getSide().ordinal());
|
||||
if (facade != accessor.getBlock()) {
|
||||
ItemStack ret = facade.getPickBlock(
|
||||
pos,
|
||||
new WailaWorldWrapper(accessor.getWorld()),
|
||||
pos.blockX,
|
||||
pos.blockY,
|
||||
pos.blockZ,
|
||||
accessor.getPlayer());
|
||||
return ret;
|
||||
}
|
||||
accessor.getPlayer());
|
||||
return ret;
|
||||
}
|
||||
} else if (accessor.getBlock() instanceof BlockDarkSteelAnvil) {
|
||||
return accessor.getBlock().getPickBlock(
|
||||
@@ -350,14 +344,13 @@ public class WailaCompat implements IWailaDataProvider {
|
||||
} else if (itemStack.getItem() == EnderIO.itemMEConduit) {
|
||||
NBTTagCompound nbtRoot = accessor.getNBTData();
|
||||
if (nbtRoot.hasKey("isDense")) {
|
||||
boolean isDenseUltra = nbtRoot.getBoolean("isDenseUltra");
|
||||
boolean isDense = nbtRoot.getBoolean("isDense");
|
||||
int channelsInUse = nbtRoot.getInteger("channelsInUse");
|
||||
currenttip.add(
|
||||
MessageFormat.format(
|
||||
EnderIO.lang.localize("itemMEConduit.channelsUsed"),
|
||||
channelsInUse,
|
||||
isDenseUltra ? 128 : (isDense ? 32 : 8)));
|
||||
isDense ? 32 : 8));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -393,7 +386,6 @@ public class WailaCompat implements IWailaDataProvider {
|
||||
if (mec != null) {
|
||||
tag.setInteger("channelsInUse", mec.getChannelsInUse());
|
||||
tag.setBoolean("isDense", mec.isDense());
|
||||
tag.setBoolean("isDenseUltra", mec.isDenseUltra());
|
||||
}
|
||||
} else if (te instanceof IInternalPoweredTile) {
|
||||
IInternalPoweredTile ipte = (IInternalPoweredTile) te;
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package crazypants.util;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.client.particle.EntityPortalFX;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
@@ -47,18 +51,35 @@ public class ClientUtil {
|
||||
con.readFromNBT(pkt.tc, TileConduitBundle.NBT_VERSION);
|
||||
}
|
||||
|
||||
public static void spawnFarmParcticles(Random rand, BlockCoord bc) {
|
||||
double xOff = 0.5 + (rand.nextDouble() - 0.5) * 1.1;
|
||||
double yOff = 0.5 + (rand.nextDouble() - 0.5) * 0.2;
|
||||
double zOff = 0.5 + (rand.nextDouble() - 0.5) * 1.1;
|
||||
Minecraft.getMinecraft().theWorld.spawnParticle(
|
||||
"portal",
|
||||
bc.x + xOff,
|
||||
bc.y + yOff,
|
||||
bc.z + zOff,
|
||||
(rand.nextDouble() - 0.5) * 1.5,
|
||||
-rand.nextDouble(),
|
||||
(rand.nextDouble() - 0.5) * 1.5);
|
||||
public static void spawnFarmParticles(Random rand, List<BlockCoord> coords, int particlesCount) {
|
||||
// 0 = All, 1 = Decreased, 2 = Minimal
|
||||
int particleSetting = Minecraft.getMinecraft().gameSettings.particleSetting;
|
||||
if (particleSetting >= 2 /* Minimal */) {
|
||||
return;
|
||||
}
|
||||
|
||||
int particles = particleSetting == 0 ? particlesCount /* All */
|
||||
: (particlesCount / 2) /* Decreased */;
|
||||
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
EffectRenderer effectRenderer = Minecraft.getMinecraft().effectRenderer;
|
||||
|
||||
for (BlockCoord bc : coords) {
|
||||
for (int i = 0; i < particles; i++) {
|
||||
double xOff = 0.5 + (rand.nextDouble() - 0.5) * 1.1;
|
||||
double yOff = 0.5 + (rand.nextDouble() - 0.5) * 0.2;
|
||||
double zOff = 0.5 + (rand.nextDouble() - 0.5) * 1.1;
|
||||
effectRenderer.addEffect(
|
||||
new EntityPortalFX(
|
||||
world,
|
||||
bc.x + xOff,
|
||||
bc.y + yOff,
|
||||
bc.z + zOff,
|
||||
(rand.nextDouble() - 0.5) * 1.5,
|
||||
-rand.nextDouble(),
|
||||
(rand.nextDouble() - 0.5) * 1.5));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void setTankNBT(PacketCombustionTank message, int x, int y, int z) {
|
||||
|
||||
@@ -130,7 +130,6 @@ enderio.itemGasConduit.tooltip.detailed.line1=Transportiert Mekanism-kompatible
|
||||
|
||||
enderio.itemMEConduit.name=ME-Leitung
|
||||
enderio.itemMEConduitDense.name=Dichte ME-Leitung
|
||||
enderio.itemMEConduitDenseUltra.name=Extrem Dichte ME-Leitungen
|
||||
enderio.itemMEConduit.channelsUsed={0,number} von {1,number} Kanälen
|
||||
|
||||
enderio.itemOCConduit.name=Netzwerkleitung (OC)
|
||||
|
||||
@@ -136,7 +136,6 @@ enderio.itemGasConduit.tooltip.detailed.line1=Transfers Mekanism-compatible gase
|
||||
|
||||
enderio.itemMEConduit.name=ME Conduit
|
||||
enderio.itemMEConduitDense.name=Dense ME Conduit
|
||||
enderio.itemMEConduitDenseUltra.name=Ultra Dense ME Conduit
|
||||
enderio.itemMEConduit.channelsUsed={0,number} of {1,number} Channels
|
||||
|
||||
enderio.itemOCConduit.name=Network Conduit (OC)
|
||||
@@ -150,7 +149,7 @@ enderio.silicon.name=Silicon
|
||||
enderio.conduitBinder.name=Conduit Binder
|
||||
enderio.binderComposite.name=Binder Composite
|
||||
enderio.phasedIronNugget.name=Pulsating Iron Nugget
|
||||
tile.blockDarkIronBars.name=Dark Iron Bars
|
||||
tile.blockDarkIronBars.name=Dark Steel Bars
|
||||
tile.blockSoulariumBars.name=Soularium Bars
|
||||
tile.blockEndSteelBars.name=End Steel Bars
|
||||
tile.blockEndermanSkull.name=Enderman Skull
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 731 B |
Binary file not shown.
|
Before Width: | Height: | Size: 298 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.9 KiB |
Reference in new issue
Block a user