mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-15 09:34:50 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4373ebe5c | ||
|
|
f91de79376 | ||
|
|
567cd3e78b | ||
|
|
84e23b3e8e | ||
|
|
eba2bf1f86 | ||
|
|
47bd83e29e | ||
|
|
f7b49fccdd |
No files matched your search
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
RUNDIR="run"
|
||||
CRASH="crash-reports"
|
||||
SERVERLOG="server.log"
|
||||
|
||||
if [[ -d $RUNDIR/$CRASH ]]; then
|
||||
echo "Crash reports detected:"
|
||||
cat $RUNDIR/$CRASH/crash*.txt
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep --quiet "Fatal errors were detected" $SERVERLOG; then
|
||||
echo "Fatal errors detected:"
|
||||
cat server.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep --quiet "The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED" $SERVERLOG; then
|
||||
echo "Server force stopped:"
|
||||
cat server.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! grep --quiet -Po '.+Done \(.+\)\! For help, type "help" or "\?"' $SERVERLOG; then
|
||||
echo "Server didn't finish startup:"
|
||||
cat server.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "No crash reports detected"
|
||||
exit 0
|
||||
|
||||
+1547
-3
File diff suppressed because it is too large.
Load diff
+15
-18
@@ -1,28 +1,25 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:EnderCore:0.4.6:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.9.7:dev')
|
||||
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.6.14-GTNH:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.3.2:dev")
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.39:dev')
|
||||
api('com.github.GTNewHorizons:EnderCore:0.2.13:dev')
|
||||
implementation('com.github.GTNewHorizons:ForestryMC:4.6.5:dev')
|
||||
implementation('com.github.GTNewHorizons:NotEnoughItems:2.3.45-GTNH:dev')
|
||||
implementation("com.github.GTNewHorizons:GTNHLib:0.0.13:dev")
|
||||
api('com.github.GTNewHorizons:BuildCraft:7.1.33: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.8.1:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-405-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Baubles:1.0.4:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.48.68:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.15.8:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.13.5-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Chisel:2.15.1-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.10.11-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.5.24:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-195-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Baubles:1.0.1.14:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.14.1:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.11.13-GTNH:api') {transitive = false}
|
||||
implementation('com.github.GTNewHorizons:Chisel:2.10.17-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.9.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-alpha52:api') {transitive = false}
|
||||
compileOnly(deobf('https://media.forgecdn.net/files/2269/339/ComputerCraft1.75.jar')) // https://www.curseforge.com/minecraft/mc-mods/computercraft/files/2269339
|
||||
compileOnly(deobf('https://media.forgecdn.net/files/2426/270/Mekanism-1.7.10-9.1.0.281.jar')) // https://aidancbrady.com/mekanism/download/
|
||||
compileOnly(deobf('https://immibis.com/mcmoddl/files/immibis-microblocks-59.1.2.jar'))
|
||||
}
|
||||
+27
-149
@@ -1,104 +1,63 @@
|
||||
# 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
|
||||
|
||||
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
|
||||
# Conventionally lowercase.
|
||||
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
||||
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
|
||||
|
||||
# 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
|
||||
# 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/
|
||||
|
||||
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
||||
# Will update your build.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 an MCP channel for dependency deobfuscation and the deobfParams task.
|
||||
# Specify a MCP channel and mappings version for dependency deobfuscation and the deobfParams task.
|
||||
channel = stable
|
||||
|
||||
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
|
||||
mappingsVersion = 12
|
||||
|
||||
# Defines other MCP mappings for dependency deobfuscation.
|
||||
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
||||
# Define other MCP mappings for dependency deobfuscation
|
||||
remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
||||
|
||||
# Select a default username for testing your mod. You can always override this per-run by running
|
||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||
# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name each time you
|
||||
# restart Minecraft in development. Choose this dependent on your mod:
|
||||
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
|
||||
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
|
||||
developmentEnvironmentUserName = Developer
|
||||
|
||||
# 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.
|
||||
# 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
|
||||
gradleTokenModId =
|
||||
|
||||
# [DEPRECATED] Mod name replacement token.
|
||||
gradleTokenModName =
|
||||
|
||||
# [DEPRECATED] Mod Group replacement token.
|
||||
gradleTokenVersion = GRADLETOKEN_VERSION
|
||||
gradleTokenGroupName =
|
||||
|
||||
# [DEPRECATED]
|
||||
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
|
||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
|
||||
# version in @Mod([...], version = VERSION, [...]).
|
||||
# Leave these properties empty to skip individual token replacements.
|
||||
replaceGradleTokenInFile =
|
||||
|
||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can
|
||||
# leave this property empty.
|
||||
# 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. 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
|
||||
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
|
||||
# Example value: mymodid_at.cfg
|
||||
accessTransformersFile =
|
||||
|
||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||
usesMixins = false
|
||||
|
||||
# Adds some debug arguments like verbose output and class export.
|
||||
usesMixinDebug = false
|
||||
|
||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||
mixinPlugin =
|
||||
|
||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||
mixinsPackage =
|
||||
|
||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||
# This parameter is for legacy compatibility only
|
||||
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
|
||||
# This parameter is for legacy compatability 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
|
||||
@@ -106,87 +65,6 @@ 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 '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.
|
||||
# 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.
|
||||
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 the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
|
||||
includeWellKnownRepositories = true
|
||||
|
||||
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
|
||||
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
|
||||
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
|
||||
usesMavenPublishing = true
|
||||
|
||||
# Maven repository to publish the mod to.
|
||||
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
|
||||
|
||||
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
|
||||
#
|
||||
# The project's ID on Modrinth. Can be either the slug or the ID.
|
||||
# Leave this empty if you don't want to publish to Modrinth.
|
||||
modrinthProjectId =
|
||||
|
||||
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
|
||||
# Syntax: scope1-type1:name1;scope2-type2:name2;...
|
||||
# Where scope can be one of [required, optional, incompatible, embedded],
|
||||
# type can be one of [project, version],
|
||||
# and the name is the Modrinth project or version slug/id of the other mod.
|
||||
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
|
||||
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
||||
modrinthRelations =
|
||||
|
||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||
#
|
||||
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
||||
# Leave this empty if you don't want to publish on CurseForge.
|
||||
curseForgeProjectId =
|
||||
|
||||
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||
# Syntax: type1:name1;type2:name2;...
|
||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||
# and the name is the CurseForge project slug of the other mod.
|
||||
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
||||
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||
curseForgeRelations =
|
||||
|
||||
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
|
||||
# projects. New projects should not use this parameter.
|
||||
# customArchiveBaseName =
|
||||
|
||||
# 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
-2
@@ -1,7 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -55,7 +55,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -83,8 +83,10 @@ done
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -131,13 +133,10 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
@@ -145,7 +144,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=SC2039,SC3045
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
@@ -153,7 +152,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=SC2039,SC3045
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -198,15 +197,11 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
# 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.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
|
||||
Vendored
+10
-10
@@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
goto fail
|
||||
|
||||
@@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
goto fail
|
||||
|
||||
|
||||
+10
-5
@@ -4,10 +4,10 @@ pluginManagement {
|
||||
maven {
|
||||
// RetroFuturaGradle
|
||||
name "GTNH Maven"
|
||||
url "https://nexus.gtnewhorizons.com/repository/public/"
|
||||
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||
allowInsecureProtocol = true
|
||||
mavenContent {
|
||||
includeGroup("com.gtnewhorizons")
|
||||
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||
includeGroup("com.gtnewhorizons.retrofuturagradle")
|
||||
}
|
||||
}
|
||||
gradlePluginPortal()
|
||||
@@ -17,7 +17,12 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.23'
|
||||
id 'com.diffplug.blowdryerSetup' version '1.6.0'
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains
|
||||
}
|
||||
|
||||
|
||||
blowdryerSetup {
|
||||
repoSubfolder 'gtnhShared'
|
||||
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
|
||||
//devLocal '.' // Use this when testing config updates locally
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
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,27 +33,36 @@ 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;
|
||||
@@ -154,6 +166,10 @@ 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;
|
||||
@@ -387,6 +403,20 @@ 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);
|
||||
@@ -450,7 +480,12 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
@Override
|
||||
public ConduitRenderer getRendererForConduit(IConduit conduit) {
|
||||
return conduit.getRenderer();
|
||||
for (ConduitRenderer renderer : conduitRenderers) {
|
||||
if (renderer.isRendererForConduit(conduit)) {
|
||||
return renderer;
|
||||
}
|
||||
}
|
||||
return dcr;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,7 +34,6 @@ public class CommonProxy {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ConduitRenderer getRendererForConduit(IConduit conduit) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,6 @@ import crazypants.enderio.conduit.item.ItemItemConduit;
|
||||
import crazypants.enderio.conduit.item.filter.ItemBasicItemFilter;
|
||||
import crazypants.enderio.conduit.item.filter.ItemBigItemFilter;
|
||||
import crazypants.enderio.conduit.item.filter.ItemExistingItemFilter;
|
||||
import crazypants.enderio.conduit.item.filter.ItemLimitedItemFilter;
|
||||
import crazypants.enderio.conduit.item.filter.ItemModItemFilter;
|
||||
import crazypants.enderio.conduit.item.filter.ItemPowerItemFilter;
|
||||
import crazypants.enderio.conduit.liquid.ItemLiquidConduit;
|
||||
@@ -186,14 +185,14 @@ import crazypants.util.EE3Util;
|
||||
modid = MODID,
|
||||
name = MOD_NAME,
|
||||
version = VERSION,
|
||||
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,)",
|
||||
dependencies = "after:endercore;after:MineFactoryReloaded;after:Forestry;after:Waila@[1.5.8,);after:Thaumcraft;after:appliedenergistics2@[rv2-beta-8,);after:chisel",
|
||||
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 = Tags.VERSION;
|
||||
public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
|
||||
@Instance(MODID)
|
||||
public static EnderIO instance;
|
||||
@@ -208,7 +207,6 @@ public class EnderIO {
|
||||
public static final Lang lang = new Lang("enderio");
|
||||
|
||||
public static final boolean hasLwjgl3 = Loader.isModLoaded("lwjgl3ify");
|
||||
public static final boolean hasGT5 = Loader.isModLoaded("gregtech") && !Loader.isModLoaded("gregapi_post");
|
||||
|
||||
// Materials
|
||||
public static ItemCapacitor itemBasicCapacitor;
|
||||
@@ -265,7 +263,6 @@ public class EnderIO {
|
||||
public static ItemBasicItemFilter itemBasicFilterUpgrade;
|
||||
public static ItemBigItemFilter itemBigFilterUpgrade;
|
||||
public static ItemExistingItemFilter itemExistingItemFilter;
|
||||
public static ItemLimitedItemFilter itemLimitedItemFilter;
|
||||
public static ItemModItemFilter itemModItemFilter;
|
||||
public static ItemPowerItemFilter itemPowerItemFilter;
|
||||
public static ItemExtractSpeedUpgrade itemExtractSpeedUpgrade;
|
||||
@@ -471,7 +468,6 @@ public class EnderIO {
|
||||
itemBasicFilterUpgrade = ItemBasicItemFilter.create();
|
||||
itemBigFilterUpgrade = ItemBigItemFilter.create();
|
||||
itemExistingItemFilter = ItemExistingItemFilter.create();
|
||||
itemLimitedItemFilter = ItemLimitedItemFilter.create();
|
||||
itemModItemFilter = ItemModItemFilter.create();
|
||||
itemPowerItemFilter = ItemPowerItemFilter.create();
|
||||
itemExtractSpeedUpgrade = ItemExtractSpeedUpgrade.create();
|
||||
@@ -791,7 +787,7 @@ public class EnderIO {
|
||||
@EventHandler
|
||||
public void loadComplete(FMLLoadCompleteEvent event) {
|
||||
processImc(FMLInterModComms.fetchRuntimeMessages(this)); // Some mods send IMCs during PostInit, so we catch
|
||||
// them here.
|
||||
// them here.
|
||||
}
|
||||
|
||||
private static String getXPJuiceName() {
|
||||
|
||||
@@ -2,13 +2,10 @@ package crazypants.enderio;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.Marker;
|
||||
import org.apache.logging.log4j.MarkerManager;
|
||||
|
||||
public final class Log {
|
||||
|
||||
public static final Logger LOGGER = LogManager.getLogger(EnderIO.MODID);
|
||||
public static final Marker securityMarker = MarkerManager.getMarker("SuspiciousPackets");
|
||||
|
||||
public static void warn(String msg) {
|
||||
LOGGER.warn(msg);
|
||||
|
||||
@@ -18,7 +18,6 @@ public enum ModObject {
|
||||
itemBasicFilterUpgrade,
|
||||
itemBigFilterUpgrade,
|
||||
itemExistingItemFilter,
|
||||
itemLimitedItemFilter,
|
||||
itemModItemFilter,
|
||||
itemPowerItemFilter,
|
||||
itemExtractSpeedUpgrade,
|
||||
|
||||
@@ -4,20 +4,10 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import crazypants.enderio.config.Config;
|
||||
|
||||
public interface IItemOfTravel extends IEnergyContainerItem {
|
||||
|
||||
boolean isActive(EntityPlayer ep, ItemStack equipped);
|
||||
|
||||
void extractInternal(ItemStack equipped, int power);
|
||||
|
||||
/**
|
||||
* @param equipped player who is currently holding this item. caller will ensure the item held has your Item as item
|
||||
* type
|
||||
* @return -1 if method not supported, or max(can extract, power), e.g. 0 if item is empty.
|
||||
*/
|
||||
default int canExtractInternal(ItemStack equipped, int power) {
|
||||
return Config.strictTPItemChecking ? 0 : -1;
|
||||
}
|
||||
}
|
||||
@@ -94,10 +94,11 @@ public interface ITelePad extends ITravelAccessable {
|
||||
/**
|
||||
* Util method to set all coords using a {@link BlockCoord} object.
|
||||
*
|
||||
* @param coords The coords to set this telepad to.
|
||||
* @see #setX(int)
|
||||
* @see #setY(int)
|
||||
* @see #setZ(int)
|
||||
*
|
||||
* @param coords The coords to set this telepad to.
|
||||
*/
|
||||
void setCoords(BlockCoord coords);
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
import crazypants.util.UserIdent;
|
||||
|
||||
public interface ITravelAccessable {
|
||||
|
||||
@@ -14,8 +14,9 @@ import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
* <li>Staff of travelling</li>
|
||||
* <li>Telepad</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
*
|
||||
* As well as any externally added teleports, assuming they fire this event manually.
|
||||
*
|
||||
*/
|
||||
@Cancelable
|
||||
public class TeleportEntityEvent extends EntityEvent {
|
||||
|
||||
@@ -81,7 +81,7 @@ public enum TravelSource {
|
||||
return 0;
|
||||
}
|
||||
|
||||
TravelSource source = TravelController.instance.getTravelItemTravelSource(player, false);
|
||||
TravelSource source = TravelController.instance.getTravelItemTravelSource(player);
|
||||
if (source == null) {
|
||||
return TravelSource.BLOCK.getMaxDistanceTravelledSq();
|
||||
} else {
|
||||
|
||||
@@ -9,6 +9,11 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import mods.immibis.microblocks.api.EnumPartClass;
|
||||
import mods.immibis.microblocks.api.EnumPosition;
|
||||
import mods.immibis.microblocks.api.IMicroblockCoverSystem;
|
||||
import mods.immibis.microblocks.api.Part;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -47,10 +52,6 @@ import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
import crazypants.enderio.conduit.power.PowerConduitNetwork;
|
||||
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.RedstoneConduitNetwork;
|
||||
import mods.immibis.microblocks.api.EnumPartClass;
|
||||
import mods.immibis.microblocks.api.EnumPosition;
|
||||
import mods.immibis.microblocks.api.IMicroblockCoverSystem;
|
||||
import mods.immibis.microblocks.api.Part;
|
||||
|
||||
public abstract class AbstractConduit implements IConduit {
|
||||
|
||||
@@ -88,7 +89,7 @@ public abstract class AbstractConduit implements IConduit {
|
||||
* If this is true, it will trigger a reconnection on the next Tick.
|
||||
* <p>
|
||||
* Use the method needUpdateConnections() instead of setting this to true.
|
||||
*
|
||||
*
|
||||
* @see needUpdateConnections()
|
||||
*/
|
||||
private boolean needUpdateConnections = false;
|
||||
|
||||
@@ -2,6 +2,11 @@ package crazypants.enderio.conduit;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mods.immibis.microblocks.api.IMicroblockCoverSystem;
|
||||
import mods.immibis.microblocks.api.IMicroblockSupporterTile;
|
||||
import mods.immibis.microblocks.api.MicroblockAPIUtils;
|
||||
import mods.immibis.microblocks.api.Part;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -24,10 +29,6 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.ModObject;
|
||||
import mods.immibis.microblocks.api.IMicroblockCoverSystem;
|
||||
import mods.immibis.microblocks.api.IMicroblockSupporterTile;
|
||||
import mods.immibis.microblocks.api.MicroblockAPIUtils;
|
||||
import mods.immibis.microblocks.api.Part;
|
||||
|
||||
public abstract class AbstractItemConduit extends Item implements IConduitItem {
|
||||
|
||||
@@ -67,6 +68,7 @@ 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) {
|
||||
@@ -83,7 +85,9 @@ 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;
|
||||
@@ -113,6 +117,7 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -158,7 +163,8 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
|
||||
System.out.println("AbstractItemConduit.onItemUse: Conduit null.");
|
||||
return false;
|
||||
}
|
||||
bundle.replaceConduit(existingConduit, newConduit);
|
||||
bundle.removeConduit(existingConduit);
|
||||
bundle.addConduit(newConduit);
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
stack.stackSize--;
|
||||
for (ItemStack drop : existingConduit.getDrops()) {
|
||||
|
||||
@@ -6,6 +6,9 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import mods.immibis.core.api.multipart.IMultipartRenderingBlockMarker;
|
||||
import mods.immibis.core.api.multipart.IMultipartSystem;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.ISound;
|
||||
@@ -28,6 +31,9 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.event.entity.PlaySoundAtEntityEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
|
||||
|
||||
import powercrystals.minefactoryreloaded.api.rednet.IRedNetOmniNode;
|
||||
import powercrystals.minefactoryreloaded.api.rednet.connectivity.RedNetConnectionType;
|
||||
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import com.enderio.core.common.util.Util;
|
||||
@@ -47,13 +53,7 @@ import crazypants.enderio.api.tool.ITool;
|
||||
import crazypants.enderio.conduit.facade.ItemConduitFacade.FacadeType;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.geom.ConduitConnectorType;
|
||||
import crazypants.enderio.conduit.gui.ExternalConnectionContainer;
|
||||
import crazypants.enderio.conduit.gui.GuiExternalConnection;
|
||||
import crazypants.enderio.conduit.gui.GuiExternalConnectionSelector;
|
||||
import crazypants.enderio.conduit.gui.PacketFluidChannel;
|
||||
import crazypants.enderio.conduit.gui.PacketFluidFilter;
|
||||
import crazypants.enderio.conduit.gui.PacketOpenConduitUI;
|
||||
import crazypants.enderio.conduit.gui.PacketSlotVisibility;
|
||||
import crazypants.enderio.conduit.gui.*;
|
||||
import crazypants.enderio.conduit.gui.item.PacketExistingItemFilterSnapshot;
|
||||
import crazypants.enderio.conduit.gui.item.PacketModItemFilter;
|
||||
import crazypants.enderio.conduit.liquid.PacketFluidLevel;
|
||||
@@ -73,10 +73,6 @@ import crazypants.enderio.machine.painter.PainterUtil;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.tool.ToolUtil;
|
||||
import crazypants.util.IFacade;
|
||||
import mods.immibis.core.api.multipart.IMultipartRenderingBlockMarker;
|
||||
import mods.immibis.core.api.multipart.IMultipartSystem;
|
||||
import powercrystals.minefactoryreloaded.api.rednet.IRedNetOmniNode;
|
||||
import powercrystals.minefactoryreloaded.api.rednet.connectivity.RedNetConnectionType;
|
||||
|
||||
@Optional.InterfaceList({
|
||||
@Interface(
|
||||
@@ -641,8 +637,8 @@ public class BlockConduitBundle extends BlockEio
|
||||
|
||||
@Override
|
||||
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
|
||||
ITool tool = ToolUtil.getEquippedTool(player);
|
||||
if (!player.isSneaking() || tool == null || !tool.canUse(player.getCurrentEquippedItem(), player, x, y, z)) {
|
||||
ItemStack equipped = player.getCurrentEquippedItem();
|
||||
if (!player.isSneaking() || equipped == null || equipped.getItem() != EnderIO.itemYetaWench) {
|
||||
return;
|
||||
}
|
||||
ConduitUtil.openConduitGui(world, x, y, z, player);
|
||||
|
||||
@@ -1,15 +1,6 @@
|
||||
package crazypants.enderio.conduit;
|
||||
|
||||
import static crazypants.enderio.gui.IconEIO.CROSS;
|
||||
import static crazypants.enderio.gui.IconEIO.TICK;
|
||||
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_FLUID;
|
||||
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_FLUID_OFF;
|
||||
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_ITEM;
|
||||
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_ITEM_OFF;
|
||||
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_POWER;
|
||||
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_POWER_OFF;
|
||||
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_REDSTONE;
|
||||
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_REDSTONE_OFF;
|
||||
import static crazypants.enderio.gui.IconEIO.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -64,10 +55,11 @@ public class ConduitDisplayMode {
|
||||
* Use this constructor if you have custom display logic, it will use {@code IConduit.class} as the conduitType, and
|
||||
* the passed name as the override name.
|
||||
*
|
||||
* @see #ConduitDisplayMode(Class, IWidgetIcon, IWidgetIcon)
|
||||
*
|
||||
* @param name The override name.
|
||||
* @param widgetSelected The widget to render when this type is selected.
|
||||
* @param widgetUnselected The widget to render when this type is unselected.
|
||||
* @see #ConduitDisplayMode(Class, IWidgetIcon, IWidgetIcon)
|
||||
*/
|
||||
public ConduitDisplayMode(String name, IWidgetIcon widgetSelected, IWidgetIcon widgetUnselected) {
|
||||
this(IConduit.class, widgetSelected, widgetUnselected);
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
package crazypants.enderio.conduit;
|
||||
|
||||
import static crazypants.enderio.ModObject.blockPainter;
|
||||
import static crazypants.enderio.material.Alloy.CONDUCTIVE_IRON;
|
||||
import static crazypants.enderio.material.Alloy.ELECTRICAL_STEEL;
|
||||
import static crazypants.enderio.material.Alloy.END_STEEL;
|
||||
import static crazypants.enderio.material.Alloy.ENERGETIC_ALLOY;
|
||||
import static crazypants.enderio.material.Alloy.PHASED_GOLD;
|
||||
import static crazypants.enderio.material.Alloy.REDSTONE_ALLOY;
|
||||
import static crazypants.enderio.material.Material.CONDUIT_BINDER;
|
||||
import static crazypants.enderio.material.Material.PHASED_IRON_NUGGET;
|
||||
import static crazypants.enderio.material.endergy.AlloyEndergy.CRUDE_STEEL;
|
||||
import static crazypants.enderio.material.endergy.AlloyEndergy.CRYSTALLINE_ALLOY;
|
||||
import static crazypants.enderio.material.endergy.AlloyEndergy.CRYSTALLINE_PINK_SLIME;
|
||||
import static crazypants.enderio.material.endergy.AlloyEndergy.ENERGETIC_SILVER;
|
||||
import static crazypants.enderio.material.endergy.AlloyEndergy.MELODIC_ALLOY;
|
||||
import static crazypants.enderio.material.endergy.AlloyEndergy.STELLAR_ALLOY;
|
||||
import static crazypants.enderio.material.Alloy.*;
|
||||
import static crazypants.enderio.material.Material.*;
|
||||
import static crazypants.enderio.material.endergy.AlloyEndergy.*;
|
||||
import static crazypants.util.RecipeUtil.addShaped;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -601,9 +590,6 @@ public class ConduitRecipes {
|
||||
'f',
|
||||
advFilter);
|
||||
|
||||
ItemStack limitedFilter = new ItemStack(EnderIO.itemLimitedItemFilter, 1, 0);
|
||||
addShaped(limitedFilter, " ", "cfc", " ", 'c', new ItemStack(Items.comparator, 1, 0), 'f', advFilter);
|
||||
|
||||
ItemStack powerFilt = new ItemStack(EnderIO.itemPowerItemFilter);
|
||||
addShaped(powerFilt, " p ", "pcp", " p ", 'p', Items.paper, 'c', EnderIO.itemConduitProbe);
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ public class ConduitUtil {
|
||||
}
|
||||
}
|
||||
if (con.getNetwork() != null) { // this should have been destroyed when destroying the neighbours network but
|
||||
// lets just make
|
||||
// lets just make
|
||||
// sure
|
||||
con.getNetwork().destroyNetwork();
|
||||
}
|
||||
@@ -158,7 +158,7 @@ public class ConduitUtil {
|
||||
}
|
||||
|
||||
public static boolean isFacadeHidden(IConduitBundle bundle, EntityPlayer player) {
|
||||
return bundle != null && bundle.getFacadeId() != null && shouldHeldItemHideFacades(player);
|
||||
return bundle.getFacadeId() != null && shouldHeldItemHideFacades(player);
|
||||
}
|
||||
|
||||
public static ConduitDisplayMode getDisplayMode(EntityPlayer player) {
|
||||
|
||||
@@ -17,7 +17,6 @@ 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 {
|
||||
|
||||
@@ -142,6 +141,4 @@ public interface IConduit {
|
||||
* Should the texture of the conduit connectors be mirrored around the conduit node?
|
||||
*/
|
||||
boolean shouldMirrorTexture();
|
||||
|
||||
ConduitRenderer getRenderer();
|
||||
}
|
||||
@@ -4,6 +4,11 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import li.cil.oc.api.network.Environment;
|
||||
import li.cil.oc.api.network.SidedEnvironment;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
import mods.immibis.microblocks.api.IMicroblockSupporterTile;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -11,10 +16,11 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
import appeng.api.networking.IGridHost;
|
||||
import cofh.api.transport.IItemDuct;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
import cpw.mods.fml.common.Optional.Interface;
|
||||
import cpw.mods.fml.common.Optional.InterfaceList;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -23,10 +29,6 @@ import crazypants.enderio.conduit.facade.ItemConduitFacade.FacadeType;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.geom.Offset;
|
||||
import crazypants.enderio.power.IInternalPowerHandler;
|
||||
import li.cil.oc.api.network.Environment;
|
||||
import li.cil.oc.api.network.SidedEnvironment;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
import mods.immibis.microblocks.api.IMicroblockSupporterTile;
|
||||
|
||||
@InterfaceList({ @Interface(iface = "appeng.api.networking.IGridHost", modid = "appliedenergistics2"),
|
||||
@Interface(iface = "mekanism.api.gas.IGasHandler", modid = "MekanismAPI|gas"),
|
||||
@@ -49,8 +51,6 @@ public interface IConduitBundle extends IInternalPowerHandler, IFluidHandler, II
|
||||
|
||||
void addConduit(IConduit conduit);
|
||||
|
||||
void replaceConduit(IConduit original, IConduit replacement);
|
||||
|
||||
void removeConduit(IConduit conduit);
|
||||
|
||||
Collection<IConduit> getConduits();
|
||||
|
||||
@@ -3,7 +3,6 @@ package crazypants.enderio.conduit;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
|
||||
public interface IExtractor extends IConduit {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package crazypants.enderio.conduit;
|
||||
|
||||
import mods.immibis.microblocks.api.EnumPosition;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import mods.immibis.microblocks.api.EnumPosition;
|
||||
|
||||
public class MicroblocksUtil {
|
||||
|
||||
|
||||
@@ -7,6 +7,19 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import li.cil.oc.api.network.*;
|
||||
import li.cil.oc.api.network.Message;
|
||||
import li.cil.oc.api.network.Node;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mods.immibis.microblocks.api.EnumPartClass;
|
||||
import mods.immibis.microblocks.api.EnumPosition;
|
||||
import mods.immibis.microblocks.api.IMicroblockCoverSystem;
|
||||
import mods.immibis.microblocks.api.IMicroblockSystem;
|
||||
import mods.immibis.microblocks.api.MicroblockAPIUtils;
|
||||
import mods.immibis.microblocks.api.Part;
|
||||
import mods.immibis.microblocks.api.PartType;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -24,11 +37,11 @@ import net.minecraftforge.fluids.Fluid;
|
||||
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;
|
||||
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -51,23 +64,12 @@ import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduit;
|
||||
import crazypants.enderio.config.Config;
|
||||
import li.cil.oc.api.network.Message;
|
||||
import li.cil.oc.api.network.Node;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mods.immibis.microblocks.api.EnumPartClass;
|
||||
import mods.immibis.microblocks.api.EnumPosition;
|
||||
import mods.immibis.microblocks.api.IMicroblockCoverSystem;
|
||||
import mods.immibis.microblocks.api.IMicroblockSystem;
|
||||
import mods.immibis.microblocks.api.MicroblockAPIUtils;
|
||||
import mods.immibis.microblocks.api.Part;
|
||||
import mods.immibis.microblocks.api.PartType;
|
||||
|
||||
public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
|
||||
public static final short NBT_VERSION = 1;
|
||||
|
||||
private final List<IConduit> conduits = new CasList<>();
|
||||
private final List<IConduit> conduits = new ArrayList<IConduit>();
|
||||
|
||||
private Block facadeId = null;
|
||||
private int facadeMeta = 0;
|
||||
@@ -75,9 +77,9 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
|
||||
private boolean facadeChanged;
|
||||
|
||||
private final List<CollidableComponent> cachedCollidables = new ArrayList<>();
|
||||
private final List<CollidableComponent> cachedCollidables = new ArrayList<CollidableComponent>();
|
||||
|
||||
private final List<CollidableComponent> cachedConnectors = new ArrayList<>();
|
||||
private final List<CollidableComponent> cachedConnectors = new ArrayList<CollidableComponent>();
|
||||
|
||||
private boolean conduitsDirty = true;
|
||||
private boolean collidablesDirty = true;
|
||||
@@ -405,29 +407,6 @@ 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) {
|
||||
@@ -452,7 +431,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
List<IConduit> copy = new ArrayList<>(conduits);
|
||||
List<IConduit> copy = new ArrayList<IConduit>(conduits);
|
||||
for (IConduit con : copy) {
|
||||
removeConduit(con, false);
|
||||
}
|
||||
@@ -537,7 +516,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
|
||||
@Override
|
||||
public List<CollidableComponent> getConnectors() {
|
||||
List<CollidableComponent> result = new ArrayList<>();
|
||||
List<CollidableComponent> result = new ArrayList<CollidableComponent>();
|
||||
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, Cloneable {
|
||||
public class BlockConduitFacade extends BlockEio implements IPaintedBlock {
|
||||
|
||||
public static BlockConduitFacade create() {
|
||||
BlockConduitFacade result = new BlockConduitFacade();
|
||||
@@ -24,10 +24,6 @@ public class BlockConduitFacade extends BlockEio implements IPaintedBlock, Clone
|
||||
return result;
|
||||
}
|
||||
|
||||
public BlockConduitFacade clone() throws CloneNotSupportedException {
|
||||
return (BlockConduitFacade) super.clone();
|
||||
}
|
||||
|
||||
private Block blockOverride;
|
||||
|
||||
private BlockConduitFacade() {
|
||||
|
||||
@@ -5,6 +5,8 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -21,7 +23,6 @@ import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.enderio.machine.reservoir.TileReservoir;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
|
||||
public abstract class AbstractGasConduit extends AbstractConduit implements IGasConduit {
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@ package crazypants.enderio.conduit.gas;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -14,8 +17,6 @@ import crazypants.enderio.conduit.ConduitUtil;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.RaytraceResult;
|
||||
import crazypants.enderio.tool.ToolUtil;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
|
||||
public abstract class AbstractGasTankConduit extends AbstractGasConduit {
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
|
||||
public class AbstractGasTankConduitNetwork<T extends AbstractGasTankConduit>
|
||||
extends AbstractConduitNetwork<IGasConduit, T> {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.GasTank;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.GasTank;
|
||||
|
||||
public class ConduitGasTank extends GasTank {
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ package crazypants.enderio.conduit.gas;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasStack;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -20,10 +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 mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasStack;
|
||||
|
||||
public class GasConduit extends AbstractGasTankConduit {
|
||||
|
||||
@@ -35,12 +35,7 @@ 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<>();
|
||||
|
||||
@Override
|
||||
public ConduitRenderer getRenderer() {
|
||||
return GasConduitRenderer.instance.get();
|
||||
}
|
||||
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void initIcons() {
|
||||
|
||||
@@ -4,15 +4,15 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
|
||||
public class GasConduitNetwork extends AbstractGasTankConduitNetwork<GasConduit> {
|
||||
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import static com.enderio.core.client.render.CubeRenderer.addVecWithUV;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.gas.GasStack;
|
||||
|
||||
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;
|
||||
@@ -20,13 +24,14 @@ 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 {
|
||||
|
||||
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(GasConduitRenderer::new);
|
||||
@Override
|
||||
public boolean isRendererForConduit(IConduit conduit) {
|
||||
return conduit instanceof GasConduit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x,
|
||||
@@ -54,8 +59,6 @@ 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;
|
||||
@@ -101,17 +104,15 @@ 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 (i = 0; i < corners.size(); i++) {
|
||||
final Vertex c = corners.get(i);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
for (Vertex c : corners) {
|
||||
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 (i = 0; i < corners.size(); i++) {
|
||||
final Vertex c = corners.get(i);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
for (Vertex c : corners) {
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,15 +125,14 @@ public class GasConduitRenderer extends DefaultConduitRenderer {
|
||||
tex.getMaxU(),
|
||||
tex.getMinV(),
|
||||
tex.getMaxV());
|
||||
|
||||
for (i = 0; i < corners.size(); i++) {
|
||||
final Vertex c = corners.get(i);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
for (Vertex c : corners) {
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
// back face
|
||||
for (i = corners.size() - 1; i >= 0; i--) {
|
||||
final Vertex c = corners.get(i);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
for (int i = corners.size() - 1; i >= 0; i--) {
|
||||
Vertex c = corners.get(i);
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
@@ -9,8 +12,6 @@ import cpw.mods.fml.common.ModAPIManager;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.config.Config;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
|
||||
public final class GasUtil {
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.common.Optional.Interface;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IExtractor;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
|
||||
@Interface(iface = "mekanism.api.gas.IGasHandler", modid = GasUtil.API_NAME)
|
||||
public interface IGasConduit extends IConduit, IGasHandler, IExtractor {
|
||||
|
||||
@@ -3,7 +3,6 @@ package crazypants.enderio.conduit.geom;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
|
||||
public class CollidableComponent {
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.enderio.core.client.render.BoundingBox;
|
||||
import com.enderio.core.common.util.ForgeDirectionOffsets;
|
||||
import com.enderio.core.common.vecmath.VecmathUtil;
|
||||
import com.enderio.core.common.vecmath.Vector3d;
|
||||
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
|
||||
public class ConduitGeometryUtil {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package crazypants.enderio.conduit.gui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -10,7 +10,6 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@@ -25,14 +24,12 @@ import crazypants.enderio.conduit.gui.item.InventoryUpgrades;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.item.SpeedUpgrade;
|
||||
import crazypants.enderio.conduit.item.filter.IItemFilter;
|
||||
import crazypants.enderio.machine.gui.IContainerWithTileEntity;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
|
||||
public class ExternalConnectionContainer extends ContainerEnder<InventoryUpgrades> implements IContainerWithTileEntity {
|
||||
public class ExternalConnectionContainer extends ContainerEnder<InventoryUpgrades> {
|
||||
|
||||
private final IItemConduit itemConduit;
|
||||
private final ForgeDirection direction;
|
||||
private final TileEntity te;
|
||||
|
||||
private int speedUpgradeSlotLimit = 15;
|
||||
|
||||
@@ -55,7 +52,6 @@ public class ExternalConnectionContainer extends ContainerEnder<InventoryUpgrade
|
||||
super(playerInv, new InventoryUpgrades(bundle.getConduit(IItemConduit.class), dir));
|
||||
this.direction = dir;
|
||||
this.itemConduit = bundle.getConduit(IItemConduit.class);
|
||||
this.te = (TileEntity) bundle;
|
||||
slotLocations.addAll(playerSlotLocations.values());
|
||||
|
||||
int x;
|
||||
@@ -284,11 +280,6 @@ public class ExternalConnectionContainer extends ContainerEnder<InventoryUpgrade
|
||||
return copystack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity() {
|
||||
return te;
|
||||
}
|
||||
|
||||
private class FilterSlot extends Slot {
|
||||
|
||||
public FilterSlot(IInventory par1iInventory, int par2, int par3, int par4) {
|
||||
|
||||
@@ -2,6 +2,8 @@ package crazypants.enderio.conduit.gui;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import mekanism.api.gas.Gas;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
@@ -20,7 +22,6 @@ import crazypants.enderio.gui.RedstoneModeButton;
|
||||
import crazypants.enderio.machine.IRedstoneModeControlable;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import mekanism.api.gas.Gas;
|
||||
|
||||
public class GasSettings extends BaseSettingsPanel {
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@ public class PacketFluidChannel extends AbstractConduitPacket<ILiquidConduit>
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketFluidChannel message, MessageContext ctx) {
|
||||
if (isInvalidPacketForGui(message, ctx)) return null;
|
||||
ILiquidConduit conduit = message.getTileCasted(ctx);
|
||||
if (!(conduit instanceof AbstractEnderLiquidConduit)) {
|
||||
return null;
|
||||
|
||||
@@ -53,7 +53,6 @@ public class PacketFluidFilter extends AbstractConduitPacket<ILiquidConduit>
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketFluidFilter message, MessageContext ctx) {
|
||||
if (isInvalidPacketForGui(message, ctx)) return null;
|
||||
ILiquidConduit conduit = message.getTileCasted(ctx);
|
||||
if (!(conduit instanceof AbstractEnderLiquidConduit)) {
|
||||
return null;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package crazypants.enderio.conduit.gui.item;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.*;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
@@ -1,202 +0,0 @@
|
||||
package crazypants.enderio.conduit.gui.item;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.enderio.core.client.gui.button.CycleButton;
|
||||
import com.enderio.core.client.gui.button.IconButton;
|
||||
import com.enderio.core.client.gui.button.ToggleButton;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.gui.GuiExternalConnection;
|
||||
import crazypants.enderio.conduit.item.filter.FuzzyMode;
|
||||
import crazypants.enderio.conduit.item.filter.ItemFilter;
|
||||
import crazypants.enderio.gui.GuiContainerBaseEIO;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
|
||||
public class LimitedItemFilterGui implements IItemFilterGui {
|
||||
|
||||
private static final int ID_WHITELIST = GuiExternalConnection.nextButtonId();
|
||||
private static final int ID_NBT = GuiExternalConnection.nextButtonId();
|
||||
private static final int ID_META = GuiExternalConnection.nextButtonId();
|
||||
private static final int ID_ORE_DICT = GuiExternalConnection.nextButtonId();
|
||||
private static final int ID_STICKY = GuiExternalConnection.nextButtonId();
|
||||
private static final int ID_FUZZY = GuiExternalConnection.nextButtonId();
|
||||
|
||||
private final GuiContainerBaseEIO gui;
|
||||
|
||||
private final ToggleButton useMetaB;
|
||||
private final ToggleButton useNbtB;
|
||||
private final IconButton whiteListB;
|
||||
private final ToggleButton useOreDictB;
|
||||
private final ToggleButton stickyB;
|
||||
private final CycleButton<FuzzyMode> fuzzyB;
|
||||
|
||||
private final IItemFilterContainer filterContainer;
|
||||
private final ItemFilter filter;
|
||||
private int buttonIdOffset;
|
||||
private int xOffset;
|
||||
private int yOffset;
|
||||
final boolean isStickyModeAvailable;
|
||||
private boolean isInput;
|
||||
|
||||
public LimitedItemFilterGui(GuiContainerBaseEIO gui, IItemFilterContainer filterContainer,
|
||||
boolean isStickyModeAvailable, boolean isInput) {
|
||||
this(gui, filterContainer, isStickyModeAvailable, isInput, isInput ? 104 : 6, 96, isInput ? 0 : 256);
|
||||
}
|
||||
|
||||
public LimitedItemFilterGui(GuiContainerBaseEIO gui, IItemFilterContainer filterContainer,
|
||||
boolean isStickyModeAvailable, boolean isInput, int xOffset, int yOffset, int buttonIdOffset) {
|
||||
this.gui = gui;
|
||||
this.isStickyModeAvailable = isStickyModeAvailable;
|
||||
this.filterContainer = filterContainer;
|
||||
this.xOffset = xOffset;
|
||||
this.yOffset = yOffset;
|
||||
this.buttonIdOffset = buttonIdOffset;
|
||||
this.isInput = isInput;
|
||||
|
||||
filter = filterContainer.getItemFilter();
|
||||
|
||||
int butLeft = xOffset;
|
||||
int x = butLeft;
|
||||
int y = yOffset + 40;
|
||||
whiteListB = new IconButton(gui, ID_WHITELIST + buttonIdOffset, x, y, IconEIO.FILTER_WHITELIST);
|
||||
whiteListB.setToolTip(getWhitelistTooltips(false));
|
||||
|
||||
x += 16;
|
||||
useMetaB = new ToggleButton(gui, ID_META + buttonIdOffset, x, y, IconEIO.FILTER_META_OFF, IconEIO.FILTER_META);
|
||||
useMetaB.setSelectedToolTip(EnderIO.lang.localize("gui.conduit.item.matchMetaData"));
|
||||
useMetaB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.ignoreMetaData"));
|
||||
useMetaB.setPaintSelectedBorder(false);
|
||||
|
||||
x += 16;
|
||||
stickyB = new ToggleButton(
|
||||
gui,
|
||||
ID_STICKY + buttonIdOffset,
|
||||
x,
|
||||
y,
|
||||
IconEIO.FILTER_STICKY_OFF,
|
||||
IconEIO.FILTER_STICKY);
|
||||
stickyB.setSelectedToolTip(EnderIO.lang.localizeList("gui.conduit.item.stickyEnabled"));
|
||||
stickyB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.stickyDisbaled"));
|
||||
stickyB.setPaintSelectedBorder(false);
|
||||
|
||||
if (isStickyModeAvailable) x += 16;
|
||||
useOreDictB = new ToggleButton(
|
||||
gui,
|
||||
ID_ORE_DICT + buttonIdOffset,
|
||||
x,
|
||||
y,
|
||||
IconEIO.FILTER_ORE_DICT_OFF,
|
||||
IconEIO.FILTER_ORE_DICT);
|
||||
useOreDictB.setSelectedToolTip(EnderIO.lang.localize("gui.conduit.item.oreDicEnabled"));
|
||||
useOreDictB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.oreDicDisabled"));
|
||||
useOreDictB.setPaintSelectedBorder(false);
|
||||
|
||||
x += 16;
|
||||
useNbtB = new ToggleButton(gui, ID_NBT + buttonIdOffset, x, y, IconEIO.FILTER_NBT_OFF, IconEIO.FILTER_NBT);
|
||||
useNbtB.setSelectedToolTip(EnderIO.lang.localize("gui.conduit.item.matchNBT"));
|
||||
useNbtB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.ignoreNBT"));
|
||||
useNbtB.setPaintSelectedBorder(false);
|
||||
|
||||
x += 16;
|
||||
fuzzyB = new CycleButton(gui, ID_FUZZY + buttonIdOffset, x, y, FuzzyMode.class);
|
||||
}
|
||||
|
||||
public void createFilterSlots() {
|
||||
filter.createGhostSlots(gui.getGhostSlots(), xOffset + 1, yOffset + 1, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
sendFilterChange();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int x, int y, int par3) {}
|
||||
|
||||
@Override
|
||||
public void updateButtons() {
|
||||
ItemFilter activeFilter = filter;
|
||||
|
||||
useNbtB.onGuiInit();
|
||||
useNbtB.setSelected(activeFilter.isMatchNBT());
|
||||
|
||||
useOreDictB.onGuiInit();
|
||||
useOreDictB.setSelected(activeFilter.isUseOreDict());
|
||||
|
||||
if (isStickyModeAvailable) {
|
||||
stickyB.onGuiInit();
|
||||
stickyB.setSelected(activeFilter.isSticky());
|
||||
}
|
||||
|
||||
fuzzyB.onGuiInit();
|
||||
fuzzyB.setMode(activeFilter.getFuzzyMode());
|
||||
|
||||
useMetaB.onGuiInit();
|
||||
useMetaB.setSelected(activeFilter.isMatchMeta());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton guiButton) {
|
||||
|
||||
if (guiButton.id == ID_META + buttonIdOffset) {
|
||||
filter.setMatchMeta(useMetaB.isSelected());
|
||||
sendFilterChange();
|
||||
} else if (guiButton.id == ID_NBT + buttonIdOffset) {
|
||||
filter.setMatchNBT(useNbtB.isSelected());
|
||||
sendFilterChange();
|
||||
} else if (guiButton.id == ID_STICKY + buttonIdOffset) {
|
||||
filter.setSticky(stickyB.isSelected());
|
||||
sendFilterChange();
|
||||
} else if (guiButton.id == ID_ORE_DICT + buttonIdOffset) {
|
||||
filter.setUseOreDict(useOreDictB.isSelected());
|
||||
sendFilterChange();
|
||||
} else if (guiButton.id == ID_FUZZY + buttonIdOffset) {
|
||||
filter.setFuzzyMode(fuzzyB.getMode());
|
||||
sendFilterChange();
|
||||
} else if (guiButton.id == ID_WHITELIST + buttonIdOffset) {
|
||||
filter.setBlacklist(!filter.isBlacklist());
|
||||
sendFilterChange();
|
||||
}
|
||||
}
|
||||
|
||||
private void sendFilterChange() {
|
||||
updateButtons();
|
||||
filterContainer.onFilterChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivate() {
|
||||
useNbtB.detach();
|
||||
useMetaB.detach();
|
||||
useOreDictB.detach();
|
||||
whiteListB.detach();
|
||||
stickyB.detach();
|
||||
fuzzyB.detach();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderCustomOptions(int top, float par1, int par2, int par3) {
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
gui.bindGuiTexture(1);
|
||||
gui.drawTexturedModalRect(gui.getGuiLeft() + xOffset, gui.getGuiTop() + yOffset, 0, 238, 18 * 5, 18);
|
||||
gui.drawTexturedModalRect(gui.getGuiLeft() + xOffset, gui.getGuiTop() + yOffset + 20, 0, 238, 18 * 5, 18);
|
||||
|
||||
}
|
||||
|
||||
private String[] getWhitelistTooltips(boolean isBlacklist) {
|
||||
if (isBlacklist) {
|
||||
return new String[] { EnderIO.lang.localize("gui.conduit.item.blacklist"),
|
||||
EnderIO.lang.localize("gui.conduit.item.blacklist.tooltip.0"),
|
||||
EnderIO.lang.localize("gui.conduit.item.blacklist.tooltip.1") };
|
||||
} else {
|
||||
return new String[] { EnderIO.lang.localize("gui.conduit.item.whitelist"),
|
||||
EnderIO.lang.localize("gui.conduit.item.whitelist.tooltip.0"),
|
||||
EnderIO.lang.localize("gui.conduit.item.whitelist.tooltip.1") };
|
||||
}
|
||||
}
|
||||
}
|
||||
-1
@@ -58,7 +58,6 @@ public class PacketExistingItemFilterSnapshot extends AbstractConduitPacket<IIte
|
||||
|
||||
@Override
|
||||
public PacketExistingItemFilterSnapshot onMessage(PacketExistingItemFilterSnapshot message, MessageContext ctx) {
|
||||
if (isInvalidPacketForGui(message, ctx)) return null;
|
||||
IItemConduit conduit = message.getTileCasted(ctx);
|
||||
if (conduit == null) {
|
||||
return null;
|
||||
|
||||
@@ -58,7 +58,6 @@ public class PacketModItemFilter extends AbstractConduitPacket<IItemConduit>
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketModItemFilter message, MessageContext ctx) {
|
||||
if (isInvalidPacketForGui(message, ctx)) return null;
|
||||
IItemConduit conduit = message.getTileCasted(ctx);
|
||||
if (conduit == null) {
|
||||
return null;
|
||||
|
||||
@@ -5,21 +5,16 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cofh.api.transport.IItemDuct;
|
||||
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
|
||||
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();
|
||||
|
||||
@@ -18,11 +18,12 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cofh.api.inventory.IInventoryConnection;
|
||||
|
||||
import com.enderio.core.client.render.IconUtil;
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
|
||||
import cofh.api.inventory.IInventoryConnection;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.AbstractConduit;
|
||||
import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
@@ -612,7 +613,8 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
|
||||
|
||||
@Override
|
||||
public ItemStack createItem() {
|
||||
return new ItemStack(EnderIO.itemItemConduit, 1, metaData);
|
||||
ItemStack result = new ItemStack(EnderIO.itemItemConduit, 1, metaData);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,12 +13,17 @@ 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 {
|
||||
|
||||
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(ItemConduitRenderer::new);
|
||||
@Override
|
||||
public boolean isRendererForConduit(IConduit conduit) {
|
||||
if (conduit instanceof IItemConduit) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x,
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.enderio.core.common.util.RoundRobinIterator;
|
||||
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.item.filter.IItemFilter;
|
||||
import crazypants.enderio.conduit.item.filter.ItemFilterLimited;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.invpanel.TileInventoryPanel;
|
||||
|
||||
@@ -156,7 +155,6 @@ public class NetworkedInventory {
|
||||
int numSlots = slotIndices.length;
|
||||
ItemStack extractItem = null;
|
||||
int maxExtracted = con.getMaximumExtracted(conDir);
|
||||
final IItemFilter filter = con.getInputFilter(conDir);
|
||||
|
||||
int slot = -1;
|
||||
int slotChecksPerTick = Math.min(numSlots, ItemConduitNetwork.MAX_SLOT_CHECK_PER_TICK);
|
||||
@@ -164,23 +162,12 @@ public class NetworkedInventory {
|
||||
int index = nextSlot(numSlots);
|
||||
slot = slotIndices[index];
|
||||
ItemStack item = getInventory().getStackInSlot(slot);
|
||||
if (item != null) {
|
||||
if (filter != null && filter.isLimited()) {
|
||||
final int count = ((ItemFilterLimited) filter).getInsertLimitInv(getInventory(), item);
|
||||
if (count <= 0) {
|
||||
continue;
|
||||
} else if (count < item.stackSize) {
|
||||
item = item.copy();
|
||||
item.stackSize = count;
|
||||
}
|
||||
}
|
||||
if (canExtractItem(item)) {
|
||||
extractItem = item.copy();
|
||||
if (getInventory().canExtractItem(slot, extractItem, inventorySide)) {
|
||||
if (doTransfer(extractItem, slot, maxExtracted)) {
|
||||
setNextStartingSlot(slot);
|
||||
return true;
|
||||
}
|
||||
if (canExtractItem(item)) {
|
||||
extractItem = item.copy();
|
||||
if (getInventory().canExtractItem(slot, extractItem, inventorySide)) {
|
||||
if (doTransfer(extractItem, slot, maxExtracted)) {
|
||||
setNextStartingSlot(slot);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,11 +183,7 @@ public class NetworkedInventory {
|
||||
if (filter == null) {
|
||||
return true;
|
||||
}
|
||||
if (filter.isLimited()) {
|
||||
return filter.isValid() && ((ItemFilterLimited) filter).doesItemPassFilterInv(this, itemStack);
|
||||
} else {
|
||||
return filter.doesItemPassFilter(this, itemStack);
|
||||
}
|
||||
return filter.doesItemPassFilter(this, itemStack);
|
||||
}
|
||||
|
||||
private boolean doTransfer(ItemStack extractedItem, int slot, int maxExtract) {
|
||||
@@ -295,20 +278,7 @@ public class NetworkedInventory {
|
||||
}
|
||||
IItemFilter filter = con.getOutputFilter(conDir);
|
||||
if (filter != null) {
|
||||
if (filter.isLimited()) {
|
||||
final int count = filter.getMaxCountThatCanPassFilter(item);
|
||||
if (count <= 0) {
|
||||
return 0;
|
||||
} else {
|
||||
final int maxInsert = ((ItemFilterLimited) filter).getInsertLimit(getInventory(), item);
|
||||
if (maxInsert <= 0) {
|
||||
return 0;
|
||||
} else if (maxInsert < item.stackSize) {
|
||||
item = item.copy();
|
||||
item.stackSize = maxInsert;
|
||||
}
|
||||
}
|
||||
} else if (!filter.doesItemPassFilter(this, item)) {
|
||||
if (!filter.doesItemPassFilter(this, item)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public interface IItemFilter {
|
||||
|
||||
/**
|
||||
* Checks if the given item passes the filter or not.
|
||||
*
|
||||
*
|
||||
* @param inv the attached inventory - or null when used without an inventory (eg for a GUI)
|
||||
* @param item the item to check
|
||||
* @return true if the item is allowed to pass
|
||||
@@ -41,18 +41,10 @@ public interface IItemFilter {
|
||||
|
||||
boolean isValid();
|
||||
|
||||
default boolean isLimited() {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean isSticky();
|
||||
|
||||
void createGhostSlots(List<GhostSlot> slots, int xOffset, int yOffset, Runnable cb);
|
||||
|
||||
default int getMaxCountThatCanPassFilter(ItemStack item) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int getSlotCount();
|
||||
|
||||
default String getUnlocalizedName() {
|
||||
|
||||
@@ -98,7 +98,7 @@ public class ItemFilter implements IInventory, IItemFilter {
|
||||
return isBlacklist ? !allow : allow;
|
||||
}
|
||||
|
||||
protected boolean itemMatched(ItemStack item) {
|
||||
private boolean itemMatched(ItemStack item) {
|
||||
if (item == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ public class ItemFilter implements IInventory, IItemFilter {
|
||||
return matched;
|
||||
}
|
||||
|
||||
protected boolean isOreDicMatch(int filterItemIndex, ItemStack item) {
|
||||
private boolean isOreDicMatch(int filterItemIndex, ItemStack item) {
|
||||
int[] ids1 = getCachedIds(filterItemIndex);
|
||||
if (ids1 == null || ids1.length == 0) {
|
||||
return false;
|
||||
@@ -164,9 +164,8 @@ public class ItemFilter implements IInventory, IItemFilter {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isNBTMatch(ItemStack filter, ItemStack item) {
|
||||
if (filter.stackTagCompound == null && (item.stackTagCompound == null || item.stackTagCompound.hasNoTags()))
|
||||
return true;
|
||||
private boolean isNBTMatch(ItemStack filter, ItemStack item) {
|
||||
if (filter.stackTagCompound == null && item.stackTagCompound == null) return true;
|
||||
if (filter.stackTagCompound == null || item.stackTagCompound == null) return false;
|
||||
if (!filter.getTagCompound().hasKey("GEN")) return filter.stackTagCompound.equals(item.stackTagCompound);
|
||||
NBTTagCompound filterTag = (NBTTagCompound) filter.getTagCompound().copy();
|
||||
@@ -203,7 +202,7 @@ public class ItemFilter implements IInventory, IItemFilter {
|
||||
return !isItemListEmpty();
|
||||
}
|
||||
|
||||
protected boolean isItemListEmpty() {
|
||||
private boolean isItemListEmpty() {
|
||||
for (ItemStack item : items) {
|
||||
if (item != null) {
|
||||
return false;
|
||||
|
||||
@@ -1,242 +0,0 @@
|
||||
package crazypants.enderio.conduit.item.filter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import com.enderio.core.client.gui.widget.GhostSlot;
|
||||
|
||||
import cofh.lib.util.helpers.MathHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.conduit.gui.GuiExternalConnection;
|
||||
import crazypants.enderio.conduit.gui.item.IItemFilterGui;
|
||||
import crazypants.enderio.conduit.gui.item.ItemConduitFilterContainer;
|
||||
import crazypants.enderio.conduit.gui.item.LimitedItemFilterGui;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.item.NetworkedInventory;
|
||||
|
||||
public class ItemFilterLimited extends ItemFilter {
|
||||
|
||||
public ItemFilterLimited() {
|
||||
this(10, true);
|
||||
}
|
||||
|
||||
public ItemFilterLimited(int numItems, boolean isAdvanced) {
|
||||
super(numItems, isAdvanced);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "Limited Item Filter";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IItemFilterGui getGui(GuiExternalConnection gui, IItemConduit itemConduit, boolean isInput) {
|
||||
ItemConduitFilterContainer cont = new ItemConduitFilterContainer(itemConduit, gui.getDir(), isInput);
|
||||
LimitedItemFilterGui limitedItemFilterGui = new LimitedItemFilterGui(gui, cont, !isInput, isInput);
|
||||
limitedItemFilterGui.createFilterSlots();
|
||||
return limitedItemFilterGui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createGhostSlots(List<GhostSlot> slots, int xOffset, int yOffset, Runnable cb) {
|
||||
int index = 0;
|
||||
int numRows = (int) (double) (items.length / 5);
|
||||
for (int row = 0; row < numRows; ++row) {
|
||||
for (int col = 0; col < 5; ++col) {
|
||||
int x = xOffset + col * 18;
|
||||
int y = yOffset + row * 20;
|
||||
slots.add(new ItemFilterGhostSlot(index, x, y, cb));
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxCountThatCanPassFilter(ItemStack item) {
|
||||
if (item == null || item.getItem() == null) {
|
||||
return 0;
|
||||
}
|
||||
int count = 0;
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
ItemStack invStack = items[i];
|
||||
if (invStack != null && itemStackMatched(invStack, item, i)) {
|
||||
count += invStack.stackSize;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLimited() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getInsertLimit(ISidedInventory inv, ItemStack item) {
|
||||
if (item == null || item.getItem() == null) {
|
||||
return 0;
|
||||
}
|
||||
int count = 0;
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
ItemStack invStack = inv.getStackInSlot(i);
|
||||
if (invStack != null && itemStackMatched(invStack, item, i)) {
|
||||
count += invStack.stackSize;
|
||||
}
|
||||
}
|
||||
return getMaxCountThatCanPassFilter(item) - count;
|
||||
}
|
||||
|
||||
public int getInsertLimitInv(ISidedInventory inv, ItemStack item) {
|
||||
return -getInsertLimit(inv, item);
|
||||
}
|
||||
|
||||
public boolean doesCountPassFilter(int maxCount) {
|
||||
return maxCount > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesItemPassFilter(NetworkedInventory inv, ItemStack item) {
|
||||
return isValid() && itemMatched(item) && doesCountPassFilter(getInsertLimit(inv.getInventory(), item));
|
||||
|
||||
}
|
||||
|
||||
// Filter in extract slot
|
||||
public boolean doesItemPassFilterInv(NetworkedInventory inv, ItemStack item) {
|
||||
return isValid() && itemMatched(item) && doesCountPassFilter(getInsertLimitInv(inv.getInventory(), item));
|
||||
}
|
||||
|
||||
protected boolean itemStackMatched(ItemStack item, ItemStack filter, int slot) {
|
||||
if (item == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean checkDamage = fuzzyMode != FuzzyMode.DISABLED;
|
||||
boolean damageMatched = false;
|
||||
if (checkDamage && item.getItem().isDamageable()) {
|
||||
damageMatched = fuzzyMode.compare(item);
|
||||
}
|
||||
|
||||
if (isItemListEmpty()) {
|
||||
if (checkDamage) {
|
||||
return damageMatched;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
boolean matched = false;
|
||||
|
||||
if (filter != null && item.getItem() == filter.getItem()) {
|
||||
matched = true;
|
||||
|
||||
if (checkDamage && !damageMatched) {
|
||||
matched = false;
|
||||
} else if (matchMeta && item.getItemDamage() != filter.getItemDamage()) {
|
||||
matched = false;
|
||||
} else if (matchNBT && !isNBTMatch(item, filter)) {
|
||||
matched = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!matched && useOreDict && isOreDicMatch(filter, item)) {
|
||||
matched = true;
|
||||
}
|
||||
return matched;
|
||||
}
|
||||
|
||||
public boolean isOreDicMatch(ItemStack filter, ItemStack item) {
|
||||
int[] id_filter = OreDictionary.getOreIDs(filter);
|
||||
if (id_filter.length == 0) {
|
||||
return false;
|
||||
}
|
||||
int[] id_item = OreDictionary.getOreIDs(item);
|
||||
if (id_item.length == 0) {
|
||||
return false;
|
||||
}
|
||||
for (int id1 : id_filter) {
|
||||
for (int id2 : id_item) {
|
||||
if (id1 == id2) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int fromSlot, int amount) {
|
||||
if ((fromSlot < 0) || (fromSlot >= items.length)) {
|
||||
return null;
|
||||
}
|
||||
oreIds.set(fromSlot, null);
|
||||
ItemStack item = items[fromSlot];
|
||||
items[fromSlot] = null;
|
||||
return item.splitStack(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Limited" + super.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return "gui.limited_item_filter";
|
||||
}
|
||||
|
||||
class ItemFilterGhostSlot extends GhostSlot {
|
||||
|
||||
private final int slot;
|
||||
private final Runnable cb;
|
||||
|
||||
private final int adjustOnShift;
|
||||
|
||||
ItemFilterGhostSlot(int slot, int x, int y, Runnable cb) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.slot = slot;
|
||||
this.cb = cb;
|
||||
this.displayStdOverlay = true;
|
||||
this.stackSizeLimit = 64;
|
||||
this.adjustOnShift = 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStack(ItemStack stack) {
|
||||
if (stack != null) {
|
||||
stack = stack.copy();
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
|
||||
if (Mouse.isButtonDown(0) || Mouse.getEventDWheel() > 0) {
|
||||
if (stack.stackSize - 1 == 1) {
|
||||
stack.stackSize += adjustOnShift - 2;
|
||||
} else {
|
||||
stack.stackSize = MathHelper
|
||||
.clamp(stack.stackSize + adjustOnShift - 1, 1, stack.getMaxStackSize());
|
||||
}
|
||||
} else if (Mouse.isButtonDown(1) || Mouse.getEventDWheel() < 0) {
|
||||
if (stack.stackSize + 1 == 1) {
|
||||
stack.stackSize++;
|
||||
} else {
|
||||
stack.stackSize = MathHelper
|
||||
.clamp(stack.stackSize - adjustOnShift + 1, 1, stack.getMaxStackSize());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
items[slot] = stack;
|
||||
cb.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
return items[slot];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package crazypants.enderio.conduit.item.filter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import com.enderio.core.api.client.gui.IResourceTooltipProvider;
|
||||
import com.enderio.core.client.handlers.SpecialTooltipHandler;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.conduit.item.FilterRegister;
|
||||
|
||||
public class ItemLimitedItemFilter extends Item implements IItemFilterUpgrade, IResourceTooltipProvider {
|
||||
|
||||
public static ItemLimitedItemFilter create() {
|
||||
ItemLimitedItemFilter result = new ItemLimitedItemFilter();
|
||||
result.init();
|
||||
return result;
|
||||
}
|
||||
|
||||
protected ItemLimitedItemFilter() {
|
||||
setCreativeTab(EnderIOTab.tabEnderIO);
|
||||
setUnlocalizedName(ModObject.itemLimitedItemFilter.unlocalisedName);
|
||||
setMaxDamage(0);
|
||||
setMaxStackSize(64);
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
GameRegistry.registerItem(this, ModObject.itemLimitedItemFilter.unlocalisedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemFilter createFilterFromStack(ItemStack stack) {
|
||||
IItemFilter filter = new ItemFilterLimited();
|
||||
if (stack.stackTagCompound != null && stack.stackTagCompound.hasKey("filter")) {
|
||||
filter.readFromNBT(stack.stackTagCompound.getCompoundTag("filter"));
|
||||
}
|
||||
return filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister IIconRegister) {
|
||||
itemIcon = IIconRegister.registerIcon("enderio:limitedItemFilter");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedNameForTooltip(ItemStack stack) {
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
if (FilterRegister.isFilterSet(par1ItemStack)) {
|
||||
if (SpecialTooltipHandler.showAdvancedTooltips()) {
|
||||
par3List.add(EnumChatFormatting.ITALIC + EnderIO.lang.localize("itemConduitFilterUpgrade.configured"));
|
||||
par3List.add(
|
||||
EnumChatFormatting.ITALIC
|
||||
+ EnderIO.lang.localize("itemConduitFilterUpgrade.clearConfigMethod"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.ModObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author matthias
|
||||
*/
|
||||
public class ItemPowerItemFilter extends Item implements IItemFilterUpgrade, IResourceTooltipProvider {
|
||||
|
||||
@@ -5,10 +5,11 @@ import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
|
||||
import com.enderio.core.client.gui.widget.GhostSlot;
|
||||
import com.enderio.core.common.network.NetworkUtil;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.conduit.gui.GuiExternalConnection;
|
||||
@@ -19,6 +20,7 @@ import crazypants.enderio.conduit.item.NetworkedInventory;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author matthias
|
||||
*/
|
||||
public class PowerItemFilter implements IItemFilter {
|
||||
|
||||
@@ -34,7 +34,6 @@ 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;
|
||||
@@ -47,14 +46,9 @@ 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<>();
|
||||
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
|
||||
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() {
|
||||
|
||||
@@ -16,7 +16,6 @@ import com.enderio.core.common.util.BlockCoord;
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
import com.enderio.core.common.util.FluidUtil;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.AbstractConduit;
|
||||
import crazypants.enderio.conduit.ConduitUtil;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
@@ -24,8 +23,6 @@ import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.enderio.machine.reservoir.TileReservoir;
|
||||
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
|
||||
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
|
||||
|
||||
public abstract class AbstractLiquidConduit extends AbstractConduit implements ILiquidConduit {
|
||||
|
||||
@@ -57,12 +54,6 @@ public abstract class AbstractLiquidConduit extends AbstractConduit implements I
|
||||
if (h == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (EnderIO.hasGT5 && h instanceof IGregTechTileEntity) {
|
||||
IMetaTileEntity mte = ((IGregTechTileEntity) h).getMetaTileEntity();
|
||||
return mte != null && mte.getCapacity() > 0;
|
||||
}
|
||||
|
||||
// TODO: This check was added to work around a bug in dynamic tanks, but
|
||||
// it causes issues with not conecting to empty tanks such as dim. trans +
|
||||
// BC fluid pipes, so I am removing it for now.
|
||||
@@ -157,11 +148,11 @@ public abstract class AbstractLiquidConduit extends AbstractConduit implements I
|
||||
boolean res;
|
||||
if (mode == RedstoneControlMode.OFF) {
|
||||
// if checking for no signal, must be no signal from both
|
||||
res = RedstoneControlMode.isConditionMet(mode, signal)
|
||||
res = mode.isConditionMet(mode, signal)
|
||||
&& (col != DyeColor.RED || isConditionMetByExternalSignal(dir, mode, col));
|
||||
} else {
|
||||
// if checking for a signal, either is fine
|
||||
res = RedstoneControlMode.isConditionMet(mode, signal)
|
||||
res = mode.isConditionMet(mode, signal)
|
||||
|| (col == DyeColor.RED && isConditionMetByExternalSignal(dir, mode, col));
|
||||
}
|
||||
return res;
|
||||
@@ -180,12 +171,7 @@ public abstract class AbstractLiquidConduit extends AbstractConduit implements I
|
||||
}
|
||||
}
|
||||
|
||||
return RedstoneControlMode.isConditionMet(mode, externalSignal);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ConnectionMode getDefaultConnectionMode() {
|
||||
return ConnectionMode.INPUT;
|
||||
return mode.isConditionMet(mode, externalSignal);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,7 +23,6 @@ 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;
|
||||
|
||||
@@ -38,12 +37,7 @@ 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<>();
|
||||
|
||||
@Override
|
||||
public ConduitRenderer getRenderer() {
|
||||
return AdvancedLiquidConduitRenderer.instance.get();
|
||||
}
|
||||
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void initIcons() {
|
||||
|
||||
@@ -12,7 +12,6 @@ import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import com.enderio.core.common.util.FluidUtil;
|
||||
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
|
||||
public class AdvancedLiquidConduitNetwork extends AbstractTankConduitNetwork<AdvancedLiquidConduit> {
|
||||
|
||||
+16
-17
@@ -1,14 +1,16 @@
|
||||
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;
|
||||
@@ -21,13 +23,14 @@ 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 {
|
||||
|
||||
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal
|
||||
.withInitial(AdvancedLiquidConduitRenderer::new);
|
||||
@Override
|
||||
public boolean isRendererForConduit(IConduit conduit) {
|
||||
return conduit instanceof AdvancedLiquidConduit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x,
|
||||
@@ -55,8 +58,6 @@ 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;
|
||||
@@ -105,17 +106,15 @@ 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 (i = 0; i < corners.size(); i++) {
|
||||
final Vertex c = corners.get(i);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
for (Vertex c : corners) {
|
||||
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 (i = 0; i < corners.size(); i++) {
|
||||
final Vertex c = corners.get(i);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
for (Vertex c : corners) {
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,14 +127,14 @@ public class AdvancedLiquidConduitRenderer extends DefaultConduitRenderer {
|
||||
tex.getMaxU(),
|
||||
tex.getMinV(),
|
||||
tex.getMaxV());
|
||||
for (i = 0; i < corners.size(); i++) {
|
||||
final Vertex c = corners.get(i);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
for (Vertex c : corners) {
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
// back face
|
||||
for (i = corners.size() - 1; i >= 0; i--) {
|
||||
for (int i = corners.size() - 1; i >= 0; i--) {
|
||||
Vertex c = corners.get(i);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
package crazypants.enderio.conduit.liquid;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
@@ -13,13 +13,17 @@ 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 {
|
||||
|
||||
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal
|
||||
.withInitial(EnderLiquidConduitRenderer::new);
|
||||
@Override
|
||||
public boolean isRendererForConduit(IConduit conduit) {
|
||||
if (conduit instanceof AbstractEnderLiquidConduit) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x,
|
||||
|
||||
@@ -27,7 +27,6 @@ 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;
|
||||
|
||||
@@ -43,12 +42,7 @@ 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<>();
|
||||
|
||||
@Override
|
||||
public ConduitRenderer getRenderer() {
|
||||
return LiquidConduitRenderer.instance.get();
|
||||
}
|
||||
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void initIcons() {
|
||||
|
||||
@@ -10,7 +10,6 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
import crazypants.enderio.conduit.ConduitUtil;
|
||||
|
||||
public class LiquidConduitNetwork extends AbstractTankConduitNetwork<LiquidConduit> {
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package crazypants.enderio.conduit.liquid;
|
||||
|
||||
import static com.enderio.core.client.render.CubeRenderer.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
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;
|
||||
@@ -18,7 +19,6 @@ import net.minecraftforge.fluids.Fluid;
|
||||
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.util.ForgeDirectionOffsets;
|
||||
import com.enderio.core.common.vecmath.Vector2f;
|
||||
@@ -32,22 +32,32 @@ 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;
|
||||
|
||||
public LiquidConduitRenderer() {
|
||||
private LiquidConduitRenderer() {
|
||||
super();
|
||||
RenderUtil.registerReloadListener(this);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,19 +92,16 @@ public class LiquidConduitRenderer extends DefaultConduitRenderer implements IRe
|
||||
}
|
||||
|
||||
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);
|
||||
for (Vertex c : corners) {
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
// back face
|
||||
for (i = corners.size() - 1; i >= 0; i--) {
|
||||
for (int i = corners.size() - 1; i >= 0; i--) {
|
||||
Vertex c = corners.get(i);
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,29 +121,27 @@ public class LiquidConduitRenderer extends DefaultConduitRenderer implements IRe
|
||||
}
|
||||
}
|
||||
|
||||
private static final Map<CollidableComponent, Map<Fluid, List<CachableRenderStatement>>> cache = Collections
|
||||
.synchronizedMap(new WeakHashMap<>());
|
||||
private static Map<CollidableComponent, Map<Fluid, List<CachableRenderStatement>>> cache = new WeakHashMap<CollidableComponent, Map<Fluid, List<CachableRenderStatement>>>();
|
||||
|
||||
public static List<CachableRenderStatement> computeFluidOutlineToCache(CollidableComponent component, Fluid fluid,
|
||||
double scaleFactor, float outlineWidth) {
|
||||
|
||||
// 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.
|
||||
Map<Fluid, List<CachableRenderStatement>> cache0 = cache.get(component);
|
||||
if (cache0 == null) {
|
||||
cache0 = new HashMap<Fluid, List<CachableRenderStatement>>();
|
||||
cache.put(component, cache0);
|
||||
}
|
||||
List<CachableRenderStatement> data = cache0.get(fluid);
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
data = new ArrayList<>();
|
||||
data = new ArrayList<CachableRenderStatement>();
|
||||
cache0.put(fluid, data);
|
||||
|
||||
IIcon texture = fluid.getStillIcon();
|
||||
if (texture == null) {
|
||||
texture = fluid.getIcon();
|
||||
if (texture == null) {
|
||||
cache0.put(fluid, data);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -195,7 +200,6 @@ public class LiquidConduitRenderer extends DefaultConduitRenderer implements IRe
|
||||
}
|
||||
}
|
||||
}
|
||||
cache0.put(fluid, data);
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -300,7 +304,7 @@ public class LiquidConduitRenderer extends DefaultConduitRenderer implements IRe
|
||||
float transY = (bound.sizeY() - sizeY) / 2;
|
||||
|
||||
Vector3d translation = new Vector3d(0, transY, 0);
|
||||
CubeRenderer.get().setupVertices(bound.translate(translation));
|
||||
setupVertices(bound.translate(translation));
|
||||
}
|
||||
|
||||
private void calculateRatios(LiquidConduit conduit) {
|
||||
|
||||
@@ -12,9 +12,6 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
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;
|
||||
@@ -22,6 +19,10 @@ import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
|
||||
import com.enderio.core.client.render.IconUtil;
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.AbstractConduit;
|
||||
@@ -33,17 +34,10 @@ 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;
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package crazypants.enderio.conduit.oc;
|
||||
|
||||
import li.cil.oc.api.network.Environment;
|
||||
import li.cil.oc.api.network.SidedEnvironment;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
@@ -7,24 +10,16 @@ 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;
|
||||
|
||||
@InterfaceList({ @Interface(iface = "li.cil.oc.api.network.Environment", modid = "OpenComputersAPI|Network"),
|
||||
@Interface(iface = "li.cil.oc.api.network.SidedEnvironment", modid = "OpenComputersAPI|Network") })
|
||||
public interface IOCConduit extends IConduit, Environment, SidedEnvironment {
|
||||
|
||||
String COLOR_CONTROLLER_ID = "ColorController";
|
||||
|
||||
@Override
|
||||
default ConduitRenderer getRenderer() {
|
||||
return OCConduitRenderer.instance.get();
|
||||
}
|
||||
public static final String COLOR_CONTROLLER_ID = "ColorController";
|
||||
|
||||
void invalidate();
|
||||
|
||||
void setSignalColor(ForgeDirection dir, DyeColor col);
|
||||
public abstract void setSignalColor(ForgeDirection dir, DyeColor col);
|
||||
|
||||
DyeColor getSignalColor(ForgeDirection dir);
|
||||
public abstract DyeColor getSignalColor(ForgeDirection dir);
|
||||
}
|
||||
@@ -9,6 +9,11 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import li.cil.oc.api.network.Environment;
|
||||
import li.cil.oc.api.network.Message;
|
||||
import li.cil.oc.api.network.Node;
|
||||
import li.cil.oc.api.network.SidedEnvironment;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -40,10 +45,6 @@ import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.geom.ConduitGeometryUtil;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.tool.ToolUtil;
|
||||
import li.cil.oc.api.network.Environment;
|
||||
import li.cil.oc.api.network.Message;
|
||||
import li.cil.oc.api.network.Node;
|
||||
import li.cil.oc.api.network.SidedEnvironment;
|
||||
|
||||
public class OCConduit extends AbstractConduit implements IOCConduit {
|
||||
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
package crazypants.enderio.conduit.oc;
|
||||
|
||||
import li.cil.oc.api.Network;
|
||||
import li.cil.oc.api.network.ManagedEnvironment;
|
||||
import li.cil.oc.api.network.Message;
|
||||
import li.cil.oc.api.network.Node;
|
||||
import li.cil.oc.api.network.Visibility;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
@@ -7,11 +13,6 @@ import com.enderio.core.common.util.DyeColor;
|
||||
import cpw.mods.fml.common.Optional.Interface;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
import li.cil.oc.api.Network;
|
||||
import li.cil.oc.api.network.ManagedEnvironment;
|
||||
import li.cil.oc.api.network.Message;
|
||||
import li.cil.oc.api.network.Node;
|
||||
import li.cil.oc.api.network.Visibility;
|
||||
|
||||
@Interface(iface = "li.cil.oc.api.network.ManagedEnvironment", modid = "OpenComputersAPI|Network")
|
||||
public class OCConduitNetwork extends AbstractConduitNetwork<IOCConduit, IOCConduit> implements ManagedEnvironment {
|
||||
|
||||
@@ -7,12 +7,14 @@ 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 {
|
||||
|
||||
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(OCConduitRenderer::new);
|
||||
@Override
|
||||
public boolean isRendererForConduit(IConduit conduit) {
|
||||
return conduit instanceof IOCConduit;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderConduit(IIcon tex, IConduit conduit, CollidableComponent component, float selfIllum) {
|
||||
@@ -21,7 +23,7 @@ public class OCConduitRenderer extends DefaultConduitRenderer {
|
||||
int c = ((IOCConduit) conduit).getSignalColor(component.dir).getColor();
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setColorOpaque_I(c);
|
||||
CubeRenderer.get().render(component.bound, tex);
|
||||
CubeRenderer.render(component.bound, tex);
|
||||
tessellator.setColorOpaque(255, 255, 255);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -6,7 +6,6 @@ import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.network.PacketUtil;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class AbstractConduitPacket<T extends IConduit> extends AbstractConduitBundlePacket {
|
||||
@@ -51,12 +50,4 @@ public class AbstractConduitPacket<T extends IConduit> extends AbstractConduitBu
|
||||
IConduitBundle bundle = (IConduitBundle) te;
|
||||
return (T) bundle.getConduit(getConType());
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates if TileEntity received from client is actually the one player is interacting with. It prevents
|
||||
* malicious user disturbing random machine settings etc.
|
||||
*/
|
||||
protected static boolean isInvalidPacketForGui(AbstractConduitPacket<?> message, MessageContext ctx) {
|
||||
return PacketUtil.isInvalidPacketForGui(ctx, message.getTileEntity(message.getWorld(ctx)), message.getClass());
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,6 @@ public class PacketConnectionMode extends AbstractConduitPacket<IConduit>
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketConnectionMode message, MessageContext ctx) {
|
||||
if (isInvalidPacketForGui(message, ctx)) return null;
|
||||
IConduit conduit = message.getTileCasted(ctx);
|
||||
if (conduit == null) {
|
||||
return null;
|
||||
|
||||
@@ -45,7 +45,6 @@ public class PacketExtractMode extends AbstractConduitPacket<IExtractor>
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketExtractMode message, MessageContext ctx) {
|
||||
if (isInvalidPacketForGui(message, ctx)) return null;
|
||||
message.getTileCasted(ctx).setExtractionRedstoneMode(message.mode, message.dir);
|
||||
message.getTileCasted(ctx).setExtractionSignalColor(message.dir, message.color);
|
||||
message.getWorld(ctx).markBlockForUpdate(message.x, message.y, message.z);
|
||||
|
||||
@@ -68,7 +68,6 @@ public class PacketItemConduitFilter extends AbstractConduitPacket<IItemConduit>
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketItemConduitFilter message, MessageContext ctx) {
|
||||
if (isInvalidPacketForGui(message, ctx)) return null;
|
||||
IItemConduit conduit = message.getTileCasted(ctx);
|
||||
conduit.setSelfFeedEnabled(message.dir, message.loopMode);
|
||||
conduit.setRoundRobinEnabled(message.dir, message.roundRobin);
|
||||
|
||||
@@ -40,7 +40,6 @@ public class PacketOCConduitSignalColor extends AbstractConduitPacket<IOCConduit
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketOCConduitSignalColor message, MessageContext ctx) {
|
||||
if (isInvalidPacketForGui(message, ctx)) return null;
|
||||
message.getTileCasted(ctx).setSignalColor(message.dir, message.col);
|
||||
message.getWorld(ctx).markBlockForUpdate(message.x, message.y, message.z);
|
||||
return null;
|
||||
|
||||
-1
@@ -38,7 +38,6 @@ public class PacketRedstoneConduitOutputStrength extends AbstractConduitPacket<I
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketRedstoneConduitOutputStrength message, MessageContext ctx) {
|
||||
if (isInvalidPacketForGui(message, ctx)) return null;
|
||||
IInsulatedRedstoneConduit tile = message.getTileCasted(ctx);
|
||||
if (tile != null) {
|
||||
tile.setOutputStrength(message.dir, message.isStrong);
|
||||
|
||||
@@ -40,7 +40,6 @@ public class PacketRedstoneConduitSignalColor extends AbstractConduitPacket<IIns
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketRedstoneConduitSignalColor message, MessageContext ctx) {
|
||||
if (isInvalidPacketForGui(message, ctx)) return null;
|
||||
message.getTileCasted(ctx).setSignalColor(message.dir, message.col);
|
||||
message.getWorld(ctx).markBlockForUpdate(message.x, message.y, message.z);
|
||||
return null;
|
||||
|
||||
@@ -39,7 +39,6 @@ public class PacketRoundRobinMode extends AbstractConduitPacket<ILiquidConduit>
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketRoundRobinMode message, MessageContext ctx) {
|
||||
if (isInvalidPacketForGui(message, ctx)) return null;
|
||||
final ILiquidConduit conduit = message.getTileCasted(ctx);
|
||||
if (conduit instanceof AbstractEnderLiquidConduit) {
|
||||
((AbstractEnderLiquidConduit) conduit).setRoundRobin(message.dir, message.roundRobin);
|
||||
|
||||
@@ -5,25 +5,19 @@ 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 {
|
||||
|
||||
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 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 COLOR_CONTROLLER_ID = "ColorController";
|
||||
|
||||
@Override
|
||||
default ConduitRenderer getRenderer() {
|
||||
return PowerConduitRenderer.instance.get();
|
||||
}
|
||||
public static final String COLOR_CONTROLLER_ID = "ColorController";
|
||||
|
||||
IPowerInterface getExternalPowerReceptor(ForgeDirection direction);
|
||||
|
||||
|
||||
@@ -68,21 +68,17 @@ public class PowerConduit extends AbstractConduit implements IPowerConduit {
|
||||
}
|
||||
|
||||
public static void initIcons() {
|
||||
initIcons(POSTFIX, ICONS);
|
||||
}
|
||||
|
||||
protected static void initIcons(String[] postfix, Map<String, IIcon> icons) {
|
||||
IconUtil.addIconProvider(new IconUtil.IIconProvider() {
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
for (String pf : postfix) {
|
||||
icons.put(ICON_KEY + pf, register.registerIcon(ICON_KEY + pf));
|
||||
icons.put(ICON_KEY_INPUT + pf, register.registerIcon(ICON_KEY_INPUT));
|
||||
icons.put(ICON_KEY_OUTPUT + pf, register.registerIcon(ICON_KEY_OUTPUT));
|
||||
icons.put(ICON_CORE_KEY + pf, register.registerIcon(ICON_CORE_KEY + pf));
|
||||
for (String pf : POSTFIX) {
|
||||
ICONS.put(ICON_KEY + pf, register.registerIcon(ICON_KEY + pf));
|
||||
ICONS.put(ICON_KEY_INPUT + pf, register.registerIcon(ICON_KEY_INPUT));
|
||||
ICONS.put(ICON_KEY_OUTPUT + pf, register.registerIcon(ICON_KEY_OUTPUT));
|
||||
ICONS.put(ICON_CORE_KEY + pf, register.registerIcon(ICON_CORE_KEY + pf));
|
||||
}
|
||||
icons.put(ICON_TRANSMISSION_KEY, register.registerIcon(ICON_TRANSMISSION_KEY));
|
||||
ICONS.put(ICON_TRANSMISSION_KEY, register.registerIcon(ICON_TRANSMISSION_KEY));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -123,10 +119,6 @@ public class PowerConduit extends AbstractConduit implements IPowerConduit {
|
||||
this.subtype = meta;
|
||||
}
|
||||
|
||||
protected int getSubtype() {
|
||||
return subtype;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getConnectionsDirty() {
|
||||
return connectionsDirty;
|
||||
|
||||
@@ -17,13 +17,15 @@ 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 {
|
||||
|
||||
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(PowerConduitRenderer::new);
|
||||
@Override
|
||||
public boolean isRendererForConduit(IConduit conduit) {
|
||||
return conduit instanceof IPowerConduit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x,
|
||||
@@ -66,7 +68,7 @@ public class PowerConduitRenderer extends DefaultConduitRenderer {
|
||||
Vector3d trans = ForgeDirectionOffsets.offsetScaled(component.dir, -0.075);
|
||||
bound = bound.translate(trans);
|
||||
}
|
||||
CubeRenderer.get().render(bound, tex);
|
||||
CubeRenderer.render(bound, tex);
|
||||
tessellator.setColorOpaque(255, 255, 255);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -2,20 +2,51 @@ package crazypants.enderio.conduit.power.endergy;
|
||||
|
||||
import static crazypants.enderio.config.Config.powerConduitEndergyTiers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
import com.enderio.core.client.render.IconUtil;
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
import com.enderio.core.common.vecmath.Vector3d;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
import crazypants.enderio.conduit.ConduitUtil;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.conduit.RaytraceResult;
|
||||
import crazypants.enderio.conduit.geom.CollidableCache.CacheKey;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.geom.ConduitGeometryUtil;
|
||||
import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
import crazypants.enderio.conduit.power.PowerConduit;
|
||||
import crazypants.enderio.conduit.power.PowerConduitNetwork;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.item.PacketConduitProbe;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.enderio.power.BasicCapacitor;
|
||||
import crazypants.enderio.power.ICapacitor;
|
||||
import crazypants.enderio.power.IPowerInterface;
|
||||
import crazypants.enderio.power.PowerHandlerUtil;
|
||||
import crazypants.enderio.tool.ToolUtil;
|
||||
|
||||
public class PowerConduitEndergy extends PowerConduit {
|
||||
|
||||
@@ -45,51 +76,487 @@ public class PowerConduitEndergy extends PowerConduit {
|
||||
}
|
||||
|
||||
public static void initIcons() {
|
||||
initIcons(POSTFIX, ICONS);
|
||||
IconUtil.addIconProvider(new IconUtil.IIconProvider() {
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
for (String pf : POSTFIX) {
|
||||
ICONS.put(ICON_KEY + pf, register.registerIcon(ICON_KEY + pf));
|
||||
ICONS.put(ICON_KEY_INPUT + pf, register.registerIcon(ICON_KEY_INPUT));
|
||||
ICONS.put(ICON_KEY_OUTPUT + pf, register.registerIcon(ICON_KEY_OUTPUT));
|
||||
ICONS.put(ICON_CORE_KEY + pf, register.registerIcon(ICON_CORE_KEY + pf));
|
||||
}
|
||||
ICONS.put(ICON_TRANSMISSION_KEY, register.registerIcon(ICON_TRANSMISSION_KEY));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTextureType() {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public PowerConduitEndergy() {
|
||||
super();
|
||||
}
|
||||
public static final float WIDTH = 0.075f;
|
||||
public static final float HEIGHT = 0.075f;
|
||||
|
||||
public static final Vector3d MIN = new Vector3d(0.5f - WIDTH, 0.5 - HEIGHT, 0.5 - WIDTH);
|
||||
public static final Vector3d MAX = new Vector3d(MIN.x + WIDTH, MIN.y + HEIGHT, MIN.z + WIDTH);
|
||||
|
||||
public static final BoundingBox BOUNDS = new BoundingBox(MIN, MAX);
|
||||
|
||||
protected PowerConduitNetwork network;
|
||||
|
||||
private int energyStoredRF;
|
||||
|
||||
private int subtype;
|
||||
|
||||
protected final EnumMap<ForgeDirection, RedstoneControlMode> rsModes = new EnumMap<ForgeDirection, RedstoneControlMode>(
|
||||
ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> rsColors = new EnumMap<ForgeDirection, DyeColor>(
|
||||
ForgeDirection.class);
|
||||
|
||||
protected EnumMap<ForgeDirection, Long> recievedTicks;
|
||||
|
||||
private final Map<ForgeDirection, Integer> externalRedstoneSignals = new HashMap<ForgeDirection, Integer>();
|
||||
|
||||
private boolean redstoneStateDirty = true;
|
||||
|
||||
public PowerConduitEndergy() {}
|
||||
|
||||
public PowerConduitEndergy(int meta) {
|
||||
super(meta);
|
||||
this.subtype = meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getConnectionsDirty() {
|
||||
return connectionsDirty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(EntityPlayer player, RaytraceResult res, List<RaytraceResult> all) {
|
||||
DyeColor col = DyeColor.getColorFromDye(player.getCurrentEquippedItem());
|
||||
if (ConduitUtil.isProbeEquipped(player)) {
|
||||
if (!player.worldObj.isRemote) {
|
||||
new PacketConduitProbe().sendInfoMessage(player, this);
|
||||
}
|
||||
return true;
|
||||
} else if (col != null && res.component != null && isColorBandRendered(res.component.dir)) {
|
||||
setExtractionSignalColor(res.component.dir, col);
|
||||
return true;
|
||||
} else if (ToolUtil.isToolEquipped(player)) {
|
||||
if (!getBundle().getEntity().getWorldObj().isRemote) {
|
||||
if (res != null && res.component != null) {
|
||||
ForgeDirection connDir = res.component.dir;
|
||||
ForgeDirection faceHit = ForgeDirection.getOrientation(res.movingObjectPosition.sideHit);
|
||||
if (connDir == ForgeDirection.UNKNOWN || connDir == faceHit) {
|
||||
if (getConnectionMode(faceHit) == ConnectionMode.DISABLED) {
|
||||
setConnectionMode(faceHit, getNextConnectionMode(faceHit));
|
||||
return true;
|
||||
}
|
||||
// Attempt to join networks
|
||||
return ConduitUtil.joinConduits(this, faceHit);
|
||||
} else if (externalConnections.contains(connDir)) {
|
||||
setConnectionMode(connDir, getNextConnectionMode(connDir));
|
||||
return true;
|
||||
} else if (containsConduitConnection(connDir)) {
|
||||
ConduitUtil.disconectConduits(this, connDir);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isColorBandRendered(ForgeDirection dir) {
|
||||
return getConnectionMode(dir) != ConnectionMode.DISABLED
|
||||
&& getExtractionRedstoneMode(dir) != RedstoneControlMode.IGNORE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICapacitor getCapacitor() {
|
||||
return getCapacitors()[getSubtype()];
|
||||
return getCapacitors()[subtype];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExtractionRedstoneMode(RedstoneControlMode mode, ForgeDirection dir) {
|
||||
rsModes.put(dir, mode);
|
||||
setClientStateDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RedstoneControlMode getExtractionRedstoneMode(ForgeDirection dir) {
|
||||
RedstoneControlMode res = rsModes.get(dir);
|
||||
if (res == null) {
|
||||
res = RedstoneControlMode.IGNORE;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExtractionSignalColor(ForgeDirection dir, DyeColor col) {
|
||||
rsColors.put(dir, col);
|
||||
setClientStateDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DyeColor getExtractionSignalColor(ForgeDirection dir) {
|
||||
DyeColor res = rsColors.get(dir);
|
||||
if (res == null) {
|
||||
res = DyeColor.RED;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
setExtractionSignalColor(dir, DyeColor.values()[dataRoot.getShort("extractionSignalColor")]);
|
||||
setExtractionRedstoneMode(RedstoneControlMode.values()[dataRoot.getShort("extractionRedstoneMode")], dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeTypeSettingsToNbt(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
dataRoot.setShort("extractionSignalColor", (short) getExtractionSignalColor(dir).ordinal());
|
||||
dataRoot.setShort("extractionRedstoneMode", (short) getExtractionRedstoneMode(dir).ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbtRoot) {
|
||||
super.writeToNBT(nbtRoot);
|
||||
nbtRoot.setShort("subtype", (short) subtype);
|
||||
nbtRoot.setInteger("energyStoredRF", energyStoredRF);
|
||||
|
||||
for (Entry<ForgeDirection, RedstoneControlMode> entry : rsModes.entrySet()) {
|
||||
if (entry.getValue() != null) {
|
||||
short ord = (short) entry.getValue().ordinal();
|
||||
nbtRoot.setShort("pRsMode." + entry.getKey().name(), ord);
|
||||
}
|
||||
}
|
||||
|
||||
for (Entry<ForgeDirection, DyeColor> entry : rsColors.entrySet()) {
|
||||
if (entry.getValue() != null) {
|
||||
short ord = (short) entry.getValue().ordinal();
|
||||
nbtRoot.setShort("pRsCol." + entry.getKey().name(), ord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbtRoot, short nbtVersion) {
|
||||
super.readFromNBT(nbtRoot, nbtVersion);
|
||||
subtype = nbtRoot.getShort("subtype");
|
||||
|
||||
if (nbtRoot.hasKey("energyStored")) {
|
||||
nbtRoot.setInteger("energyStoredRF", (int) (nbtRoot.getFloat("energyStored") * 10));
|
||||
}
|
||||
setEnergyStored(nbtRoot.getInteger("energyStoredRF"));
|
||||
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
String key = "pRsMode." + dir.name();
|
||||
if (nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if (ord >= 0 && ord < RedstoneControlMode.values().length) {
|
||||
rsModes.put(dir, RedstoneControlMode.values()[ord]);
|
||||
}
|
||||
}
|
||||
key = "pRsCol." + dir.name();
|
||||
if (nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if (ord >= 0 && ord < DyeColor.values().length) {
|
||||
rsColors.put(dir, DyeColor.values()[ord]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick() {}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored() {
|
||||
return energyStoredRF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergyStored(int energyStored) {
|
||||
energyStoredRF = MathHelper.clamp_int(energyStored, 0, getMaxEnergyStored());
|
||||
}
|
||||
|
||||
private boolean isRedstoneEnabled(ForgeDirection dir) {
|
||||
boolean result;
|
||||
RedstoneControlMode mode = getExtractionRedstoneMode(dir);
|
||||
if (mode == RedstoneControlMode.NEVER) {
|
||||
return false;
|
||||
}
|
||||
if (mode == RedstoneControlMode.IGNORE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
DyeColor col = getExtractionSignalColor(dir);
|
||||
int signal = ConduitUtil.getInternalSignalForColor(getBundle(), col);
|
||||
int exSig = getExternalRedstoneSignalForDir(dir);
|
||||
boolean res;
|
||||
if (mode == RedstoneControlMode.OFF) {
|
||||
// if checking for no signal, must be no signal from both
|
||||
res = mode.isConditionMet(mode, signal) && (col != DyeColor.RED || mode.isConditionMet(mode, exSig));
|
||||
} else {
|
||||
// if checking for a signal, either is fine
|
||||
res = mode.isConditionMet(mode, signal) || (col == DyeColor.RED && mode.isConditionMet(mode, exSig));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private int getExternalRedstoneSignalForDir(ForgeDirection dir) {
|
||||
if (redstoneStateDirty) {
|
||||
externalRedstoneSignals.clear();
|
||||
redstoneStateDirty = false;
|
||||
}
|
||||
Integer cached = externalRedstoneSignals.get(dir);
|
||||
int result;
|
||||
if (cached == null) {
|
||||
TileEntity te = getBundle().getEntity();
|
||||
result = te.getWorldObj().getStrongestIndirectPower(te.xCoord, te.yCoord, te.zCoord);
|
||||
externalRedstoneSignals.put(dir, result);
|
||||
} else {
|
||||
result = cached;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyRecieved(ForgeDirection dir) {
|
||||
ConnectionMode mode = getConnectionMode(dir);
|
||||
if (mode == ConnectionMode.OUTPUT || mode == ConnectionMode.DISABLED || !isRedstoneEnabled(dir)) {
|
||||
return 0;
|
||||
}
|
||||
return getCapacitor().getMaxEnergyReceived();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyExtracted(ForgeDirection dir) {
|
||||
ConnectionMode mode = getConnectionMode(dir);
|
||||
if (mode == ConnectionMode.INPUT || mode == ConnectionMode.DISABLED || !isRedstoneEnabled(dir)) {
|
||||
return 0;
|
||||
}
|
||||
if (recievedRfThisTick(dir)) {
|
||||
return 0;
|
||||
}
|
||||
return getCapacitor().getMaxEnergyExtracted();
|
||||
}
|
||||
|
||||
private boolean recievedRfThisTick(ForgeDirection dir) {
|
||||
if (recievedTicks == null || dir == null
|
||||
|| recievedTicks.get(dir) == null
|
||||
|| getBundle() == null
|
||||
|| getBundle().getWorld() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
long curTick = getBundle().getWorld().getTotalWorldTime();
|
||||
long recT = recievedTicks.get(dir);
|
||||
if (curTick - recT <= 5) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onNeighborBlockChange(Block blockId) {
|
||||
redstoneStateDirty = true;
|
||||
if (network != null && network.powerManager != null) {
|
||||
network.powerManager.receptorsChanged();
|
||||
}
|
||||
return super.onNeighborBlockChange(blockId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConnectionMode(ForgeDirection dir, ConnectionMode mode) {
|
||||
super.setConnectionMode(dir, mode);
|
||||
recievedTicks = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
if (getMaxEnergyRecieved(from) == 0 || maxReceive <= 0) {
|
||||
return 0;
|
||||
}
|
||||
int freeSpace = getMaxEnergyStored() - getEnergyStored();
|
||||
int result = (int) Math.min(maxReceive, freeSpace);
|
||||
if (!simulate && result > 0) {
|
||||
setEnergyStored(getEnergyStored() + result);
|
||||
|
||||
if (getBundle() != null) {
|
||||
if (recievedTicks == null) {
|
||||
recievedTicks = new EnumMap<ForgeDirection, Long>(ForgeDirection.class);
|
||||
}
|
||||
recievedTicks.put(from, getBundle().getWorld().getTotalWorldTime());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from) {
|
||||
return getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from) {
|
||||
return getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractConduitNetwork<?, ?> getNetwork() {
|
||||
return network;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setNetwork(AbstractConduitNetwork<?, ?> network) {
|
||||
this.network = (PowerConduitNetwork) network;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectToExternal(ForgeDirection direction, boolean ignoreDisabled) {
|
||||
IPowerInterface rec = getExternalPowerReceptor(direction);
|
||||
|
||||
return rec != null && rec.canConduitConnect(direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectToConduit(ForgeDirection direction, IConduit conduit) {
|
||||
boolean res = super.canConnectToConduit(direction, conduit);
|
||||
if (!res) {
|
||||
return false;
|
||||
}
|
||||
if (Config.powerConduitCanDifferentTiersConnect) {
|
||||
return res;
|
||||
}
|
||||
if (!(conduit instanceof IPowerConduit)) {
|
||||
return false;
|
||||
}
|
||||
IPowerConduit pc = (IPowerConduit) conduit;
|
||||
return pc.getMaxEnergyStored() == getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void externalConnectionAdded(ForgeDirection direction) {
|
||||
super.externalConnectionAdded(direction);
|
||||
if (network != null) {
|
||||
TileEntity te = bundle.getEntity();
|
||||
network.powerReceptorAdded(
|
||||
this,
|
||||
direction,
|
||||
te.xCoord + direction.offsetX,
|
||||
te.yCoord + direction.offsetY,
|
||||
te.zCoord + direction.offsetZ,
|
||||
getExternalPowerReceptor(direction));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void externalConnectionRemoved(ForgeDirection direction) {
|
||||
super.externalConnectionRemoved(direction);
|
||||
if (network != null) {
|
||||
TileEntity te = bundle.getEntity();
|
||||
network.powerReceptorRemoved(
|
||||
te.xCoord + direction.offsetX,
|
||||
te.yCoord + direction.offsetY,
|
||||
te.zCoord + direction.offsetZ);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPowerInterface getExternalPowerReceptor(ForgeDirection direction) {
|
||||
TileEntity te = bundle.getEntity();
|
||||
World world = te.getWorldObj();
|
||||
if (world == null) {
|
||||
return null;
|
||||
}
|
||||
TileEntity test = world.getTileEntity(
|
||||
te.xCoord + direction.offsetX,
|
||||
te.yCoord + direction.offsetY,
|
||||
te.zCoord + direction.offsetZ);
|
||||
if (test == null) {
|
||||
return null;
|
||||
}
|
||||
if (test instanceof IConduitBundle) {
|
||||
return null;
|
||||
}
|
||||
return PowerHandlerUtil.create(test);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack createItem() {
|
||||
return createItemStackForSubtype(getSubtype());
|
||||
return createItemStackForSubtype(subtype);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IConduit> getBaseConduitType() {
|
||||
return IPowerConduit.class;
|
||||
}
|
||||
|
||||
// Rendering
|
||||
@Override
|
||||
public IIcon getTextureForState(CollidableComponent component) {
|
||||
if (component.dir == ForgeDirection.UNKNOWN) {
|
||||
return ICONS.get(ICON_CORE_KEY + POSTFIX[getSubtype()]);
|
||||
return ICONS.get(ICON_CORE_KEY + POSTFIX[subtype]);
|
||||
}
|
||||
if (COLOR_CONTROLLER_ID.equals(component.data)) {
|
||||
return IconUtil.whiteTexture;
|
||||
}
|
||||
return ICONS.get(ICON_KEY + POSTFIX[getSubtype()]);
|
||||
return ICONS.get(ICON_KEY + POSTFIX[subtype]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTextureForInputMode() {
|
||||
return ICONS.get(ICON_KEY_INPUT + POSTFIX[getSubtype()]);
|
||||
return ICONS.get(ICON_KEY_INPUT + POSTFIX[subtype]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTextureForOutputMode() {
|
||||
return ICONS.get(ICON_KEY_OUTPUT + POSTFIX[getSubtype()]);
|
||||
return ICONS.get(ICON_KEY_OUTPUT + POSTFIX[subtype]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTransmitionTextureForState(CollidableComponent component) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<CollidableComponent> createCollidables(CacheKey key) {
|
||||
Collection<CollidableComponent> baseCollidables = super.createCollidables(key);
|
||||
if (key.dir == ForgeDirection.UNKNOWN) {
|
||||
return baseCollidables;
|
||||
}
|
||||
|
||||
BoundingBox bb = ConduitGeometryUtil.instance.createBoundsForConnectionController(key.dir, key.offset);
|
||||
CollidableComponent cc = new CollidableComponent(IPowerConduit.class, bb, key.dir, COLOR_CONTROLLER_ID);
|
||||
|
||||
List<CollidableComponent> result = new ArrayList<CollidableComponent>();
|
||||
result.addAll(baseCollidables);
|
||||
result.add(cc);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored() {
|
||||
return getCapacitors()[getSubtype()].getMaxEnergyStored();
|
||||
return getCapacitors()[subtype].getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean displayPower() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -3,22 +3,15 @@ package crazypants.enderio.conduit.redstone;
|
||||
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 {
|
||||
|
||||
String KEY_INS_CONDUIT_ICON = "enderio:redstoneInsulatedConduit";
|
||||
String KEY_INS_CORE_OFF_ICON = "enderio:redstoneInsulatedConduitCoreOff";
|
||||
String KEY_INS_CORE_ON_ICON = "enderio:redstoneInsulatedConduitCoreOn";
|
||||
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 COLOR_CONTROLLER_ID = "ColorController";
|
||||
|
||||
@Override
|
||||
default ConduitRenderer getRenderer() {
|
||||
return InsulatedRedstoneConduitRenderer.instance.get();
|
||||
}
|
||||
public static final String COLOR_CONTROLLER_ID = "ColorController";
|
||||
|
||||
void onInputsChanged(ForgeDirection side, int[] inputValues);
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
|
||||
public interface IRedstoneConduit extends IConduit {
|
||||
|
||||
@@ -21,12 +21,13 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cofh.api.tileentity.IRedstoneControl;
|
||||
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
import com.enderio.core.client.render.IconUtil;
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
|
||||
import cofh.api.tileentity.IRedstoneControl;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
|
||||
+5
-4
@@ -7,13 +7,14 @@ 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 {
|
||||
|
||||
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal
|
||||
.withInitial(InsulatedRedstoneConduitRenderer::new);
|
||||
@Override
|
||||
public boolean isRendererForConduit(IConduit conduit) {
|
||||
return conduit instanceof IInsulatedRedstoneConduit;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderConduit(IIcon tex, IConduit conduit, CollidableComponent component, float selfIllum) {
|
||||
@@ -23,7 +24,7 @@ public class InsulatedRedstoneConduitRenderer extends DefaultConduitRenderer {
|
||||
int c = ((IInsulatedRedstoneConduit) conduit).getSignalColor(component.dir).getColor();
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setColorOpaque_I(c);
|
||||
CubeRenderer.get().render(component.bound, tex);
|
||||
CubeRenderer.render(component.bound, tex);
|
||||
tessellator.setColorOpaque(255, 255, 255);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -17,6 +17,8 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import powercrystals.minefactoryreloaded.api.rednet.IRedNetOutputNode;
|
||||
|
||||
import com.enderio.core.client.render.IconUtil;
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
@@ -33,19 +35,11 @@ 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<>();
|
||||
|
||||
@Override
|
||||
public ConduitRenderer getRenderer() {
|
||||
return DefaultConduitRenderer.instance.get();
|
||||
}
|
||||
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void initIcons() {
|
||||
|
||||
@@ -24,7 +24,6 @@ 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 {
|
||||
|
||||
@@ -34,11 +33,6 @@ 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() {
|
||||
@@ -103,7 +97,7 @@ public class RedstoneSwitch extends RedstoneConduit {
|
||||
Vector3d trans = ConduitGeometryUtil.instance.getTranslation(ForgeDirection.UNKNOWN, o);
|
||||
|
||||
List<CollidableComponent> result = super.getCollidableComponents();
|
||||
BoundingBox[] aabb = RedstoneSwitchBounds.get().getAABB();
|
||||
BoundingBox[] aabb = RedstoneSwitchBounds.getInstance().getAABB();
|
||||
|
||||
for (BoundingBox bb : aabb) {
|
||||
result.add(
|
||||
|
||||
@@ -4,16 +4,17 @@ import com.enderio.core.api.client.render.VertexTransform;
|
||||
import com.enderio.core.client.render.BoundingBox;
|
||||
import com.enderio.core.client.render.VertexRotation;
|
||||
import com.enderio.core.common.vecmath.Vector3d;
|
||||
|
||||
import crazypants.enderio.config.Config;
|
||||
|
||||
public class RedstoneSwitchBounds {
|
||||
|
||||
private static final ThreadLocal<RedstoneSwitchBounds> instance = ThreadLocal
|
||||
.withInitial(RedstoneSwitchBounds::new);
|
||||
private static RedstoneSwitchBounds instance;
|
||||
|
||||
public static RedstoneSwitchBounds get() {
|
||||
return RedstoneSwitchBounds.instance.get();
|
||||
public static final RedstoneSwitchBounds getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new RedstoneSwitchBounds();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
final VertexTransform[] xForms;
|
||||
|
||||
@@ -17,21 +17,29 @@ 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 {
|
||||
|
||||
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(RedstoneSwitchRenderer::new);
|
||||
private static final RedstoneSwitchRenderer instance = new RedstoneSwitchRenderer();
|
||||
|
||||
public static RedstoneSwitchRenderer getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private final VertexTransform[] xForms;
|
||||
private final BoundingBox switchBounds;
|
||||
private final BoundingBox connectorBounds;
|
||||
|
||||
public RedstoneSwitchRenderer() {
|
||||
xForms = RedstoneSwitchBounds.get().xForms;
|
||||
switchBounds = RedstoneSwitchBounds.get().switchBounds;
|
||||
connectorBounds = RedstoneSwitchBounds.get().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;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -41,15 +49,13 @@ public class RedstoneSwitchRenderer extends DefaultConduitRenderer {
|
||||
super.renderEntity(conduitBundleRenderer, bundle, conduit, x, y, z, partialTick, worldLight, rb);
|
||||
|
||||
RedstoneSwitch sw = (RedstoneSwitch) conduit;
|
||||
int i;
|
||||
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
final CubeRenderer cr = CubeRenderer.get();
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
float selfIllum = Math.max(worldLight, conduit.getSelfIlluminationForState(null));
|
||||
tessellator.setColorOpaque_F(selfIllum, selfIllum, selfIllum);
|
||||
|
||||
IIcon[] icons = new IIcon[6];
|
||||
for (i = 0; i < icons.length; i++) {
|
||||
for (int i = 0; i < icons.length; i++) {
|
||||
icons[i] = EnderIO.blockConduitBundle.getConnectorIcon(ConduitConnectorType.INTERNAL);
|
||||
}
|
||||
icons[3] = sw.getSwitchIcon();
|
||||
@@ -59,12 +65,12 @@ public class RedstoneSwitchRenderer extends DefaultConduitRenderer {
|
||||
bundle.getOffset(IRedstoneConduit.class, ForgeDirection.UNKNOWN));
|
||||
BoundingBox bb = switchBounds.translate(trans);
|
||||
|
||||
for (i = 0; i < xForms.length; i++) {
|
||||
cr.render(bb, icons, xForms[i], null);
|
||||
for (VertexTransform tf : xForms) {
|
||||
CubeRenderer.render(bb, icons, tf, null);
|
||||
}
|
||||
bb = connectorBounds.translate(trans);
|
||||
for (i = 0; i < xForms.length; i++) {
|
||||
cr.render(bb, icons[0], xForms[i]);
|
||||
for (VertexTransform tf : xForms) {
|
||||
CubeRenderer.render(bb, icons[0], tf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ 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;
|
||||
@@ -52,27 +51,22 @@ import crazypants.enderio.config.Config;
|
||||
import crazypants.util.RenderPassHelper;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public ConduitBundleRenderer(float conduitScale) {}
|
||||
|
||||
public ConduitBundleRenderer() {}
|
||||
|
||||
@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 == null || (bundle.hasFacade() && bundle.getFacadeId().isOpaqueCube()
|
||||
&& !ConduitUtil.isFacadeHidden(bundle, player))) {
|
||||
if (bundle.hasFacade() && bundle.getFacadeId().isOpaqueCube() && !ConduitUtil.isFacadeHidden(bundle, player)) {
|
||||
return;
|
||||
}
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
float brightness = -1;
|
||||
for (IConduit con : bundle.getConduits()) {
|
||||
if (ConduitUtil.renderConduit(player, con)) {
|
||||
final ConduitRenderer renderer = con.getRenderer();
|
||||
ConduitRenderer renderer = EnderIO.proxy.getRendererForConduit(con);
|
||||
if (renderer.isDynamic()) {
|
||||
if (brightness == -1) {
|
||||
BlockCoord loc = bundle.getLocation();
|
||||
@@ -90,7 +84,7 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
}
|
||||
renderer.renderDynamicEntity(this, bundle, con, x, y, z, partialTick, brightness);
|
||||
}
|
||||
@@ -98,7 +92,7 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
}
|
||||
|
||||
if (brightness != -1) {
|
||||
tessellator.draw();
|
||||
Tessellator.instance.draw();
|
||||
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glPopMatrix();
|
||||
@@ -110,7 +104,6 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
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
|
||||
@@ -120,10 +113,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.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.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);
|
||||
}
|
||||
|
||||
IConduitBundle bundle = (IConduitBundle) world.getTileEntity(x, y, z);
|
||||
@@ -132,7 +125,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 (bundle != null && renderConduit && (pass == 0 || rb.overrideBlockTexture != null)) {
|
||||
if (renderConduit && (pass == 0 || rb.overrideBlockTexture != null)) {
|
||||
BlockCoord loc = bundle.getLocation();
|
||||
float brightness;
|
||||
if (!Config.updateLightingWhenHidingFacades && bundle.hasFacade()
|
||||
@@ -145,34 +138,21 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
return true;
|
||||
}
|
||||
|
||||
return renderedFacade || (bundle != null && bundle.hasFacade() && !bundle.getFacadeId().isOpaqueCube());
|
||||
return renderedFacade || (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.setColorOpaque_F(1, 1, 1);
|
||||
Tessellator.instance.setColorOpaque_F(1, 1, 1);
|
||||
bundle.setFacadeId(null, false);
|
||||
bundle.setFacadeRenderAs(FacadeRenderState.WIRE_FRAME);
|
||||
|
||||
BlockConduitFacade facb = facade.get();
|
||||
BlockConduitFacade facb = EnderIO.blockConduitFacade;
|
||||
facb.setBlockOverride(bundle);
|
||||
facb.setBlockBounds(0, 0, 0, 1, 1, 1);
|
||||
if (!rb.hasOverrideBlockTexture()) {
|
||||
@@ -212,23 +192,20 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
public void renderConduits(IConduitBundle bundle, double x, double y, double z, float partialTick, float brightness,
|
||||
RenderBlocks rb) {
|
||||
|
||||
if (bundle == null) return;
|
||||
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
final CubeRenderer cr = CubeRenderer.get();
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
tessellator.addTranslation((float) x, (float) y, (float) z);
|
||||
|
||||
// Conduits
|
||||
Set<ForgeDirection> externals = new HashSet<>();
|
||||
Set<ForgeDirection> externals = new HashSet<ForgeDirection>();
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
List<BoundingBox> wireBounds = new ArrayList<>();
|
||||
List<BoundingBox> wireBounds = new ArrayList<BoundingBox>();
|
||||
|
||||
for (IConduit con : bundle.getConduits()) {
|
||||
|
||||
if (ConduitUtil.renderConduit(player, con)) {
|
||||
final ConduitRenderer renderer = con.getRenderer();
|
||||
ConduitRenderer renderer = EnderIO.proxy.getRendererForConduit(con);
|
||||
renderer.renderEntity(this, bundle, con, x, y, z, partialTick, brightness, rb);
|
||||
Set<ForgeDirection> extCons = con.getExternalConnections();
|
||||
for (ForgeDirection dir : extCons) {
|
||||
@@ -248,8 +225,7 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
// Internal conectors between conduits
|
||||
List<CollidableComponent> connectors = bundle.getConnectors();
|
||||
List<CollidableComponent> rendered = Lists.newArrayList();
|
||||
for (int i = 0; i < connectors.size(); i++) {
|
||||
final CollidableComponent component = connectors.get(i);
|
||||
for (CollidableComponent component : connectors) {
|
||||
if (component.conduitType != null) {
|
||||
IConduit conduit = bundle.getConduit(component.conduitType);
|
||||
if (conduit != null) {
|
||||
@@ -267,12 +243,12 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
if (r.component.conduitType == component.conduitType
|
||||
&& !rendered.contains(r.component)) {
|
||||
rendered.add(r.component);
|
||||
cr.render(component.bound, rb.overrideBlockTexture, true);
|
||||
CubeRenderer.render(component.bound, rb.overrideBlockTexture, true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tessellator.setBrightness((int) (brightness));
|
||||
cr.render(component.bound, conduit.getTextureForState(component), true);
|
||||
CubeRenderer.render(component.bound, conduit.getTextureForState(component), true);
|
||||
}
|
||||
} else {
|
||||
wireBounds.add(component.bound);
|
||||
@@ -281,18 +257,16 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
|
||||
} else if (ConduitUtil.getDisplayMode(player) == ConduitDisplayMode.ALL && !rb.hasOverrideBlockTexture()) {
|
||||
IIcon tex = EnderIO.blockConduitBundle.getConnectorIcon(component.data);
|
||||
cr.render(component.bound, tex);
|
||||
CubeRenderer.render(component.bound, tex);
|
||||
}
|
||||
}
|
||||
// render these after the 'normal' conduits so help with proper blending
|
||||
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));
|
||||
for (BoundingBox wireBound : wireBounds) {
|
||||
Tessellator.instance.setColorRGBA_F(1, 1, 1, 0.25f);
|
||||
CubeRenderer.render(wireBound, EnderIO.blockConduitFacade.getIcon(0, 0));
|
||||
}
|
||||
|
||||
tessellator.setColorRGBA_F(1, 1, 1, 1f);
|
||||
Tessellator.instance.setColorRGBA_F(1, 1, 1, 1f);
|
||||
// External connection terminations
|
||||
if (rb.overrideBlockTexture == null) {
|
||||
for (ForgeDirection dir : externals) {
|
||||
@@ -305,10 +279,8 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
private void renderExternalConnection(ForgeDirection dir) {
|
||||
IIcon tex = EnderIO.blockConduitBundle.getConnectorIcon(ConduitConnectorType.EXTERNAL);
|
||||
BoundingBox[] bbs = ConduitGeometryUtil.instance.getExternalConnectorBoundingBoxes(dir);
|
||||
final CubeRenderer cr = CubeRenderer.get();
|
||||
for (int i = 0; i < bbs.length; i++) {
|
||||
final BoundingBox bb = bbs[i];
|
||||
cr.render(bb, tex, true);
|
||||
for (BoundingBox bb : bbs) {
|
||||
CubeRenderer.render(bb, tex, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ 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);
|
||||
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
package crazypants.enderio.conduit.render;
|
||||
|
||||
import static net.minecraftforge.common.util.ForgeDirection.DOWN;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.EAST;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.NORTH;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.SOUTH;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.WEST;
|
||||
import static com.enderio.core.client.render.CubeRenderer.*;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.*;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -16,7 +12,6 @@ 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;
|
||||
|
||||
@@ -28,10 +23,13 @@ import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
|
||||
public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
|
||||
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(DefaultConduitRenderer::new);
|
||||
|
||||
protected float transmissionScaleFactor;
|
||||
|
||||
@Override
|
||||
public boolean isRendererForConduit(IConduit conduit) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x,
|
||||
double y, double z, float partialTick, float worldLight, RenderBlocks rb) {
|
||||
@@ -68,7 +66,6 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
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)) {
|
||||
|
||||
@@ -99,7 +96,7 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
tex.getMaxV());
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
for (Vertex c : corners) {
|
||||
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,13 +143,12 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
protected void drawSection(BoundingBox bound, float minU, float maxU, float minV, float maxV, ForgeDirection dir,
|
||||
boolean isTransmission, boolean mirrorTexture) {
|
||||
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
final CubeRenderer cr = CubeRenderer.get();
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
if (isTransmission) {
|
||||
setVerticesForTransmission(bound, dir);
|
||||
} else {
|
||||
cr.setupVertices(bound);
|
||||
setupVertices(bound);
|
||||
}
|
||||
|
||||
if (mirrorTexture && (dir == NORTH || dir == UP || dir == EAST)) {
|
||||
@@ -172,15 +168,15 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
tessellator.setColorOpaque_F(cm, cm, cm);
|
||||
}
|
||||
if (rotateSides) {
|
||||
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);
|
||||
addVecWithUV(verts[1], maxU, maxV);
|
||||
addVecWithUV(verts[0], maxU, minV);
|
||||
addVecWithUV(verts[3], minU, minV);
|
||||
addVecWithUV(verts[2], minU, maxV);
|
||||
} else {
|
||||
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);
|
||||
addVecWithUV(verts[1], minU, minV);
|
||||
addVecWithUV(verts[0], maxU, minV);
|
||||
addVecWithUV(verts[3], maxU, maxV);
|
||||
addVecWithUV(verts[2], minU, maxV);
|
||||
}
|
||||
if (dir == WEST || dir == EAST) {
|
||||
float tmp = minU;
|
||||
@@ -193,15 +189,15 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
tessellator.setColorOpaque_F(cm, cm, cm);
|
||||
}
|
||||
if (rotateSides) {
|
||||
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);
|
||||
addVecWithUV(verts[4], maxU, maxV);
|
||||
addVecWithUV(verts[5], maxU, minV);
|
||||
addVecWithUV(verts[6], minU, minV);
|
||||
addVecWithUV(verts[7], minU, maxV);
|
||||
} else {
|
||||
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);
|
||||
addVecWithUV(verts[4], minU, minV);
|
||||
addVecWithUV(verts[5], maxU, minV);
|
||||
addVecWithUV(verts[6], maxU, maxV);
|
||||
addVecWithUV(verts[7], minU, maxV);
|
||||
}
|
||||
if (dir == WEST || dir == EAST) {
|
||||
float tmp = minU;
|
||||
@@ -218,15 +214,15 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
tessellator.setColorOpaque_F(cm, cm, cm);
|
||||
}
|
||||
if (rotateTopBottom) {
|
||||
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);
|
||||
addVecWithUV(verts[6], maxU, maxV);
|
||||
addVecWithUV(verts[2], minU, maxV);
|
||||
addVecWithUV(verts[3], minU, minV);
|
||||
addVecWithUV(verts[7], maxU, minV);
|
||||
} else {
|
||||
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);
|
||||
addVecWithUV(verts[6], minU, minV);
|
||||
addVecWithUV(verts[2], minU, maxV);
|
||||
addVecWithUV(verts[3], maxU, maxV);
|
||||
addVecWithUV(verts[7], maxU, minV);
|
||||
}
|
||||
|
||||
tessellator.setNormal(0, -1, 0);
|
||||
@@ -235,15 +231,15 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
tessellator.setColorOpaque_F(cm, cm, cm);
|
||||
}
|
||||
if (rotateTopBottom) {
|
||||
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);
|
||||
addVecWithUV(verts[0], minU, minV);
|
||||
addVecWithUV(verts[1], minU, maxV);
|
||||
addVecWithUV(verts[5], maxU, maxV);
|
||||
addVecWithUV(verts[4], maxU, minV);
|
||||
} else {
|
||||
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);
|
||||
addVecWithUV(verts[0], maxU, maxV);
|
||||
addVecWithUV(verts[1], minU, maxV);
|
||||
addVecWithUV(verts[5], minU, minV);
|
||||
addVecWithUV(verts[4], maxU, minV);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,15 +251,15 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
tessellator.setColorOpaque_F(cm, cm, cm);
|
||||
}
|
||||
if (rotateSides) {
|
||||
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);
|
||||
addVecWithUV(verts[2], minU, maxV);
|
||||
addVecWithUV(verts[6], minU, minV);
|
||||
addVecWithUV(verts[5], maxU, minV);
|
||||
addVecWithUV(verts[1], maxU, maxV);
|
||||
} else {
|
||||
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);
|
||||
addVecWithUV(verts[2], minU, maxV);
|
||||
addVecWithUV(verts[6], maxU, maxV);
|
||||
addVecWithUV(verts[5], maxU, minV);
|
||||
addVecWithUV(verts[1], minU, minV);
|
||||
}
|
||||
|
||||
tessellator.setNormal(-1, 0, 0);
|
||||
@@ -272,15 +268,15 @@ public class DefaultConduitRenderer implements ConduitRenderer {
|
||||
tessellator.setColorOpaque_F(cm, cm, cm);
|
||||
}
|
||||
if (rotateSides) {
|
||||
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);
|
||||
addVecWithUV(verts[0], maxU, maxV);
|
||||
addVecWithUV(verts[4], maxU, minV);
|
||||
addVecWithUV(verts[7], minU, minV);
|
||||
addVecWithUV(verts[3], minU, maxV);
|
||||
} else {
|
||||
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);
|
||||
addVecWithUV(verts[0], minU, minV);
|
||||
addVecWithUV(verts[4], maxU, minV);
|
||||
addVecWithUV(verts[7], maxU, maxV);
|
||||
addVecWithUV(verts[3], minU, maxV);
|
||||
}
|
||||
}
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
@@ -290,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;
|
||||
CubeRenderer.get().setupVertices(bound.scale(xs, ys, zs));
|
||||
setupVertices(bound.scale(xs, ys, zs));
|
||||
}
|
||||
|
||||
// TODO: This is a really hacky, imprecise and slow way to do this
|
||||
|
||||
@@ -62,9 +62,8 @@ public class ItemConduitRenderer implements IItemRenderer {
|
||||
}
|
||||
|
||||
private void renderToInventory(ItemStack item, RenderBlocks renderBlocks) {
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
CubeRenderer.get().render(bb, item.getItem().getIconFromDamage(item.getItemDamage()));
|
||||
tessellator.draw();
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
CubeRenderer.render(bb, item.getItem().getIconFromDamage(item.getItemDamage()));
|
||||
Tessellator.instance.draw();
|
||||
}
|
||||
}
|
||||
Loaded 100 of 266 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user