Compare commits

..
2 Commits
Author SHA1 Message Date
Martin Robertz 79e5330630 update 2024-05-19 11:12:29 +02:00
Oleg Ivanov 66f4b7f41b Add config entries for Farming Station particles (#162)
* Decrease number of Farming Station particles

* Set default values for range & number of particles to original

(cherry picked from commit bd47a39c83)
2024-05-19 11:09:54 +02:00
1285 changed files with 6805 additions and 5828 deletions

No files matched your search

+2 -2
View File
@@ -3,9 +3,9 @@ name: Build and test
on: on:
pull_request: pull_request:
branches: [ master, main, release/** ] branches: [ master, main ]
push: push:
branches: [ master, main, release/** ] branches: [ master, main ]
jobs: jobs:
build-and-test: build-and-test:
-17
View File
@@ -1,17 +0,0 @@
name: Optimize images
on:
pull_request:
branches: [ master, main, release/** ]
paths:
- "**/*.png"
push:
branches: [ master, main, release/** ]
paths:
- "**/*.png"
jobs:
optimize-images:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.yml@master
secrets: inherit
-2
View File
@@ -27,5 +27,3 @@ whitelist.json
*.iws *.iws
src/main/resources/mixins.*.json src/main/resources/mixins.*.json
*.bat *.bat
layout.json
.DS_Store
+15 -23
View File
@@ -1,36 +1,28 @@
// Add your dependencies here // Add your dependencies here
dependencies { dependencies {
api('com.github.GTNewHorizons:EnderCore:0.5.15:dev') {transitive = false} api('com.github.GTNewHorizons:EnderCore:0.4.6:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.37:dev') compileOnly('com.github.GTNewHorizons:ForestryMC:4.8.9:dev')
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.8.130-GTNH:dev') compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.5.26-GTNH:dev')
api("com.github.GTNewHorizons:GTNHLib:0.11.45:dev") compileOnly("com.github.GTNewHorizons:GTNHLib:0.2.11:dev")
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.63:dev') compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.39:dev')
api('curse.maven:cofh-lib-220333:2388748') // https://www.curseforge.com/minecraft/mc-mods/cofh-lib/files/2388748 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') shadowImplementation('cglib:cglib-nodep:3.3.0')
api("com.github.GTNewHorizons:TinkersConstruct:1.14.107-GTNH:dev")
devOnlyNonPublishable('com.github.GTNewHorizons:waila:1.19.34:dev') {transitive = false} compileOnly('com.github.GTNewHorizons:waila:1.7.3:api') {transitive = false}
compileOnly('ganymedes01.etfuturum:Et-Futurum-Requiem:2.6.48-GTNH:dev') {transitive = false} compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-357-GTNH:api') {transitive = false}
runtimeOnlyNonPublishable('com.github.GTNewHorizons:WAILAPlugins:0.7.2:dev') {transitive = false} compileOnly('com.github.GTNewHorizons:Baubles:1.0.4:dev') {transitive = false}
compileOnly("com.github.GTNewHorizons:Backhand:1.8.14:dev") { transitive = false } compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.166:dev') {transitive = false}
compileOnly("com.github.GTNewHorizons:Dashboard:1.0.19:api") compileOnly('com.github.GTNewHorizons:Railcraft:9.15.8:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-999-GTNH:api') {transitive = false} compileOnly('com.github.GTNewHorizons:StorageDrawers:1.13.5-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.22-GTNH:dev') {transitive = false} compileOnly('com.github.GTNewHorizons:Chisel:2.14.1-GTNH:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.54.129:dev') {transitive = false} compileOnly('com.github.GTNewHorizons:OpenComputers:1.10.11-GTNH:api') {transitive = false}
compileOnly("com.github.GTNewHorizons:ModularUI2:2.3.88-1.7.10:dev") {transitive = false}
compileOnly('com.github.GTNewHorizons:Railcraft:9.17.31:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.2.29-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Chisel:2.17.32-GTNH:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.61-GTNH:api') {transitive = false}
compileOnly('curse.maven:minefactory-reloaded-66672:2366150') // https://www.curseforge.com/minecraft/mc-mods/minefactory-reloaded/files/2366150 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('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('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: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('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 compileOnly(rfg.deobf('maven.modrinth:immibis-microblocks:59.1.2')) // https://modrinth.com/mod/immibis-microblocks/version/59.1.2
compileOnly('com.github.GTNewHorizons:BetterBuildersWands:0.13.12-GTNH:dev@jar')
compileOnlyApi('com.github.GTNewHorizons:Angelica:2.2.10:api') {transitive = false} compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-alpha50:api') {transitive = false}
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.7.196:dev")
compileOnly('curse.maven:automagy-222153:2285272')
} }
+9 -55
View File
@@ -14,7 +14,7 @@ modId = EnderIO
modGroup = crazypants.enderio modGroup = crazypants.enderio
# Whether to use modGroup as the maven publishing group. # Whether to use modGroup as the maven publishing group.
# When false, com.github.GTNewHorizons is used. # Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
useModGroupForPublishing = false useModGroupForPublishing = false
# Updates your build.gradle and settings.gradle automatically whenever an update is available. # Updates your build.gradle and settings.gradle automatically whenever an update is available.
@@ -39,37 +39,13 @@ remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/co
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE. # `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
developmentEnvironmentUserName = Developer developmentEnvironmentUserName = Developer
# Enables modern Java syntax support. Valid values: # Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# - false: No modern syntax, Java 8 only # See https://github.com/bsideup/jabel for details on how this works.
# - jabel: Jabel syntax-only support, compiles to J8 bytecode enableModernJavaSyntax = false
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
# - modern: Native modern Java bytecode, no downgrading
enableModernJavaSyntax = jabel
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
# and should *not* be used in most situations. -1 disables this.
# forceToolchainVersion = -1
# Target JVM version for JVM Downgrader bytecode downgrading.
# Only used when enableModernJavaSyntax = jvmDowngrader
# downgradeTargetVersion = 8
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
# Classes will be available in META-INF/versions/N/ for each version N in this list.
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
# jvmDowngraderMultiReleaseVersions = 21,25
# Specifies how JVM Downgrader API stubs are provided. Options:
# - shade: Shade minimized stubs into the jar
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
# - external: Another dependency provides stubs (no constraint, no warning)
# - (empty): Warning reminding you to configure stubs
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
# jvmDowngraderStubsProvider =
# Enables injecting missing generics into the decompiled source code for a better coding experience. # 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. # Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
enableGenericInjection = true enableGenericInjection = false
# Generate a class with a String field for the mod version named as defined below. # 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 generateGradleTokenClass is empty or not missing, no such class will be generated.
@@ -104,25 +80,18 @@ apiPackage = api
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/ # Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# There can be multiple files in a space-separated list. # There can be multiple files in a space-separated list.
# Example value: mymodid_at.cfg nei_at.cfg # Example value: mymodid_at.cfg nei_at.cfg
accessTransformersFile = enderio_at.cfg accessTransformersFile =
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled! # Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false usesMixins = false
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
# Mixin classes will have access to "main" classes, but not the other way around.
separateMixinSourceSet =
# Adds some debug arguments like verbose output and class export. # Adds some debug arguments like verbose output and class export.
usesMixinDebug = false usesMixinDebug = false
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise. # Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin = mixinPlugin =
# Specify the package that contains all of your Mixins. The package must exist or # Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
# it must match with this or the build will fail.
mixinsPackage = mixinsPackage =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin! # Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
@@ -148,15 +117,9 @@ minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes. # If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true relocateShadowedDependencies = true
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories. # Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true includeWellKnownRepositories = true
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
# list of strings, with the acceptable keys being(case does not matter):
# cursemaven
# modrinth
excludeWellKnownRepositories =
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven. # 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. # 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. # If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
@@ -177,7 +140,7 @@ modrinthProjectId =
# type can be one of [project, version], # type can be one of [project, version],
# and the name is the Modrinth project or version slug/id of the other mod. # 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 # Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: UniMixins is automatically set as a required dependency if usesMixins = true. # Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
modrinthRelations = modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens. # Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
@@ -198,12 +161,6 @@ curseForgeRelations =
# projects. New projects should not use this parameter. # projects. New projects should not use this parameter.
# customArchiveBaseName = # customArchiveBaseName =
# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory.
# runClientWorkingDirectory = run/client
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory.
# runServerWorkingDirectory = run/server
# Optional parameter to have the build automatically fail if an illegal version is used. # 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'. # 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. # The check is ONLY performed if the version is a git tag.
@@ -233,6 +190,3 @@ curseForgeRelations =
# This is meant to be set in $HOME/.gradle/gradle.properties. # This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true # ideaCheckSpotlessOnBuild = true
# Non-GTNH properties
org.gradle.configuration-cache = true
org.gradle.parallel = true
-12
View File
@@ -1,12 +0,0 @@
#This file is generated by updateDaemonJvm
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/9064f22734b42ac03e85df04b632e167/redirect
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/4d0277c49991306ac78048580fe34bcf/redirect
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a9fa3b809e484a1e1ac4308a5dda661a/redirect
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/aa99913fa6d767d899ffc96082da01ca/redirect
toolchainVersion=25
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
Vendored
+8 -7
View File
@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# #
# Copyright © 2015 the original authors. # Copyright © 2015-2021 the original authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@@ -15,8 +15,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
@@ -57,7 +55,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/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. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@@ -86,7 +84,7 @@ done
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@@ -114,6 +112,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;; NONSTOP* ) nonstop=true ;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
@@ -171,6 +170,7 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java # For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" ) JAVACMD=$( cygpath --unix "$JAVACMD" )
@@ -203,14 +203,15 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command: # Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped. # 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 # * 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. # treated as '${Hostname}' itself on the command line.
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ -classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@" "$@"
# Stop when "xargs" is not available. # Stop when "xargs" is not available.
Vendored
+2 -3
View File
@@ -13,8 +13,6 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@@ -70,10 +68,11 @@ goto fail
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
} }
plugins { plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.29' id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22'
} }
@@ -27,22 +27,19 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import crazypants.enderio.conduit.BlockConduitBundle; import crazypants.enderio.conduit.BlockConduitBundle;
import crazypants.enderio.conduit.IConduit; import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.TileConduitBundle;
import crazypants.enderio.conduit.facade.FacadeRenderer; import crazypants.enderio.conduit.facade.FacadeRenderer;
import crazypants.enderio.conduit.gas.GasConduit; import crazypants.enderio.conduit.gas.GasConduit;
import crazypants.enderio.conduit.gas.GasUtil; import crazypants.enderio.conduit.gas.GasUtil;
import crazypants.enderio.conduit.item.ItemConduit; import crazypants.enderio.conduit.item.ItemConduit;
import crazypants.enderio.conduit.liquid.AbstractEnderLiquidConduit; import crazypants.enderio.conduit.liquid.AbstractEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.AdvancedLiquidConduit; import crazypants.enderio.conduit.liquid.AdvancedLiquidConduit;
import crazypants.enderio.conduit.liquid.CosmicEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.CrystallineEnderLiquidConduit; import crazypants.enderio.conduit.liquid.CrystallineEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.CrystallinePinkSlimeEnderLiquidConduit; import crazypants.enderio.conduit.liquid.CrystallinePinkSlimeEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.EnderLiquidConduit; import crazypants.enderio.conduit.liquid.EnderLiquidConduit;
import crazypants.enderio.conduit.liquid.FluxedEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.LiquidConduit; import crazypants.enderio.conduit.liquid.LiquidConduit;
import crazypants.enderio.conduit.liquid.MelodicEnderLiquidConduit; import crazypants.enderio.conduit.liquid.MelodicEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.PrismaticNaquadahEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.StellarEnderLiquidConduit; import crazypants.enderio.conduit.liquid.StellarEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.TranscendentEnderLiquidConduit;
import crazypants.enderio.conduit.me.MEConduit; import crazypants.enderio.conduit.me.MEConduit;
import crazypants.enderio.conduit.me.MEUtil; import crazypants.enderio.conduit.me.MEUtil;
import crazypants.enderio.conduit.oc.OCConduit; import crazypants.enderio.conduit.oc.OCConduit;
@@ -62,7 +59,6 @@ import crazypants.enderio.gui.TooltipHandlerBurnTime;
import crazypants.enderio.gui.TooltipHandlerFluid; import crazypants.enderio.gui.TooltipHandlerFluid;
import crazypants.enderio.gui.TooltipHandlerGrinding; import crazypants.enderio.gui.TooltipHandlerGrinding;
import crazypants.enderio.item.ConduitProbeOverlayRenderer; import crazypants.enderio.item.ConduitProbeOverlayRenderer;
import crazypants.enderio.item.DashboardHud;
import crazypants.enderio.item.KeyTracker; import crazypants.enderio.item.KeyTracker;
import crazypants.enderio.item.ToolTickHandler; import crazypants.enderio.item.ToolTickHandler;
import crazypants.enderio.item.YetaWrenchOverlayRenderer; import crazypants.enderio.item.YetaWrenchOverlayRenderer;
@@ -108,8 +104,11 @@ import crazypants.enderio.machine.painter.BlockPaintedFenceGateRenderer;
import crazypants.enderio.machine.painter.BlockPaintedGlowstone; import crazypants.enderio.machine.painter.BlockPaintedGlowstone;
import crazypants.enderio.machine.painter.PaintedBlockRenderer; import crazypants.enderio.machine.painter.PaintedBlockRenderer;
import crazypants.enderio.machine.painter.PaintedItemRenderer; import crazypants.enderio.machine.painter.PaintedItemRenderer;
import crazypants.enderio.machine.power.BlockCapacitorBank;
import crazypants.enderio.machine.power.CapBankRenderer2;
import crazypants.enderio.machine.power.CapacitorBankRenderer;
import crazypants.enderio.machine.ranged.RangeEntity; import crazypants.enderio.machine.ranged.RangeEntity;
import crazypants.enderio.machine.ranged.RangeRenderer; import crazypants.enderio.machine.ranged.RangeRenerer;
import crazypants.enderio.machine.reservoir.ReservoirRenderer; import crazypants.enderio.machine.reservoir.ReservoirRenderer;
import crazypants.enderio.machine.reservoir.TileReservoir; import crazypants.enderio.machine.reservoir.TileReservoir;
import crazypants.enderio.machine.solar.BlockSolarPanel; import crazypants.enderio.machine.solar.BlockSolarPanel;
@@ -208,10 +207,6 @@ public class ClientProxy extends CommonProxy {
CrystallinePinkSlimeEnderLiquidConduit.initIcons(); CrystallinePinkSlimeEnderLiquidConduit.initIcons();
MelodicEnderLiquidConduit.initIcons(); MelodicEnderLiquidConduit.initIcons();
StellarEnderLiquidConduit.initIcons(); StellarEnderLiquidConduit.initIcons();
PrismaticNaquadahEnderLiquidConduit.initIcons();
FluxedEnderLiquidConduit.initIcons();
TranscendentEnderLiquidConduit.initIcons();
CosmicEnderLiquidConduit.initIcons();
ItemConduit.initIcons(); ItemConduit.initIcons();
if (GasUtil.isGasConduitEnabled()) { if (GasUtil.isGasConduitEnabled()) {
GasConduit.initIcons(); GasConduit.initIcons();
@@ -247,8 +242,6 @@ public class ClientProxy extends CommonProxy {
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockPainter), machRen); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockPainter), machRen);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCrafter), machRen); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCrafter), machRen);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockBuffer), machRen); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockBuffer), machRen);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockPoweredSpawner), machRen);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockSliceAndSplice), machRen);
MinecraftForgeClient.registerItemRenderer(EnderIO.itemBrokenSpawner, new BrokenSpawnerRenderer()); MinecraftForgeClient.registerItemRenderer(EnderIO.itemBrokenSpawner, new BrokenSpawnerRenderer());
@@ -267,15 +260,13 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileFarmStation.class, new FarmingStationSpecialRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileFarmStation.class, new FarmingStationSpecialRenderer());
BlockSoulBinder.renderId = RenderingRegistry.getNextAvailableRenderId(); BlockSoulBinder.renderId = RenderingRegistry.getNextAvailableRenderId();
SoulBinderRenderer soulBinderRenderer = new SoulBinderRenderer(); RenderingRegistry.registerBlockHandler(new SoulBinderRenderer());
RenderingRegistry.registerBlockHandler(soulBinderRenderer);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockSoulFuser), soulBinderRenderer);
ObeliskRenderer defaultObeliskRenderer = new ObeliskRenderer(); ObeliskRenderer defaultObeliskRenderer = new ObeliskRenderer();
BlockObeliskAbstract.defaultObeliskRenderId = RenderingRegistry.getNextAvailableRenderId(); BlockObeliskAbstract.defaultObeliskRenderId = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(defaultObeliskRenderer); RenderingRegistry.registerBlockHandler(defaultObeliskRenderer);
ObeliskSpecialRenderer<TileAttractor> attRen = new ObeliskSpecialRenderer<>( ObeliskSpecialRenderer<TileAttractor> attRen = new ObeliskSpecialRenderer<TileAttractor>(
new ItemStack(EnderIO.itemMaterial, 1, Material.ATTRACTOR_CRYSTAL.ordinal()), new ItemStack(EnderIO.itemMaterial, 1, Material.ATTRACTOR_CRYSTAL.ordinal()),
defaultObeliskRenderer); defaultObeliskRenderer);
ClientRegistry.bindTileEntitySpecialRenderer(TileAttractor.class, attRen); ClientRegistry.bindTileEntitySpecialRenderer(TileAttractor.class, attRen);
@@ -285,7 +276,7 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileAversionObelisk.class, sgr); ClientRegistry.bindTileEntitySpecialRenderer(TileAversionObelisk.class, sgr);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockSpawnGuard), sgr); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockSpawnGuard), sgr);
ObeliskSpecialRenderer<TileExperienceObelisk> eor = new ObeliskSpecialRenderer<>( ObeliskSpecialRenderer<TileExperienceObelisk> eor = new ObeliskSpecialRenderer<TileExperienceObelisk>(
new ItemStack(EnderIO.itemXpTransfer), new ItemStack(EnderIO.itemXpTransfer),
defaultObeliskRenderer); defaultObeliskRenderer);
ClientRegistry.bindTileEntitySpecialRenderer(TileExperienceObelisk.class, eor); ClientRegistry.bindTileEntitySpecialRenderer(TileExperienceObelisk.class, eor);
@@ -298,7 +289,7 @@ public class ClientProxy extends CommonProxy {
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockWeatherObelisk), twr); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockWeatherObelisk), twr);
BlockCombustionGenerator.renderId = RenderingRegistry.getNextAvailableRenderId(); BlockCombustionGenerator.renderId = RenderingRegistry.getNextAvailableRenderId();
TechneMachineRenderer<TileCombustionGenerator> cr = new TechneMachineRenderer<>( TechneMachineRenderer<TileCombustionGenerator> cr = new TechneMachineRenderer<TileCombustionGenerator>(
EnderIO.blockCombustionGenerator, EnderIO.blockCombustionGenerator,
"models/combustionGen"); "models/combustionGen");
RenderingRegistry.registerBlockHandler(cr); RenderingRegistry.registerBlockHandler(cr);
@@ -314,7 +305,7 @@ public class ClientProxy extends CommonProxy {
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockKillerJoe), kjr); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockKillerJoe), kjr);
BlockVat.renderId = RenderingRegistry.getNextAvailableRenderId(); BlockVat.renderId = RenderingRegistry.getNextAvailableRenderId();
TechneMachineRenderer<TileVat> vr = new TechneMachineRenderer<>(EnderIO.blockVat, "models/vat"); TechneMachineRenderer<TileVat> vr = new TechneMachineRenderer<TileVat>(EnderIO.blockVat, "models/vat");
RenderingRegistry.registerBlockHandler(vr); RenderingRegistry.registerBlockHandler(vr);
FusedQuartzFrameRenderer fqfr = new FusedQuartzFrameRenderer(); FusedQuartzFrameRenderer fqfr = new FusedQuartzFrameRenderer();
@@ -331,6 +322,13 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileCapBank.class, newCbr); ClientRegistry.bindTileEntitySpecialRenderer(TileCapBank.class, newCbr);
} }
CapacitorBankRenderer capr = new CapacitorBankRenderer();
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCapacitorBank), capr);
BlockCapacitorBank.renderId = RenderingRegistry.getNextAvailableRenderId();
CapBankRenderer2 cbr2 = new CapBankRenderer2();
RenderingRegistry.registerBlockHandler(cbr2);
BlockVacuumChest.renderId = RenderingRegistry.getNextAvailableRenderId(); BlockVacuumChest.renderId = RenderingRegistry.getNextAvailableRenderId();
VacuumChestRenderer vcr = new VacuumChestRenderer(); VacuumChestRenderer vcr = new VacuumChestRenderer();
RenderingRegistry.registerBlockHandler(vcr); RenderingRegistry.registerBlockHandler(vcr);
@@ -373,7 +371,6 @@ public class ClientProxy extends CommonProxy {
TelePadRenderer telePadRenderer = new TelePadRenderer(); TelePadRenderer telePadRenderer = new TelePadRenderer();
RenderingRegistry.registerBlockHandler(telePadRenderer); RenderingRegistry.registerBlockHandler(telePadRenderer);
ClientRegistry.bindTileEntitySpecialRenderer(TileTelePad.class, new TelePadSpecialRenderer(telePadRenderer)); ClientRegistry.bindTileEntitySpecialRenderer(TileTelePad.class, new TelePadSpecialRenderer(telePadRenderer));
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockTelePad), telePadRenderer);
MinecraftForgeClient.registerItemRenderer(EnderIO.itemMachinePart, new MachinePartRenderer()); MinecraftForgeClient.registerItemRenderer(EnderIO.itemMachinePart, new MachinePartRenderer());
MinecraftForgeClient.registerItemRenderer(EnderIO.itemConduitFacade, new FacadeRenderer()); MinecraftForgeClient.registerItemRenderer(EnderIO.itemConduitFacade, new FacadeRenderer());
@@ -381,6 +378,7 @@ public class ClientProxy extends CommonProxy {
cbr = new ConduitBundleRenderer((float) Config.conduitScale); cbr = new ConduitBundleRenderer((float) Config.conduitScale);
BlockConduitBundle.rendererId = RenderingRegistry.getNextAvailableRenderId(); BlockConduitBundle.rendererId = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(cbr); RenderingRegistry.registerBlockHandler(cbr);
ClientRegistry.bindTileEntitySpecialRenderer(TileConduitBundle.class, cbr);
ClientRegistry.bindTileEntitySpecialRenderer(TileTravelAnchor.class, new TravelEntitySpecialRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileTravelAnchor.class, new TravelEntitySpecialRenderer());
@@ -410,9 +408,6 @@ public class ClientProxy extends CommonProxy {
new YetaWrenchOverlayRenderer(); new YetaWrenchOverlayRenderer();
new ConduitProbeOverlayRenderer(); new ConduitProbeOverlayRenderer();
if (EnderIO.hasDashboard) {
DashboardHud.register();
}
if (Config.useSneakMouseWheelYetaWrench) { if (Config.useSneakMouseWheelYetaWrench) {
ToolTickHandler th = new ToolTickHandler(); ToolTickHandler th = new ToolTickHandler();
MinecraftForge.EVENT_BUS.register(th); MinecraftForge.EVENT_BUS.register(th);
@@ -426,7 +421,7 @@ public class ClientProxy extends CommonProxy {
FMLCommonHandler.instance().bus().register(KeyTracker.instance); FMLCommonHandler.instance().bus().register(KeyTracker.instance);
RenderingRegistry.registerEntityRenderingHandler(SoundEntity.class, new SoundRenderer()); RenderingRegistry.registerEntityRenderingHandler(SoundEntity.class, new SoundRenderer());
RenderingRegistry.registerEntityRenderingHandler(RangeEntity.class, new RangeRenderer()); RenderingRegistry.registerEntityRenderingHandler(RangeEntity.class, new RangeRenerer());
MinecraftForge.EVENT_BUS.register(SoundDetector.instance); MinecraftForge.EVENT_BUS.register(SoundDetector.instance);
FMLCommonHandler.instance().bus().register(SoundDetector.instance); FMLCommonHandler.instance().bus().register(SoundDetector.instance);
@@ -1,5 +1,7 @@
package crazypants.enderio; package crazypants.enderio;
import java.text.DecimalFormat;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion; import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
@@ -7,27 +9,20 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
import cpw.mods.fml.common.event.FMLServerStartedEvent;
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent; import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase; import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent; import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent;
import crazypants.enderio.conduit.ConduitNetworkTickHandler;
import crazypants.enderio.conduit.IConduit; import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.render.ConduitRenderer; import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.machine.hypercube.HyperCubeRegister;
import crazypants.enderio.machine.transceiver.ServerChannelRegister;
import crazypants.enderio.machine.wireless.WirelessChargerController;
public class CommonProxy { public class CommonProxy {
private static final DecimalFormat FORMAT = new DecimalFormat("########0.000");
protected long serverTickCount = 0; protected long serverTickCount = 0;
protected long clientTickCount = 0; protected long clientTickCount = 0;
protected final TickTimer tickTimer = new TickTimer(); protected final TickTimer tickTimer = new TickTimer();
public ConduitNetworkTickHandler conduitNetworkTickHandler = null;
public WirelessChargerController wirelessChargerController = null;
public CommonProxy() {} public CommonProxy() {}
@@ -49,7 +44,7 @@ public class CommonProxy {
} }
public void loadIcons() { public void loadIcons() {
;
} }
public void load() { public void load() {
@@ -81,26 +76,6 @@ public class CommonProxy {
return new ResourceLocation(EnderIO.DOMAIN + TEXTURE_PATH + name + TEXTURE_EXT); return new ResourceLocation(EnderIO.DOMAIN + TEXTURE_PATH + name + TEXTURE_EXT);
} }
public void onServerAboutToStart(FMLServerAboutToStartEvent event) {
conduitNetworkTickHandler = new ConduitNetworkTickHandler();
FMLCommonHandler.instance().bus().register(conduitNetworkTickHandler);
wirelessChargerController = new WirelessChargerController();
FMLCommonHandler.instance().bus().register(wirelessChargerController);
}
public void onServerStarted(FMLServerStartedEvent event) {
HyperCubeRegister.load();
ServerChannelRegister.load();
}
public void onServerStopped(FMLServerStoppedEvent event) {
HyperCubeRegister.unload();
FMLCommonHandler.instance().bus().unregister(conduitNetworkTickHandler);
conduitNetworkTickHandler = null;
FMLCommonHandler.instance().bus().unregister(wirelessChargerController);
wirelessChargerController = null;
}
public final class TickTimer { public final class TickTimer {
@SubscribeEvent @SubscribeEvent
+27 -48
View File
@@ -38,7 +38,6 @@ import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
import cpw.mods.fml.common.event.FMLMissingMappingsEvent; import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
import cpw.mods.fml.common.event.FMLServerStartedEvent; import cpw.mods.fml.common.event.FMLServerStartedEvent;
import cpw.mods.fml.common.event.FMLServerStoppedEvent; import cpw.mods.fml.common.event.FMLServerStoppedEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@@ -47,7 +46,6 @@ import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import crazypants.enderio.api.IMC; import crazypants.enderio.api.IMC;
import crazypants.enderio.betterbuilderswands.PaintedCustomMapping;
import crazypants.enderio.block.BlockDarkSteelAnvil; import crazypants.enderio.block.BlockDarkSteelAnvil;
import crazypants.enderio.block.BlockDarkSteelLadder; import crazypants.enderio.block.BlockDarkSteelLadder;
import crazypants.enderio.block.BlockDarkSteelPressurePlate; import crazypants.enderio.block.BlockDarkSteelPressurePlate;
@@ -113,6 +111,7 @@ import crazypants.enderio.machine.generator.zombie.BlockZombieGenerator.BlockEnd
import crazypants.enderio.machine.generator.zombie.BlockZombieGenerator.BlockFrankenZombieGenerator; import crazypants.enderio.machine.generator.zombie.BlockZombieGenerator.BlockFrankenZombieGenerator;
import crazypants.enderio.machine.generator.zombie.PacketNutrientTank; import crazypants.enderio.machine.generator.zombie.PacketNutrientTank;
import crazypants.enderio.machine.hypercube.BlockHyperCube; import crazypants.enderio.machine.hypercube.BlockHyperCube;
import crazypants.enderio.machine.hypercube.HyperCubeRegister;
import crazypants.enderio.machine.invpanel.BlockInventoryPanel; import crazypants.enderio.machine.invpanel.BlockInventoryPanel;
import crazypants.enderio.machine.killera.BlockKillerJoe; import crazypants.enderio.machine.killera.BlockKillerJoe;
import crazypants.enderio.machine.light.BlockElectricLight; import crazypants.enderio.machine.light.BlockElectricLight;
@@ -133,6 +132,7 @@ import crazypants.enderio.machine.painter.BlockPaintedStair;
import crazypants.enderio.machine.painter.BlockPaintedWall; import crazypants.enderio.machine.painter.BlockPaintedWall;
import crazypants.enderio.machine.painter.BlockPainter; import crazypants.enderio.machine.painter.BlockPainter;
import crazypants.enderio.machine.painter.PaintSourceValidator; import crazypants.enderio.machine.painter.PaintSourceValidator;
import crazypants.enderio.machine.power.BlockCapacitorBank;
import crazypants.enderio.machine.ranged.RangeEntity; import crazypants.enderio.machine.ranged.RangeEntity;
import crazypants.enderio.machine.reservoir.BlockReservoir; import crazypants.enderio.machine.reservoir.BlockReservoir;
import crazypants.enderio.machine.slicensplice.BlockSliceAndSplice; import crazypants.enderio.machine.slicensplice.BlockSliceAndSplice;
@@ -182,19 +182,12 @@ import crazypants.enderio.thaumcraft.ThaumcraftCompat;
import crazypants.enderio.tool.EnderIOCrashCallable; import crazypants.enderio.tool.EnderIOCrashCallable;
import crazypants.util.EE3Util; import crazypants.util.EE3Util;
@Mod(modid = MODID, name = MOD_NAME, version = VERSION, dependencies = """ @Mod(
required-after:CoFHLib@[1.7.10R1.0.3B3,);\ modid = MODID,
required-after:endercore;\ name = MOD_NAME,
required-after:gtnhlib@[0.9.47,);\ version = VERSION,
after:MineFactoryReloaded;\ 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",
after:Forestry;\ guiFactory = "crazypants.enderio.config.ConfigFactoryEIO")
after:Waila@[1.5.8,);\
after:Thaumcraft;\
after:appliedenergistics2@[rv2-beta-8,);\
after:Railcraft@[9.16.7,);\
after:dashboard@[1.0.19,);\
after:betterbuilderswands@[0.13.12,)\
""", guiFactory = "crazypants.enderio.config.ConfigFactoryEIO")
public class EnderIO { public class EnderIO {
public static final String MODID = "EnderIO"; public static final String MODID = "EnderIO";
@@ -215,12 +208,7 @@ public class EnderIO {
public static final Lang lang = new Lang("enderio"); public static final Lang lang = new Lang("enderio");
public static final boolean hasLwjgl3 = Loader.isModLoaded("lwjgl3ify"); public static final boolean hasLwjgl3 = Loader.isModLoaded("lwjgl3ify");
public static final boolean hasGT5 = Loader.isModLoaded("gregtech") && !Loader.isModLoaded("gregapi"); public static final boolean hasGT5 = Loader.isModLoaded("gregtech") && !Loader.isModLoaded("gregapi_post");
public static final boolean hasHP = Loader.isModLoaded("hodgepodge");
public static final boolean hasEtFuturum = Loader.isModLoaded("etfuturum");
public static final boolean hasWailaPlugins = Loader.isModLoaded("wailaplugins");
public static final boolean hasAutomagy = Loader.isModLoaded("Automagy");
public static final boolean hasDashboard = Loader.isModLoaded("dashboard");
// Materials // Materials
public static ItemCapacitor itemBasicCapacitor; public static ItemCapacitor itemBasicCapacitor;
@@ -292,6 +280,7 @@ public class EnderIO {
public static BlockSolarPanel blockSolarPanel; public static BlockSolarPanel blockSolarPanel;
public static BlockReservoir blockReservoir; public static BlockReservoir blockReservoir;
public static BlockAlloySmelter blockAlloySmelter; public static BlockAlloySmelter blockAlloySmelter;
public static BlockCapacitorBank blockCapacitorBank;
public static BlockCapBank blockCapBank; public static BlockCapBank blockCapBank;
public static BlockWirelessCharger blockWirelessCharger; public static BlockWirelessCharger blockWirelessCharger;
public static BlockCrusher blockCrusher; public static BlockCrusher blockCrusher;
@@ -401,6 +390,7 @@ public class EnderIO {
blockCrusher = BlockCrusher.create(); blockCrusher = BlockCrusher.create();
blockAlloySmelter = BlockAlloySmelter.create(); blockAlloySmelter = BlockAlloySmelter.create();
blockCapacitorBank = BlockCapacitorBank.create();
blockCapBank = BlockCapBank.create(); blockCapBank = BlockCapBank.create();
blockPainter = BlockPainter.create(); blockPainter = BlockPainter.create();
@@ -494,9 +484,7 @@ public class EnderIO {
itemGrindingBall = ItemGrindingBall.create(); itemGrindingBall = ItemGrindingBall.create();
itemAlloyEndergy = ItemAlloyEndergy.create(); itemAlloyEndergy = ItemAlloyEndergy.create();
itemGrindingBallEndergy = ItemGrindingBallEndergy.create(); itemGrindingBallEndergy = ItemGrindingBallEndergy.create();
if (!hasGT5) { itemPowderIngot = ItemPowderIngot.create();
itemPowderIngot = ItemPowderIngot.create();
}
registerFluids(); registerFluids();
@@ -736,9 +724,7 @@ public class EnderIO {
SkeletonHandler.registerSkeleton(this); SkeletonHandler.registerSkeleton(this);
} }
if (!hasGT5) { MaterialRecipes.registerDependantOresInDictionary();
MaterialRecipes.registerDependantOresInDictionary();
}
EnderfaceRecipes.addRecipes(); EnderfaceRecipes.addRecipes();
MaterialRecipes.addRecipes(); MaterialRecipes.addRecipes();
@@ -824,6 +810,7 @@ public class EnderIO {
return Config.xpJuiceName; return Config.xpJuiceName;
} }
@SuppressWarnings("unchecked")
private void addModIntegration() { private void addModIntegration() {
if (Loader.isModLoaded("TConstruct")) { if (Loader.isModLoaded("TConstruct")) {
@@ -834,7 +821,6 @@ public class EnderIO {
Class<?> modFluxClass = Class.forName("tconstruct.modifiers.tools.ModFlux"); Class<?> modFluxClass = Class.forName("tconstruct.modifiers.tools.ModFlux");
Field batteriesField = modFluxClass.getField("batteries"); Field batteriesField = modFluxClass.getField("batteries");
@SuppressWarnings("unchecked")
List<ItemStack> batteries = (List<ItemStack>) batteriesField.get(modFluxInst); List<ItemStack> batteries = (List<ItemStack>) batteriesField.get(modFluxInst);
batteries.add(new ItemStack(blockCapBank)); batteries.add(new ItemStack(blockCapBank));
Log.info("Registered Capacitor Banks as Tinkers Construct Flux Upgrades"); Log.info("Registered Capacitor Banks as Tinkers Construct Flux Upgrades");
@@ -843,9 +829,6 @@ public class EnderIO {
Log.info("Failed to registered Capacitor Banks as Tinkers Construct Flux Upgrades"); Log.info("Failed to registered Capacitor Banks as Tinkers Construct Flux Upgrades");
} }
} }
if (Loader.isModLoaded("betterbuilderswands")) {
PaintedCustomMapping.registerMappings();
}
ThaumcraftCompat.load(); ThaumcraftCompat.load();
} }
@@ -904,18 +887,22 @@ public class EnderIO {
} }
@EventHandler @EventHandler
public void onServerAboutToStart(FMLServerAboutToStartEvent event) { public void serverStarted(FMLServerStartedEvent event) {
proxy.onServerAboutToStart(event); HyperCubeRegister.load();
ServerChannelRegister.load();
}
@SubscribeEvent
public void worldSaved(WorldEvent.Save event) {
// Only save together with the overworld, because this gets called for every dimension separately
if (event.world.provider != null && event.world.provider.dimensionId == 0) {
ServerChannelRegister.store();
}
} }
@EventHandler @EventHandler
public void onServerStarted(FMLServerStartedEvent event) { public void serverStopped(FMLServerStoppedEvent event) {
proxy.onServerStarted(event); HyperCubeRegister.unload();
}
@EventHandler
public void onServerStopped(FMLServerStoppedEvent event) {
proxy.onServerStopped(event);
} }
@EventHandler @EventHandler
@@ -927,12 +914,4 @@ public class EnderIO {
} }
} }
} }
@SubscribeEvent
public void worldSaved(WorldEvent.Save event) {
// Only save together with the overworld, because this gets called for every dimension separately
if (event.world.provider != null && event.world.provider.dimensionId == 0) {
ServerChannelRegister.store();
}
}
} }
@@ -60,7 +60,7 @@ public class GuiHandler implements IGuiHandler {
public static final int GUI_ID_CAP_BANK = 142; // leave room for more machines public static final int GUI_ID_CAP_BANK = 142; // leave room for more machines
protected final Map<Integer, IGuiHandler> guiHandlers = new HashMap<>(); protected final Map<Integer, IGuiHandler> guiHandlers = new HashMap<Integer, IGuiHandler>();
public void registerGuiHandler(int id, IGuiHandler handler) { public void registerGuiHandler(int id, IGuiHandler handler) {
guiHandlers.put(id, handler); guiHandlers.put(id, handler);
@@ -55,6 +55,7 @@ public enum ModObject {
blockReservoir, blockReservoir,
blockAlloySmelter, blockAlloySmelter,
blockSolarPanel, blockSolarPanel,
blockCapacitorBank,
blockCapBank, blockCapBank,
blockSagMill, blockSagMill,
blockHyperCube, blockHyperCube,
@@ -1,101 +0,0 @@
package crazypants.enderio.betterbuilderswands;
import java.util.function.BiFunction;
import java.util.function.IntFunction;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import com.github.bsideup.jabel.Desugar;
import crazypants.enderio.EnderIO;
import crazypants.enderio.machine.painter.BlockPaintedCarpet;
import crazypants.enderio.machine.painter.BlockPaintedFence;
import crazypants.enderio.machine.painter.BlockPaintedFenceGate;
import crazypants.enderio.machine.painter.BlockPaintedGlowstone;
import crazypants.enderio.machine.painter.BlockPaintedSlab;
import crazypants.enderio.machine.painter.BlockPaintedStair;
import crazypants.enderio.machine.painter.BlockPaintedWall;
import crazypants.enderio.machine.painter.TileEntityPaintedBlock;
import portablejim.bbw.BetterBuildersWandsMod;
import portablejim.bbw.basics.Point3d;
import portablejim.bbw.core.conversion.ICustomMapping;
import portablejim.bbw.shims.IPlayerShim;
import portablejim.bbw.shims.IWorldShim;
@Desugar
public record PaintedCustomMapping(Block lookBlock, BiFunction<Block, Integer, ItemStack> itemStackGetter, int meta)
implements ICustomMapping {
@Override
public Block getLookBlock() {
return lookBlock;
}
@Override
public int getMeta() {
return meta;
}
@Override
public ItemStack getItems(IWorldShim world, IPlayerShim player, Point3d point) {
if (world.getTile(point) instanceof TileEntityPaintedBlock painted) {
return itemStackGetter.apply(painted.getSourceBlock(), painted.getSourceBlockMetadata());
}
return null;
}
@Override
public boolean shouldCopyTileNBT() {
return true;
}
public static void registerMappings() {
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedGlowstone,
BlockPaintedGlowstone::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedStair,
BlockPaintedStair::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedFence,
BlockPaintedFence::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedFenceGate,
BlockPaintedFenceGate::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedCarpet,
BlockPaintedCarpet::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedSlab,
BlockPaintedSlab::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedWall,
BlockPaintedWall::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedDoubleSlab,
BlockPaintedSlab::createItemStackForSourceBlock,
i));
}
private static void register(IntFunction<ICustomMapping> mapping) {
for (int i = 0; i < 16; i++) {
BetterBuildersWandsMod.instance.mappingManager.setMapping(mapping.apply(i));
}
}
}
@@ -148,9 +148,10 @@ public class BlockDarkSteelPressurePlate extends BlockPressurePlate
return super.colorMultiplier(world, x, y, z); return super.colorMultiplier(world, x, y, z);
} }
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubBlocks(Item arg0, CreativeTabs arg1, List<ItemStack> items) { public void getSubBlocks(Item arg0, CreativeTabs arg1, List items) {
items.add(new ItemStack(this, 1, 0)); items.add(new ItemStack(this, 1, 0));
items.add(new ItemStack(this, 1, 1)); items.add(new ItemStack(this, 1, 1));
} }
@@ -16,10 +16,14 @@ import crazypants.enderio.config.Config;
public class ContainerDarkSteelAnvil extends ContainerRepair { public class ContainerDarkSteelAnvil extends ContainerRepair {
private final int x; private int x, y, z;
private final int y;
private final int z;
private final Field _outputSlot = ReflectionHelper.findField(ContainerRepair.class, "outputSlot", "field_82852_f");
private final Field _inputSlots = ReflectionHelper.findField(ContainerRepair.class, "inputSlots", "field_82853_g");
private final Field _materialCost = ReflectionHelper
.findField(ContainerRepair.class, "materialCost", "stackSizeToBeUsedInRepair", "field_82856_l");
@SuppressWarnings("unchecked")
public ContainerDarkSteelAnvil(InventoryPlayer playerInv, final World world, final int x, final int y, final int z, public ContainerDarkSteelAnvil(InventoryPlayer playerInv, final World world, final int x, final int y, final int z,
EntityPlayer player) { EntityPlayer player) {
super(playerInv, world, x, y, z, player); super(playerInv, world, x, y, z, player);
@@ -28,12 +32,8 @@ public class ContainerDarkSteelAnvil extends ContainerRepair {
final int materialCost; final int materialCost;
try { try {
Field _outputSlot = ReflectionHelper.findField(ContainerRepair.class, "outputSlot", "field_82852_f");
outputSlot = (IInventory) _outputSlot.get(this); outputSlot = (IInventory) _outputSlot.get(this);
Field _inputSlots = ReflectionHelper.findField(ContainerRepair.class, "inputSlots", "field_82853_g");
inputSlots = (IInventory) _inputSlots.get(this); inputSlots = (IInventory) _inputSlots.get(this);
Field _materialCost = ReflectionHelper
.findField(ContainerRepair.class, "materialCost", "stackSizeToBeUsedInRepair", "field_82856_l");
materialCost = _materialCost.getInt(this); materialCost = _materialCost.getInt(this);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
@@ -31,18 +31,14 @@ import crazypants.enderio.conduit.item.IItemConduit;
import crazypants.enderio.conduit.item.ItemConduitNetwork; import crazypants.enderio.conduit.item.ItemConduitNetwork;
import crazypants.enderio.conduit.liquid.AdvancedLiquidConduit; import crazypants.enderio.conduit.liquid.AdvancedLiquidConduit;
import crazypants.enderio.conduit.liquid.AdvancedLiquidConduitNetwork; import crazypants.enderio.conduit.liquid.AdvancedLiquidConduitNetwork;
import crazypants.enderio.conduit.liquid.CosmicEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.CrystallineEnderLiquidConduit; import crazypants.enderio.conduit.liquid.CrystallineEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.CrystallinePinkSlimeEnderLiquidConduit; import crazypants.enderio.conduit.liquid.CrystallinePinkSlimeEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.EnderLiquidConduit; import crazypants.enderio.conduit.liquid.EnderLiquidConduit;
import crazypants.enderio.conduit.liquid.EnderLiquidConduitNetwork; import crazypants.enderio.conduit.liquid.EnderLiquidConduitNetwork;
import crazypants.enderio.conduit.liquid.FluxedEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.ILiquidConduit; import crazypants.enderio.conduit.liquid.ILiquidConduit;
import crazypants.enderio.conduit.liquid.LiquidConduitNetwork; import crazypants.enderio.conduit.liquid.LiquidConduitNetwork;
import crazypants.enderio.conduit.liquid.MelodicEnderLiquidConduit; import crazypants.enderio.conduit.liquid.MelodicEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.PrismaticNaquadahEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.StellarEnderLiquidConduit; import crazypants.enderio.conduit.liquid.StellarEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.TranscendentEnderLiquidConduit;
import crazypants.enderio.conduit.me.IMEConduit; import crazypants.enderio.conduit.me.IMEConduit;
import crazypants.enderio.conduit.me.MEConduitNetwork; import crazypants.enderio.conduit.me.MEConduitNetwork;
import crazypants.enderio.conduit.oc.IOCConduit; import crazypants.enderio.conduit.oc.IOCConduit;
@@ -51,7 +47,6 @@ import crazypants.enderio.conduit.power.IPowerConduit;
import crazypants.enderio.conduit.power.PowerConduitNetwork; import crazypants.enderio.conduit.power.PowerConduitNetwork;
import crazypants.enderio.conduit.redstone.IRedstoneConduit; import crazypants.enderio.conduit.redstone.IRedstoneConduit;
import crazypants.enderio.conduit.redstone.RedstoneConduitNetwork; import crazypants.enderio.conduit.redstone.RedstoneConduitNetwork;
import crazypants.util.ForgeDirections;
import mods.immibis.microblocks.api.EnumPartClass; import mods.immibis.microblocks.api.EnumPartClass;
import mods.immibis.microblocks.api.EnumPosition; import mods.immibis.microblocks.api.EnumPosition;
import mods.immibis.microblocks.api.IMicroblockCoverSystem; import mods.immibis.microblocks.api.IMicroblockCoverSystem;
@@ -77,7 +72,8 @@ public abstract class AbstractConduit implements IConduit {
protected List<CollidableComponent> collidables; protected List<CollidableComponent> collidables;
protected final EnumMap<ForgeDirection, ConnectionMode> conectionModes = new EnumMap<>(ForgeDirection.class); protected final EnumMap<ForgeDirection, ConnectionMode> conectionModes = new EnumMap<ForgeDirection, ConnectionMode>(
ForgeDirection.class);
protected boolean collidablesDirty = true; protected boolean collidablesDirty = true;
@@ -122,7 +118,7 @@ public abstract class AbstractConduit implements IConduit {
return false; return false;
} }
if (dataRoot.hasKey("connectionMode")) { if (dataRoot.hasKey("connectionMode")) {
ConnectionMode mode = ConnectionMode.VALUES[dataRoot.getShort("connectionMode")]; ConnectionMode mode = ConnectionMode.values()[dataRoot.getShort("connectionMode")];
setConnectionMode(dir, mode); setConnectionMode(dir, mode);
} }
readTypeSettings(dir, dataRoot); readTypeSettings(dir, dataRoot);
@@ -386,13 +382,13 @@ public abstract class AbstractConduit implements IConduit {
conduitConnections.clear(); conduitConnections.clear();
int[] dirs = nbtRoot.getIntArray("connections"); int[] dirs = nbtRoot.getIntArray("connections");
for (int i = 0; i < dirs.length; i++) { for (int i = 0; i < dirs.length; i++) {
conduitConnections.add(ForgeDirections.DIRECTIONS[dirs[i]]); conduitConnections.add(ForgeDirection.values()[dirs[i]]);
} }
externalConnections.clear(); externalConnections.clear();
dirs = nbtRoot.getIntArray("externalConnections"); dirs = nbtRoot.getIntArray("externalConnections");
for (int i = 0; i < dirs.length; i++) { for (int i = 0; i < dirs.length; i++) {
externalConnections.add(ForgeDirections.DIRECTIONS[dirs[i]]); externalConnections.add(ForgeDirection.values()[dirs[i]]);
} }
active = nbtRoot.getBoolean("signalActive"); active = nbtRoot.getBoolean("signalActive");
@@ -401,7 +397,7 @@ public abstract class AbstractConduit implements IConduit {
if (modes != null && modes.length == 6) { if (modes != null && modes.length == 6) {
int i = 0; int i = 0;
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
conectionModes.put(dir, ConnectionMode.VALUES[modes[i]]); conectionModes.put(dir, ConnectionMode.values()[modes[i]]);
i++; i++;
} }
} }
@@ -457,7 +453,7 @@ public abstract class AbstractConduit implements IConduit {
needUpdateConnections = false; needUpdateConnections = false;
boolean externalConnectionsChanged = false; boolean externalConnectionsChanged = false;
List<ForgeDirection> copy = new ArrayList<>(externalConnections); List<ForgeDirection> copy = new ArrayList<ForgeDirection>(externalConnections);
// remove any no longer valid connections // remove any no longer valid connections
for (ForgeDirection dir : copy) { for (ForgeDirection dir : copy) {
if (!canConnectToExternal(dir, false)) { if (!canConnectToExternal(dir, false)) {
@@ -637,7 +633,7 @@ public abstract class AbstractConduit implements IConduit {
return collidables; return collidables;
} }
List<CollidableComponent> result = new ArrayList<>(); List<CollidableComponent> result = new ArrayList<CollidableComponent>();
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
Collection<CollidableComponent> col = getCollidables(dir); Collection<CollidableComponent> col = getCollidables(dir);
if (col != null) { if (col != null) {
@@ -676,14 +672,6 @@ public abstract class AbstractConduit implements IConduit {
return new PowerConduitNetwork(); return new PowerConduitNetwork();
} else if (StellarEnderLiquidConduit.class.isAssignableFrom(type)) { } else if (StellarEnderLiquidConduit.class.isAssignableFrom(type)) {
return new EnderLiquidConduitNetwork(StellarEnderLiquidConduit.TYPE); return new EnderLiquidConduitNetwork(StellarEnderLiquidConduit.TYPE);
} else if (PrismaticNaquadahEnderLiquidConduit.class.isAssignableFrom(type)) {
return new EnderLiquidConduitNetwork(PrismaticNaquadahEnderLiquidConduit.TYPE);
} else if (FluxedEnderLiquidConduit.class.isAssignableFrom(type)) {
return new EnderLiquidConduitNetwork(FluxedEnderLiquidConduit.TYPE);
} else if (TranscendentEnderLiquidConduit.class.isAssignableFrom(type)) {
return new EnderLiquidConduitNetwork(TranscendentEnderLiquidConduit.TYPE);
} else if (CosmicEnderLiquidConduit.class.isAssignableFrom(type)) {
return new EnderLiquidConduitNetwork(CosmicEnderLiquidConduit.TYPE);
} else if (MelodicEnderLiquidConduit.class.isAssignableFrom(type)) { } else if (MelodicEnderLiquidConduit.class.isAssignableFrom(type)) {
return new EnderLiquidConduitNetwork(MelodicEnderLiquidConduit.TYPE); return new EnderLiquidConduitNetwork(MelodicEnderLiquidConduit.TYPE);
} else if (CrystallinePinkSlimeEnderLiquidConduit.class.isAssignableFrom(type)) { } else if (CrystallinePinkSlimeEnderLiquidConduit.class.isAssignableFrom(type)) {
@@ -7,12 +7,10 @@ import java.util.List;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import crazypants.enderio.EnderIO;
// I=base type, I is the base class of the implementations accepted by the network // I=base type, I is the base class of the implementations accepted by the network
public abstract class AbstractConduitNetwork<T extends IConduit, I extends T> { public abstract class AbstractConduitNetwork<T extends IConduit, I extends T> {
protected final List<I> conduits = new ArrayList<>(); protected final List<I> conduits = new ArrayList<I>();
protected final Class<I> implClass; protected final Class<I> implClass;
protected final Class<T> baseConduitClass; protected final Class<T> baseConduitClass;
@@ -66,7 +64,7 @@ public abstract class AbstractConduitNetwork<T extends IConduit, I extends T> {
public void addConduit(I con) { public void addConduit(I con) {
if (!conduits.contains(con)) { if (!conduits.contains(con)) {
if (conduits.isEmpty()) { if (conduits.isEmpty()) {
EnderIO.proxy.conduitNetworkTickHandler.registerNetwork(this); ConduitNetworkTickHandler.instance.registerNetwork(this);
} }
conduits.add(con); conduits.add(con);
} }
@@ -77,7 +75,7 @@ public abstract class AbstractConduitNetwork<T extends IConduit, I extends T> {
con.setNetwork(null); con.setNetwork(null);
} }
conduits.clear(); conduits.clear();
EnderIO.proxy.conduitNetworkTickHandler.unregisterNetwork(this); ConduitNetworkTickHandler.instance.unregisterNetwork(this);
} }
public List<I> getConduits() { public List<I> getConduits() {
@@ -24,7 +24,6 @@ import cpw.mods.fml.relauncher.SideOnly;
import crazypants.enderio.EnderIO; import crazypants.enderio.EnderIO;
import crazypants.enderio.EnderIOTab; import crazypants.enderio.EnderIOTab;
import crazypants.enderio.ModObject; import crazypants.enderio.ModObject;
import crazypants.util.ForgeDirections;
import mods.immibis.microblocks.api.IMicroblockCoverSystem; import mods.immibis.microblocks.api.IMicroblockCoverSystem;
import mods.immibis.microblocks.api.IMicroblockSupporterTile; import mods.immibis.microblocks.api.IMicroblockSupporterTile;
import mods.immibis.microblocks.api.MicroblockAPIUtils; import mods.immibis.microblocks.api.MicroblockAPIUtils;
@@ -85,7 +84,7 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
} }
return true; return true;
} else { } else {
ForgeDirection dir = ForgeDirections.DIRECTIONS[side]; ForgeDirection dir = ForgeDirection.values()[side];
int placeX = x + dir.offsetX; int placeX = x + dir.offsetX;
int placeY = y + dir.offsetY; int placeY = y + dir.offsetY;
int placeZ = z + dir.offsetZ; int placeZ = z + dir.offsetZ;
@@ -191,8 +190,9 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
} }
@Override @Override
@SuppressWarnings({ "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List<ItemStack> par3List) { public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int j = 0; j < subtypes.length; ++j) { for (int j = 0; j < subtypes.length; ++j) {
par3List.add(new ItemStack(this, 1, j)); par3List.add(new ItemStack(this, 1, j));
} }
@@ -32,6 +32,7 @@ import com.enderio.core.client.render.BoundingBox;
import com.enderio.core.common.util.BlockCoord; import com.enderio.core.common.util.BlockCoord;
import com.enderio.core.common.util.Util; import com.enderio.core.common.util.Util;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.Optional.Interface; import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@@ -71,7 +72,6 @@ import crazypants.enderio.item.ItemConduitProbe;
import crazypants.enderio.machine.painter.PainterUtil; import crazypants.enderio.machine.painter.PainterUtil;
import crazypants.enderio.network.PacketHandler; import crazypants.enderio.network.PacketHandler;
import crazypants.enderio.tool.ToolUtil; import crazypants.enderio.tool.ToolUtil;
import crazypants.util.ForgeDirections;
import crazypants.util.IFacade; import crazypants.util.IFacade;
import mods.immibis.core.api.multipart.IMultipartRenderingBlockMarker; import mods.immibis.core.api.multipart.IMultipartRenderingBlockMarker;
import mods.immibis.core.api.multipart.IMultipartSystem; import mods.immibis.core.api.multipart.IMultipartSystem;
@@ -93,6 +93,9 @@ public class BlockConduitBundle extends BlockEio
public static BlockConduitBundle create() { public static BlockConduitBundle create() {
MinecraftForge.EVENT_BUS.register(ConduitNetworkTickHandler.instance);
FMLCommonHandler.instance().bus().register(ConduitNetworkTickHandler.instance);
PacketHandler.INSTANCE PacketHandler.INSTANCE
.registerMessage(PacketFluidLevel.class, PacketFluidLevel.class, PacketHandler.nextID(), Side.CLIENT); .registerMessage(PacketFluidLevel.class, PacketFluidLevel.class, PacketHandler.nextID(), Side.CLIENT);
PacketHandler.INSTANCE PacketHandler.INSTANCE
@@ -157,6 +160,7 @@ public class BlockConduitBundle extends BlockEio
BlockConduitBundle result = new BlockConduitBundle(); BlockConduitBundle result = new BlockConduitBundle();
result.init(); result.init();
MinecraftForge.EVENT_BUS.register(result);
return result; return result;
} }
@@ -288,6 +292,41 @@ public class BlockConduitBundle extends BlockEio
effectRenderer.addEffect(digFX); effectRenderer.addEffect(digFX);
} }
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onPlaySound(PlaySoundSourceEvent event) {
String path = event.sound.getPositionedSoundLocation().getResourcePath();
if ("silence.step".equals(path)) {
ISound snd = event.sound;
World world = EnderIO.proxy.getClientWorld();
BlockCoord bc = new BlockCoord(snd.getXPosF(), snd.getYPosF(), snd.getZPosF());
TileEntity te = bc.getTileEntity(world);
if (te instanceof TileConduitBundle && ((TileConduitBundle) te).hasFacade()) {
Block facade = getFacade(world, bc.x, bc.y, bc.z, -1);
ConduitUtil.playHitSound(facade.stepSound, world, bc.x, bc.y, bc.z);
} else {
ConduitUtil.playHitSound(Block.soundTypeMetal, world, bc.x, bc.y, bc.z);
}
}
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onPlaySoundAtEntity(PlaySoundAtEntityEvent event) {
String path = event.name;
World world = event.entity.worldObj;
if ("EnderIO:silence.step".equals(path) && world.isRemote) {
BlockCoord bc = new BlockCoord(event.entity.posX, event.entity.posY - 2, event.entity.posZ);
TileEntity te = bc.getTileEntity(world);
if (te instanceof TileConduitBundle && ((TileConduitBundle) te).hasFacade()) {
Block facade = getFacade(world, bc.x, bc.y, bc.z, -1);
ConduitUtil.playStepSound(facade.stepSound, world, bc.x, bc.y, bc.z);
} else {
ConduitUtil.playStepSound(Block.soundTypeMetal, world, bc.x, bc.y, bc.z);
}
}
}
@Override @Override
protected void init() { protected void init() {
super.init(); super.init();
@@ -295,7 +334,6 @@ public class BlockConduitBundle extends BlockEio
EnderIO.guiHandler.registerGuiHandler(GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE + dir.ordinal(), this); EnderIO.guiHandler.registerGuiHandler(GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE + dir.ordinal(), this);
} }
EnderIO.guiHandler.registerGuiHandler(GuiHandler.GUI_ID_EXTERNAL_CONNECTION_SELECTOR, this); EnderIO.guiHandler.registerGuiHandler(GuiHandler.GUI_ID_EXTERNAL_CONNECTION_SELECTOR, this);
MinecraftForge.EVENT_BUS.register(new EventHandler());
} }
@Override @Override
@@ -435,6 +473,24 @@ public class BlockConduitBundle extends BlockEio
: resist; : resist;
} }
@SubscribeEvent
public void onBreakSpeed(BreakSpeed event) {
if (event.block == this) {
ItemStack held = event.entityPlayer.getCurrentEquippedItem();
if (held == null || held.getItem().getHarvestLevel(held, "pickaxe") == -1) {
event.newSpeed += 2;
}
IConduitBundle te = (IConduitBundle) event.entity.worldObj.getTileEntity(event.x, event.y, event.z);
if (te != null && te.getFacadeType() == FacadeType.HARDENED) {
if (!ConduitUtil.isSolidFacadeRendered(te, event.entityPlayer)) {
event.newSpeed *= 6;
} else {
event.newSpeed *= 2;
}
}
}
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public int getRenderBlockPass() { public int getRenderBlockPass() {
@@ -480,7 +536,7 @@ public class BlockConduitBundle extends BlockEio
IConduitBundle te = (IConduitBundle) rte; IConduitBundle te = (IConduitBundle) rte;
boolean breakBlock = true; boolean breakBlock = true;
List<ItemStack> drop = new ArrayList<>(); List<ItemStack> drop = new ArrayList<ItemStack>();
if (ConduitUtil.isSolidFacadeRendered(te, player)) { if (ConduitUtil.isSolidFacadeRendered(te, player)) {
breakBlock = false; breakBlock = false;
ItemStack fac = new ItemStack(EnderIO.itemConduitFacade, 1, te.getFacadeType().ordinal()); ItemStack fac = new ItemStack(EnderIO.itemConduitFacade, 1, te.getFacadeType().ordinal());
@@ -538,7 +594,7 @@ public class BlockConduitBundle extends BlockEio
if (type == null) { if (type == null) {
// broke a conector so drop any conduits with no connections as there // broke a conector so drop any conduits with no connections as there
// is no other way to remove these // is no other way to remove these
List<IConduit> cons = new ArrayList<>(te.getConduits()); List<IConduit> cons = new ArrayList<IConduit>(te.getConduits());
boolean droppedUnconected = false; boolean droppedUnconected = false;
for (IConduit con : cons) { for (IConduit con : cons) {
if (con.getConduitConnections().isEmpty() && con.getExternalConnections().isEmpty() if (con.getConduitConnections().isEmpty() && con.getExternalConnections().isEmpty()
@@ -771,7 +827,7 @@ public class BlockConduitBundle extends BlockEio
bundle.setFacadeId(facadeID); bundle.setFacadeId(facadeID);
bundle.setFacadeMetadata(facadeMeta); bundle.setFacadeMetadata(facadeMeta);
bundle.setFacadeType(FacadeType.VALUES[facadeType]); bundle.setFacadeType(FacadeType.values()[facadeType]);
if (!world.isRemote) { if (!world.isRemote) {
ConduitUtil.playPlaceSound(facadeID.stepSound, world, x, y, z); ConduitUtil.playPlaceSound(facadeID.stepSound, world, x, y, z);
} }
@@ -820,7 +876,7 @@ public class BlockConduitBundle extends BlockEio
return new ExternalConnectionContainer( return new ExternalConnectionContainer(
player.inventory, player.inventory,
(IConduitBundle) te, (IConduitBundle) te,
ForgeDirections.DIRECTIONS[id - GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE]); ForgeDirection.values()[id - GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE]);
} }
return null; return null;
} }
@@ -835,7 +891,7 @@ public class BlockConduitBundle extends BlockEio
return new GuiExternalConnection( return new GuiExternalConnection(
player.inventory, player.inventory,
(IConduitBundle) te, (IConduitBundle) te,
ForgeDirections.DIRECTIONS[id - GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE]); ForgeDirection.values()[id - GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE]);
} }
return null; return null;
} }
@@ -867,7 +923,7 @@ public class BlockConduitBundle extends BlockEio
@Override @Override
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB axisalignedbb, public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB axisalignedbb,
List<AxisAlignedBB> arraylist, Entity par7Entity) { @SuppressWarnings("rawtypes") List arraylist, Entity par7Entity) {
if (MicroblocksUtil.supportMicroblocks()) { if (MicroblocksUtil.supportMicroblocks()) {
IM__addCollisionBoxesToList(world, x, y, z, axisalignedbb, arraylist, par7Entity); IM__addCollisionBoxesToList(world, x, y, z, axisalignedbb, arraylist, par7Entity);
@@ -1035,7 +1091,7 @@ public class BlockConduitBundle extends BlockEio
return null; return null;
} }
IConduitBundle bundle = (IConduitBundle) te; IConduitBundle bundle = (IConduitBundle) te;
List<RaytraceResult> hits = new ArrayList<>(); List<RaytraceResult> hits = new ArrayList<RaytraceResult>();
if (player == null) { if (player == null) {
player = EnderIO.proxy.getClientPlayer(); player = EnderIO.proxy.getClientPlayer();
@@ -1052,7 +1108,8 @@ public class BlockConduitBundle extends BlockEio
} }
} else { } else {
ConduitDisplayMode mode = ConduitUtil.getDisplayMode(player); ConduitDisplayMode mode = ConduitUtil.getDisplayMode(player);
Collection<CollidableComponent> components = new ArrayList<>(bundle.getCollidableComponents()); Collection<CollidableComponent> components = new ArrayList<CollidableComponent>(
bundle.getCollidableComponents());
for (CollidableComponent component : components) { for (CollidableComponent component : components) {
if ((component.conduitType != null || mode == ConduitDisplayMode.ALL) if ((component.conduitType != null || mode == ConduitDisplayMode.ALL)
&& ConduitUtil.renderConduit(player, component.conduitType)) { && ConduitUtil.renderConduit(player, component.conduitType)) {
@@ -1204,8 +1261,9 @@ public class BlockConduitBundle extends BlockEio
return IMultipartSystem.instance.hook_collisionRayTrace(cur, world, x, y, z, src, dst); return IMultipartSystem.instance.hook_collisionRayTrace(cur, world, x, y, z, src, dst);
} }
private void IM__addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB mask, @SuppressWarnings({ "rawtypes", "unchecked" })
List<AxisAlignedBB> list, Entity entity) { private void IM__addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB mask, List list,
Entity entity) {
IMultipartSystem.instance.hook_addCollisionBoxesToList(world, x, y, z, mask, list, entity); IMultipartSystem.instance.hook_addCollisionBoxesToList(world, x, y, z, mask, list, entity);
} }
@@ -1217,61 +1275,4 @@ public class BlockConduitBundle extends BlockEio
private boolean hasMicroblocks(IConduitBundle bundle) { private boolean hasMicroblocks(IConduitBundle bundle) {
return !bundle.getCoverSystem().getAllParts().isEmpty(); return !bundle.getCoverSystem().getAllParts().isEmpty();
} }
public class EventHandler {
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onPlaySound(PlaySoundSourceEvent event) {
String path = event.sound.getPositionedSoundLocation().getResourcePath();
if ("silence.step".equals(path)) {
ISound snd = event.sound;
World world = EnderIO.proxy.getClientWorld();
if (world == null) return;
BlockCoord bc = new BlockCoord(snd.getXPosF(), snd.getYPosF(), snd.getZPosF());
TileEntity te = bc.getTileEntity(world);
if (te instanceof TileConduitBundle && ((TileConduitBundle) te).hasFacade()) {
Block facade = getFacade(world, bc.x, bc.y, bc.z, -1);
ConduitUtil.playHitSound(facade.stepSound, world, bc.x, bc.y, bc.z);
} else {
ConduitUtil.playHitSound(Block.soundTypeMetal, world, bc.x, bc.y, bc.z);
}
}
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onPlaySoundAtEntity(PlaySoundAtEntityEvent event) {
String path = event.name;
World world = event.entity.worldObj;
if ("EnderIO:silence.step".equals(path) && world.isRemote) {
BlockCoord bc = new BlockCoord(event.entity.posX, event.entity.posY - 2, event.entity.posZ);
TileEntity te = bc.getTileEntity(world);
if (te instanceof TileConduitBundle && ((TileConduitBundle) te).hasFacade()) {
Block facade = getFacade(world, bc.x, bc.y, bc.z, -1);
ConduitUtil.playStepSound(facade.stepSound, world, bc.x, bc.y, bc.z);
} else {
ConduitUtil.playStepSound(Block.soundTypeMetal, world, bc.x, bc.y, bc.z);
}
}
}
@SubscribeEvent
public void onBreakSpeed(BreakSpeed event) {
if (event.block == BlockConduitBundle.this) {
ItemStack held = event.entityPlayer.getCurrentEquippedItem();
if (held == null || held.getItem().getHarvestLevel(held, "pickaxe") == -1) {
event.newSpeed += 2;
}
IConduitBundle te = (IConduitBundle) event.entity.worldObj.getTileEntity(event.x, event.y, event.z);
if (te != null && te.getFacadeType() == FacadeType.HARDENED) {
if (!ConduitUtil.isSolidFacadeRendered(te, event.entityPlayer)) {
event.newSpeed *= 6;
} else {
event.newSpeed *= 2;
}
}
}
}
}
} }
@@ -196,7 +196,7 @@ public class ConduitDisplayMode {
} }
public static Iterable<ConduitDisplayMode> getRenderableModes() { public static Iterable<ConduitDisplayMode> getRenderableModes() {
return FluentIterable.from(registrar).filter(new Predicate<>() { return FluentIterable.from(registrar).filter(new Predicate<ConduitDisplayMode>() {
@Override @Override
public boolean apply(ConduitDisplayMode input) { public boolean apply(ConduitDisplayMode input) {
@@ -10,15 +10,18 @@ import cpw.mods.fml.common.gameevent.TickEvent.Phase;
public class ConduitNetworkTickHandler { public class ConduitNetworkTickHandler {
public interface TickListener { public static final ConduitNetworkTickHandler instance = new ConduitNetworkTickHandler();
void tickStart(TickEvent.ServerTickEvent evt); public static interface TickListener {
void tickEnd(TickEvent.ServerTickEvent evt); public void tickStart(TickEvent.ServerTickEvent evt);
public void tickEnd(TickEvent.ServerTickEvent evt);
} }
private final List<TickListener> listeners = new ArrayList<>(); private final List<TickListener> listeners = new ArrayList<TickListener>();
private final IdentityHashMap<AbstractConduitNetwork<?, ?>, Boolean> networks = new IdentityHashMap<>();
private final IdentityHashMap<AbstractConduitNetwork<?, ?>, Boolean> networks = new IdentityHashMap<AbstractConduitNetwork<?, ?>, Boolean>();
public void addListener(TickListener listener) { public void addListener(TickListener listener) {
listeners.add(listener); listeners.add(listener);
@@ -688,7 +688,7 @@ public class ConduitRecipes {
String fluix = "crystalFluix"; String fluix = "crystalFluix";
String pureFluix = "crystalPureFluix"; String pureFluix = "crystalPureFluix";
ItemStack quartzFiber = AEApi.instance().definitions().parts().quartzFiber().maybeStack(1).get().copy(); ItemStack quartzFiber = AEApi.instance().parts().partQuartzFiber.stack(1).copy();
ItemStack conduitBinder = new ItemStack(EnderIO.itemMaterial, 1, Material.CONDUIT_BINDER.ordinal()); ItemStack conduitBinder = new ItemStack(EnderIO.itemMaterial, 1, Material.CONDUIT_BINDER.ordinal());
ItemStack res = new ItemStack(EnderIO.itemMEConduit, Config.numConduitsPerRecipe / 2); ItemStack res = new ItemStack(EnderIO.itemMEConduit, Config.numConduitsPerRecipe / 2);
@@ -697,6 +697,10 @@ public class ConduitRecipes {
res.stackSize = 1; res.stackSize = 1;
ItemStack resDense = new ItemStack(EnderIO.itemMEConduit, 1, 1); ItemStack resDense = new ItemStack(EnderIO.itemMEConduit, 1, 1);
ItemStack resUltra = new ItemStack(EnderIO.itemMEConduit, 1, 2);
addShaped(resDense, "bCb", "CbC", "bCb", 'b', conduitBinder, 'C', res); addShaped(resDense, "bCb", "CbC", "bCb", 'b', conduitBinder, 'C', res);
if (Config.enableMEUltraDenseConduits) {
addShaped(resUltra, "bCb", "CbC", "bCb", 'b', conduitBinder, 'C', resDense);
}
} }
} }
@@ -43,7 +43,7 @@ public class ConduitUtil {
public static final Random RANDOM = new Random(); public static final Random RANDOM = new Random();
@SuppressWarnings("unchecked") @SuppressWarnings({ "rawtypes", "unchecked" })
public static void ensureValidNetwork(IConduit conduit) { public static void ensureValidNetwork(IConduit conduit) {
TileEntity te = conduit.getBundle().getEntity(); TileEntity te = conduit.getBundle().getEntity();
World world = te.getWorldObj(); World world = te.getWorldObj();
@@ -54,15 +54,13 @@ public class ConduitUtil {
return; return;
} }
@SuppressWarnings("rawtypes")
AbstractConduitNetwork res = conduit.createNetworkForType(); AbstractConduitNetwork res = conduit.createNetworkForType();
res.init(conduit.getBundle(), connections, world); res.init(conduit.getBundle(), connections, world);
return; return;
} }
@SuppressWarnings("unchecked") @SuppressWarnings({ "unchecked", "rawtypes" })
private static boolean reuseNetwork(IConduit con, Collection<? extends IConduit> connections, World world) { private static boolean reuseNetwork(IConduit con, Collection<? extends IConduit> connections, World world) {
@SuppressWarnings("rawtypes")
AbstractConduitNetwork network = null; AbstractConduitNetwork network = null;
for (IConduit conduit : connections) { for (IConduit conduit : connections) {
if (network == null) { if (network == null) {
@@ -254,7 +252,7 @@ public class ConduitUtil {
if (!(te instanceof IConduitBundle)) { if (!(te instanceof IConduitBundle)) {
return Collections.emptyList(); return Collections.emptyList();
} }
List<T> result = new ArrayList<>(); List<T> result = new ArrayList<T>();
IConduitBundle root = (IConduitBundle) te; IConduitBundle root = (IConduitBundle) te;
T con = root.getConduit(type); T con = root.getConduit(type);
if (con != null) { if (con != null) {
@@ -320,7 +318,7 @@ public class ConduitUtil {
} }
int signalStrength = getInternalSignalForColor(bundle, col); int signalStrength = getInternalSignalForColor(bundle, col);
if (signalStrength < 15 && bundle != null && bundle.getEntity() != null) { if (signalStrength < 15 && DyeColor.RED == col && bundle != null && bundle.getEntity() != null) {
TileEntity te = bundle.getEntity(); TileEntity te = bundle.getEntity();
signalStrength = Math signalStrength = Math
.max(signalStrength, te.getWorldObj().getStrongestIndirectPower(te.xCoord, te.yCoord, te.zCoord)); .max(signalStrength, te.getWorldObj().getStrongestIndirectPower(te.xCoord, te.yCoord, te.zCoord));
@@ -363,7 +361,7 @@ public class ConduitUtil {
return; return;
} }
IConduitBundle cb = (IConduitBundle) te; IConduitBundle cb = (IConduitBundle) te;
Set<ForgeDirection> cons = new HashSet<>(); Set<ForgeDirection> cons = new HashSet<ForgeDirection>();
boolean hasInsulated = false; boolean hasInsulated = false;
for (IConduit con : cb.getConduits()) { for (IConduit con : cb.getConduits()) {
cons.addAll(con.getExternalConnections()); cons.addAll(con.getExternalConnections());
@@ -10,10 +10,6 @@ public enum ConnectionMode {
DISABLED("gui.conduit.ioMode.disabled"), DISABLED("gui.conduit.ioMode.disabled"),
NOT_SET("gui.conduit.ioMode.notSet"); NOT_SET("gui.conduit.ioMode.notSet");
/**
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
*/
public static final ConnectionMode[] VALUES = values();
private final String unlocalisedName; private final String unlocalisedName;
ConnectionMode(String unlocalisedName) { ConnectionMode(String unlocalisedName) {
@@ -26,19 +22,19 @@ public enum ConnectionMode {
public static ConnectionMode getNext(ConnectionMode mode) { public static ConnectionMode getNext(ConnectionMode mode) {
int ord = mode.ordinal() + 1; int ord = mode.ordinal() + 1;
if (ord >= ConnectionMode.VALUES.length) { if (ord >= ConnectionMode.values().length) {
ord = 0; ord = 0;
} }
return ConnectionMode.VALUES[ord]; return ConnectionMode.values()[ord];
} }
public static ConnectionMode getPrevious(ConnectionMode mode) { public static ConnectionMode getPrevious(ConnectionMode mode) {
int ord = mode.ordinal() - 1; int ord = mode.ordinal() - 1;
if (ord < 0) { if (ord < 0) {
ord = ConnectionMode.VALUES.length - 1; ord = ConnectionMode.values().length - 1;
} }
return ConnectionMode.VALUES[ord]; return ConnectionMode.values()[ord];
} }
public boolean acceptsInput() { public boolean acceptsInput() {
@@ -33,7 +33,7 @@ public class RaytraceResult {
if (origin == null || toSort == null) { if (origin == null || toSort == null) {
return; return;
} }
Collections.sort(toSort, new Comparator<>() { Collections.sort(toSort, new Comparator<RaytraceResult>() {
@Override @Override
public int compare(RaytraceResult o1, RaytraceResult o2) { public int compare(RaytraceResult o1, RaytraceResult o2) {
@@ -25,7 +25,6 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.FluidTankInfo;
import com.enderio.core.client.render.BoundingBox; import com.enderio.core.client.render.BoundingBox;
import com.gtnewhorizon.gtnhlib.concurrent.cas.CasList;
import appeng.api.networking.IGridNode; import appeng.api.networking.IGridNode;
import appeng.api.util.AECableType; import appeng.api.util.AECableType;
@@ -51,7 +50,6 @@ import crazypants.enderio.conduit.power.IPowerConduit;
import crazypants.enderio.conduit.redstone.IRedstoneConduit; import crazypants.enderio.conduit.redstone.IRedstoneConduit;
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduit; import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduit;
import crazypants.enderio.config.Config; import crazypants.enderio.config.Config;
import crazypants.util.ForgeDirections;
import li.cil.oc.api.network.Message; import li.cil.oc.api.network.Message;
import li.cil.oc.api.network.Node; import li.cil.oc.api.network.Node;
import mekanism.api.gas.Gas; import mekanism.api.gas.Gas;
@@ -68,7 +66,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
public static final short NBT_VERSION = 1; 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 Block facadeId = null;
private int facadeMeta = 0; private int facadeMeta = 0;
@@ -76,9 +74,9 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
private boolean facadeChanged; 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 conduitsDirty = true;
private boolean collidablesDirty = true; private boolean collidablesDirty = true;
@@ -413,7 +411,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
} }
// If you're wondering why I am not using conduit.writeToNBT, it is because there is some data that should not // 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. // persist, some of which causes crashes with energy conduits.
NBTTagCompound[] originalData = new NBTTagCompound[ForgeDirections.DIRECTIONS.length]; NBTTagCompound[] originalData = new NBTTagCompound[ForgeDirection.values().length];
for (ForgeDirection conduitConnection : original.getExternalConnections()) { for (ForgeDirection conduitConnection : original.getExternalConnections()) {
NBTTagCompound tag = new NBTTagCompound(); NBTTagCompound tag = new NBTTagCompound();
original.writeConnectionSettingsToNBT(conduitConnection, tag); original.writeConnectionSettingsToNBT(conduitConnection, tag);
@@ -424,7 +422,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
for (int i = 0; i < originalData.length; i++) { for (int i = 0; i < originalData.length; i++) {
NBTTagCompound nbt = originalData[i]; NBTTagCompound nbt = originalData[i];
if (nbt != null) { if (nbt != null) {
replacement.readConduitSettingsFromNBT(ForgeDirections.DIRECTIONS[i], nbt); replacement.readConduitSettingsFromNBT(ForgeDirection.values()[i], nbt);
} }
} }
} }
@@ -538,12 +536,11 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
@Override @Override
public List<CollidableComponent> getConnectors() { public List<CollidableComponent> getConnectors() {
List<CollidableComponent> result = new ArrayList<>(); List<CollidableComponent> result = new ArrayList<CollidableComponent>();
addConnectors(result); addConnectors(result);
return result; return result;
} }
@SuppressWarnings("unchecked")
private void addConnectors(List<CollidableComponent> result) { private void addConnectors(List<CollidableComponent> result) {
if (conduits.isEmpty()) { if (conduits.isEmpty()) {
@@ -564,7 +561,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
cachedConnectors.clear(); cachedConnectors.clear();
// TODO: What an unholly mess! (and it doesn't even work correctly...) // TODO: What an unholly mess! (and it doesn't even work correctly...)
List<CollidableComponent> coreBounds = new ArrayList<>(); List<CollidableComponent> coreBounds = new ArrayList<CollidableComponent>();
for (IConduit con : conduits) { for (IConduit con : conduits) {
addConduitCores(coreBounds, con); addConduitCores(coreBounds, con);
} }
@@ -572,13 +569,13 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
result.addAll(coreBounds); result.addAll(coreBounds);
// 1st algorithm // 1st algorithm
List<CollidableComponent> conduitsBounds = new ArrayList<>(); List<CollidableComponent> conduitsBounds = new ArrayList<CollidableComponent>();
for (IConduit con : conduits) { for (IConduit con : conduits) {
conduitsBounds.addAll(con.getCollidableComponents()); conduitsBounds.addAll(con.getCollidableComponents());
addConduitCores(conduitsBounds, con); addConduitCores(conduitsBounds, con);
} }
Set<Class<IConduit>> collidingTypes = new HashSet<>(); Set<Class<IConduit>> collidingTypes = new HashSet<Class<IConduit>>();
for (CollidableComponent conCC : conduitsBounds) { for (CollidableComponent conCC : conduitsBounds) {
for (CollidableComponent innerCC : conduitsBounds) { for (CollidableComponent innerCC : conduitsBounds) {
if (!InsulatedRedstoneConduit.COLOR_CONTROLLER_ID.equals(innerCC.data) if (!InsulatedRedstoneConduit.COLOR_CONTROLLER_ID.equals(innerCC.data)
@@ -592,7 +589,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
// TODO: Remove the core geometries covered up by this as no point in rendering these // TODO: Remove the core geometries covered up by this as no point in rendering these
if (!collidingTypes.isEmpty()) { if (!collidingTypes.isEmpty()) {
List<CollidableComponent> colCores = new ArrayList<>(); List<CollidableComponent> colCores = new ArrayList<CollidableComponent>();
for (Class<IConduit> c : collidingTypes) { for (Class<IConduit> c : collidingTypes) {
IConduit con = getConduit(c); IConduit con = getConduit(c);
if (con != null) { if (con != null) {
@@ -624,7 +621,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
for (IConduit con : conduits) { for (IConduit con : conduits) {
if (con.hasConnections()) { if (con.hasConnections()) {
List<CollidableComponent> cores = new ArrayList<>(); List<CollidableComponent> cores = new ArrayList<CollidableComponent>();
addConduitCores(cores, con); addConduitCores(cores, con);
if (cores.size() > 1) { if (cores.size() > 1) {
BoundingBox bb = cores.get(0).bound; BoundingBox bb = cores.get(0).bound;
@@ -967,6 +964,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
return (IGridNode) node; return (IGridNode) node;
} }
@SuppressWarnings("cast")
@Override @Override
@Method(modid = "appliedenergistics2") @Method(modid = "appliedenergistics2")
public void setGridNode(Object node) { public void setGridNode(Object node) {
@@ -109,6 +109,7 @@ public class BlockConduitFacade extends BlockEio implements IPaintedBlock, Clone
} }
Block block = cb.getFacadeId(); Block block = cb.getFacadeId();
int meta = cb.getFacadeMetadata();
if (block == null || block == this) { if (block == null || block == this) {
return; return;
} }
@@ -140,7 +141,7 @@ public class BlockConduitFacade extends BlockEio implements IPaintedBlock, Clone
return new Mimic(id, meta); return new Mimic(id, meta);
} }
static class Mimic { class Mimic {
int meta; int meta;
Block block; Block block;
@@ -32,17 +32,14 @@ import crazypants.enderio.machine.painter.BasicPainterTemplate;
import crazypants.enderio.machine.painter.IPaintedBlock; import crazypants.enderio.machine.painter.IPaintedBlock;
import crazypants.enderio.machine.painter.PaintSourceValidator; import crazypants.enderio.machine.painter.PaintSourceValidator;
import crazypants.enderio.machine.painter.PainterUtil; import crazypants.enderio.machine.painter.PainterUtil;
import crazypants.util.ForgeDirections;
public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider, IResourceTooltipProvider { public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider, IResourceTooltipProvider {
public enum FacadeType { public static enum FacadeType {
BASIC, BASIC,
HARDENED; HARDENED;
public static final FacadeType[] VALUES = values();
public String getUnlocName(Item me) { public String getUnlocName(Item me) {
return this == BASIC ? me.getUnlocalizedName() : me.getUnlocalizedName() + ".hardened"; return this == BASIC ? me.getUnlocalizedName() : me.getUnlocalizedName() + ".hardened";
} }
@@ -68,17 +65,18 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
GameRegistry.registerItem(this, ModObject.itemConduitFacade.unlocalisedName); GameRegistry.registerItem(this, ModObject.itemConduitFacade.unlocalisedName);
} }
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs p_150895_2_, List<ItemStack> list) { public void getSubItems(Item item, CreativeTabs p_150895_2_, List list) {
for (FacadeType t : FacadeType.VALUES) { for (FacadeType t : FacadeType.values()) {
list.add(new ItemStack(item, 1, t.ordinal())); list.add(new ItemStack(item, 1, t.ordinal()));
} }
} }
@Override @Override
public String getUnlocalizedName(ItemStack stack) { public String getUnlocalizedName(ItemStack stack) {
return FacadeType.VALUES[stack.getItemDamage()].getUnlocName(this); return FacadeType.values()[stack.getItemDamage()].getUnlocName(this);
} }
@Override @Override
@@ -89,7 +87,7 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister IIconRegister) { public void registerIcons(IIconRegister IIconRegister) {
icons = new IIcon[FacadeType.VALUES.length]; icons = new IIcon[FacadeType.values().length];
icons[0] = itemIcon = IIconRegister.registerIcon("enderio:conduitFacade"); icons[0] = itemIcon = IIconRegister.registerIcon("enderio:conduitFacade");
icons[1] = IIconRegister.registerIcon("enderio:conduitFacadeHardened"); icons[1] = IIconRegister.registerIcon("enderio:conduitFacadeHardened");
overlayIcon = IIconRegister.registerIcon("enderio:conduitFacadeOverlay"); overlayIcon = IIconRegister.registerIcon("enderio:conduitFacadeOverlay");
@@ -118,7 +116,7 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
return true; return true;
} }
ForgeDirection dir = ForgeDirections.DIRECTIONS[side]; ForgeDirection dir = ForgeDirection.values()[side];
int placeX = x + dir.offsetX; int placeX = x + dir.offsetX;
int placeY = y + dir.offsetY; int placeY = y + dir.offsetY;
int placeZ = z + dir.offsetZ; int placeZ = z + dir.offsetZ;
@@ -133,7 +131,7 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
facadeMeta = PainterUtil.adjustFacadeMetadata(facadeID, facadeMeta, side); facadeMeta = PainterUtil.adjustFacadeMetadata(facadeID, facadeMeta, side);
bundle.setFacadeId(facadeID); bundle.setFacadeId(facadeID);
bundle.setFacadeMetadata(facadeMeta); bundle.setFacadeMetadata(facadeMeta);
bundle.setFacadeType(FacadeType.VALUES[itemStack.getItemDamage()]); bundle.setFacadeType(FacadeType.values()[itemStack.getItemDamage()]);
ConduitUtil.playPlaceSound(facadeID.stepSound, world, x, y, z); ConduitUtil.playPlaceSound(facadeID.stepSound, world, x, y, z);
if (!player.capabilities.isCreativeMode) { if (!player.capabilities.isCreativeMode) {
itemStack.stackSize--; itemStack.stackSize--;
@@ -173,9 +171,10 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
return result; return result;
} }
@SuppressWarnings("rawtypes")
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer par2EntityPlayer, List<String> list, boolean par4) { public void addInformation(ItemStack item, EntityPlayer par2EntityPlayer, List list, boolean par4) {
super.addInformation(item, par2EntityPlayer, list, par4); super.addInformation(item, par2EntityPlayer, list, par4);
} }
@@ -184,13 +183,15 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
return getUnlocalizedName(); return getUnlocalizedName();
} }
@SuppressWarnings("rawtypes")
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addCommonEntries(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag) {} public void addCommonEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addBasicEntries(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag) { public void addBasicEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {
if (PainterUtil.getSourceBlock(itemstack) == null) { if (PainterUtil.getSourceBlock(itemstack) == null) {
list.add(EnderIO.lang.localize("item.itemConduitFacade.tooltip.notpainted")); list.add(EnderIO.lang.localize("item.itemConduitFacade.tooltip.notpainted"));
} else { } else {
@@ -198,9 +199,10 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
} }
} }
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addDetailedEntries(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag) { public void addDetailedEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {
SpecialTooltipHandler.addDetailedTooltipFromResources(list, itemstack); SpecialTooltipHandler.addDetailedTooltipFromResources(list, itemstack);
if (itemstack.getItemDamage() == FacadeType.HARDENED.ordinal()) { if (itemstack.getItemDamage() == FacadeType.HARDENED.ordinal()) {
list.add(""); list.add("");
@@ -25,10 +25,12 @@ import mekanism.api.gas.IGasHandler;
public abstract class AbstractGasConduit extends AbstractConduit implements IGasConduit { public abstract class AbstractGasConduit extends AbstractConduit implements IGasConduit {
protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes = new EnumMap<>(ForgeDirection.class); protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes = new EnumMap<ForgeDirection, RedstoneControlMode>(
protected final EnumMap<ForgeDirection, DyeColor> extractionColors = new EnumMap<>(ForgeDirection.class); ForgeDirection.class);
protected final EnumMap<ForgeDirection, DyeColor> extractionColors = new EnumMap<ForgeDirection, DyeColor>(
ForgeDirection.class);
protected final Map<ForgeDirection, Integer> externalRedstoneSignals = new HashMap<>(); protected final Map<ForgeDirection, Integer> externalRedstoneSignals = new HashMap<ForgeDirection, Integer>();
protected boolean redstoneStateDirty = true; protected boolean redstoneStateDirty = true;
@Method(modid = GasUtil.API_NAME) @Method(modid = GasUtil.API_NAME)
@@ -184,15 +186,15 @@ public abstract class AbstractGasConduit extends AbstractConduit implements IGas
String key = "extRM." + dir.name(); String key = "extRM." + dir.name();
if (nbtRoot.hasKey(key)) { if (nbtRoot.hasKey(key)) {
short ord = nbtRoot.getShort(key); short ord = nbtRoot.getShort(key);
if (ord >= 0 && ord < RedstoneControlMode.VALUES.length) { if (ord >= 0 && ord < RedstoneControlMode.values().length) {
extractionModes.put(dir, RedstoneControlMode.VALUES[ord]); extractionModes.put(dir, RedstoneControlMode.values()[ord]);
} }
} }
key = "extSC." + dir.name(); key = "extSC." + dir.name();
if (nbtRoot.hasKey(key)) { if (nbtRoot.hasKey(key)) {
short ord = nbtRoot.getShort(key); short ord = nbtRoot.getShort(key);
if (ord >= 0 && ord < DyeColor.VALUES.length) { if (ord >= 0 && ord < DyeColor.values().length) {
extractionColors.put(dir, DyeColor.VALUES[ord]); extractionColors.put(dir, DyeColor.values()[ord]);
} }
} }
} }
@@ -10,6 +10,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import com.enderio.core.client.render.IconUtil; import com.enderio.core.client.render.IconUtil;
import com.enderio.core.common.util.BlockCoord;
import cpw.mods.fml.common.Optional.Method; import cpw.mods.fml.common.Optional.Method;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@@ -87,6 +88,7 @@ public class GasConduit extends AbstractGasTankConduit {
} }
private void doExtract() { private void doExtract() {
BlockCoord loc = getLocation();
if (!hasConnectionMode(ConnectionMode.INPUT)) { if (!hasConnectionMode(ConnectionMode.INPUT)) {
return; return;
} }
@@ -101,6 +103,7 @@ public class GasConduit extends AbstractGasTankConduit {
return; return;
} }
Gas f = tank.getGas() == null ? null : tank.getGas().getGas();
for (ForgeDirection dir : externalConnections) { for (ForgeDirection dir : externalConnections) {
if (autoExtractForDir(dir)) { if (autoExtractForDir(dir)) {
if (network.extractFrom(this, dir, MAX_EXTRACT_PER_TICK)) { if (network.extractFrom(this, dir, MAX_EXTRACT_PER_TICK)) {
@@ -18,7 +18,7 @@ public class GasConduitNetwork extends AbstractGasTankConduitNetwork<GasConduit>
private final ConduitGasTank tank = new ConduitGasTank(0); private final ConduitGasTank tank = new ConduitGasTank(0);
private final Set<GasOutput> outputs = new HashSet<>(); private final Set<GasOutput> outputs = new HashSet<GasOutput>();
private Iterator<GasOutput> outputIterator; private Iterator<GasOutput> outputIterator;
@@ -21,7 +21,7 @@ import crazypants.enderio.gui.IconEIO;
public class ItemGasConduit extends AbstractItemConduit implements IAdvancedTooltipProvider { public class ItemGasConduit extends AbstractItemConduit implements IAdvancedTooltipProvider {
private static final ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] { private static ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
new ItemConduitSubtype(ModObject.itemGasConduit.name(), "enderio:itemGasConduit"), }; new ItemConduitSubtype(ModObject.itemGasConduit.name(), "enderio:itemGasConduit"), };
public static ItemGasConduit create() { public static ItemGasConduit create() {
@@ -56,15 +56,15 @@ public class ItemGasConduit extends AbstractItemConduit implements IAdvancedTool
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addCommonEntries(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag) {} public void addCommonEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addBasicEntries(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag) {} public void addBasicEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addDetailedEntries(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag) { public void addDetailedEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {
String gpt = " " + EnderIO.lang.localize("gas.gasTick"); String gpt = " " + EnderIO.lang.localize("gas.gasTick");
int extractRate = Config.gasConduitExtractRate; int extractRate = Config.gasConduitExtractRate;
int maxIo = Config.gasConduitMaxIoRate; int maxIo = Config.gasConduitMaxIoRate;
@@ -12,7 +12,7 @@ public class CollidableCache {
public static final CollidableCache instance = new CollidableCache(); public static final CollidableCache instance = new CollidableCache();
private final Map<CacheKey, Collection<CollidableComponent>> cache = new HashMap<>(); private final Map<CacheKey, Collection<CollidableComponent>> cache = new HashMap<CollidableCache.CacheKey, Collection<CollidableComponent>>();
public CacheKey createKey(Class<? extends IConduit> baseType, Offset offset, ForgeDirection dir, boolean isStub) { public CacheKey createKey(Class<? extends IConduit> baseType, Offset offset, ForgeDirection dir, boolean isStub) {
return new CacheKey(baseType, offset, dir, isStub); return new CacheKey(baseType, offset, dir, isStub);
@@ -33,7 +33,7 @@ public class ConduitGeometryUtil {
public static final float CONNECTOR_DEPTH = 0.05f; public static final float CONNECTOR_DEPTH = 0.05f;
private static final Map<ForgeDirection, BoundingBox[]> EXTERNAL_CONNECTOR_BOUNDS = new HashMap<>(); private static Map<ForgeDirection, BoundingBox[]> EXTERNAL_CONNECTOR_BOUNDS = new HashMap<ForgeDirection, BoundingBox[]>();
static { static {
setupBounds(0.5f); setupBounds(0.5f);
@@ -106,9 +106,9 @@ public class ConduitGeometryUtil {
return val < 0 ? 1 + val : val; return val < 0 ? 1 + val : val;
} }
private final Map<GeometryKey, BoundingBox> boundsCache = new HashMap<>(); private Map<GeometryKey, BoundingBox> boundsCache = new HashMap<GeometryKey, BoundingBox>();
private final EnumMap<ConduitConnectorType, BoundingBox> connectorBounds = new EnumMap<>( private EnumMap<ConduitConnectorType, BoundingBox> connectorBounds = new EnumMap<ConduitConnectorType, BoundingBox>(
ConduitConnectorType.class); ConduitConnectorType.class);
private ConduitGeometryUtil() {} private ConduitGeometryUtil() {}
@@ -21,7 +21,8 @@ import com.enderio.core.common.vecmath.Vertex;
public class ConnectionModeGeometry { public class ConnectionModeGeometry {
private static final EnumMap<ForgeDirection, List<Vertex>> VERTS = new EnumMap<>(ForgeDirection.class); private static final EnumMap<ForgeDirection, List<Vertex>> VERTS = new EnumMap<ForgeDirection, List<Vertex>>(
ForgeDirection.class);
static { static {
float scale = 0.9f; float scale = 0.9f;
@@ -83,7 +84,7 @@ public class ConnectionModeGeometry {
} }
private static List<Vertex> createVerticesForDir(BoundingBox refBB, VertexTransform xform) { private static List<Vertex> createVerticesForDir(BoundingBox refBB, VertexTransform xform) {
List<Vertex> result = new ArrayList<>(24); List<Vertex> result = new ArrayList<Vertex>(24);
for (ForgeDirection face : ForgeDirection.VALID_DIRECTIONS) { for (ForgeDirection face : ForgeDirection.VALID_DIRECTIONS) {
result.addAll(refBB.getCornersWithUvForFace(face)); result.addAll(refBB.getCornersWithUvForFace(face));
} }
@@ -16,7 +16,7 @@ import crazypants.enderio.conduit.redstone.IRedstoneConduit;
public class Offsets { public class Offsets {
private static final Map<OffsetKey, Offset> OFFSETS = new HashMap<>(); private static Map<OffsetKey, Offset> OFFSETS = new HashMap<OffsetKey, Offset>();
static { static {
OFFSETS.put(key(IRedstoneConduit.class, Axis.NONE), Offset.UP); OFFSETS.put(key(IRedstoneConduit.class, Axis.NONE), Offset.UP);
@@ -31,7 +31,7 @@ public class BaseSettingsPanel implements ITabPanel {
static final int ID_EXTRACT_ENABLED = 328; static final int ID_EXTRACT_ENABLED = 328;
protected static final int ID_INSERT_FILTER_OPTIONS = 329; protected static final int ID_INSERT_FILTER_OPTIONS = 329;
protected static final int ID_EXTRACT_FILTER_OPTIONS = 330; protected static final int ID_EXTRACT_FILTER_OPTIONS = 330;
protected static final int ID_ENABLED = 331; protected final int ID_ENABLED = 331;
protected final @Nonnull IWidgetIcon icon; protected final @Nonnull IWidgetIcon icon;
protected final @Nonnull GuiExternalConnection gui; protected final @Nonnull GuiExternalConnection gui;
@@ -41,8 +41,8 @@ public class BaseSettingsPanel implements ITabPanel {
protected ConnectionMode oldConnectionMode; protected ConnectionMode oldConnectionMode;
private final @Nonnull String inputHeading; private @Nonnull String inputHeading;
private final @Nonnull String outputHeading; private @Nonnull String outputHeading;
private boolean insertEnabled = false; private boolean insertEnabled = false;
private boolean extractEnabled = false; private boolean extractEnabled = false;
@@ -142,7 +142,7 @@ public class BaseSettingsPanel implements ITabPanel {
} }
}; };
ArrayList<String> funcUpgradeTips = new ArrayList<>(); ArrayList<String> funcUpgradeTips = new ArrayList<String>();
SpecialTooltipHandler.addTooltipFromResources(funcUpgradeTips, "enderio.gui.conduit.item.functionupgrade.line"); SpecialTooltipHandler.addTooltipFromResources(funcUpgradeTips, "enderio.gui.conduit.item.functionupgrade.line");
for (FunctionUpgrade upgrade : FunctionUpgrade.values()) { for (FunctionUpgrade upgrade : FunctionUpgrade.values()) {
funcUpgradeTips.add(EnderIO.lang.localizeExact(upgrade.unlocName.concat(".name"))); funcUpgradeTips.add(EnderIO.lang.localizeExact(upgrade.unlocName.concat(".name")));
@@ -28,13 +28,13 @@ public class GasSettings extends BaseSettingsPanel {
private static final int ID_COLOR_BUTTON = GuiExternalConnection.nextButtonId(); private static final int ID_COLOR_BUTTON = GuiExternalConnection.nextButtonId();
private final RedstoneModeButton rsB; private RedstoneModeButton rsB;
private final ColorButton colorB; private ColorButton colorB;
private final String autoExtractStr = EnderIO.lang.localize("gui.conduit.gas.autoExtract"); private String autoExtractStr = EnderIO.lang.localize("gui.conduit.gas.autoExtract");
private final IGasConduit conduit; private IGasConduit conduit;
protected GasSettings(final GuiExternalConnection gui, IConduit con) { protected GasSettings(final GuiExternalConnection gui, IConduit con) {
super(IconEIO.WRENCH_OVERLAY_GAS, EnderIO.lang.localize("itemGasConduit.name"), gui, con); super(IconEIO.WRENCH_OVERLAY_GAS, EnderIO.lang.localize("itemGasConduit.name"), gui, con);
@@ -72,7 +72,7 @@ public class GasSettings extends BaseSettingsPanel {
public void actionPerformed(GuiButton guiButton) { public void actionPerformed(GuiButton guiButton) {
super.actionPerformed(guiButton); super.actionPerformed(guiButton);
if (guiButton.id == ID_COLOR_BUTTON) { if (guiButton.id == ID_COLOR_BUTTON) {
conduit.setExtractionSignalColor(gui.getDir(), DyeColor.VALUES[colorB.getColorIndex()]); conduit.setExtractionSignalColor(gui.getDir(), DyeColor.values()[colorB.getColorIndex()]);
PacketHandler.INSTANCE.sendToServer(new PacketExtractMode(conduit, gui.getDir())); PacketHandler.INSTANCE.sendToServer(new PacketExtractMode(conduit, gui.getDir()));
} }
} }
@@ -103,6 +103,8 @@ public class GasSettings extends BaseSettingsPanel {
protected void renderCustomOptions(int top, float par1, int par2, int par3) { protected void renderCustomOptions(int top, float par1, int par2, int par3) {
boolean isInput = isInput(); boolean isInput = isInput();
if (isInput) { if (isInput) {
int x = gui.getGuiLeft() + gap + gui.getFontRenderer().getStringWidth(autoExtractStr) + gap + 2;
int y = customTop;
gui.getFontRenderer().drawString(autoExtractStr, left, top, ColorUtil.getRGB(Color.DARK_GRAY)); gui.getFontRenderer().drawString(autoExtractStr, left, top, ColorUtil.getRGB(Color.DARK_GRAY));
} }
} }
@@ -50,7 +50,7 @@ public class GuiExternalConnection extends GuiContainerBaseEIO {
return id; return id;
} }
private static final Map<Class<? extends IConduit>, Integer> TAB_ORDER = new HashMap<>(); private static final Map<Class<? extends IConduit>, Integer> TAB_ORDER = new HashMap<Class<? extends IConduit>, Integer>();
static { static {
TAB_ORDER.put(IItemConduit.class, 0); TAB_ORDER.put(IItemConduit.class, 0);
@@ -66,11 +66,11 @@ public class GuiExternalConnection extends GuiContainerBaseEIO {
final IConduitBundle bundle; final IConduitBundle bundle;
private final ForgeDirection dir; private final ForgeDirection dir;
private final List<IConduit> conduits = new ArrayList<>(); private final List<IConduit> conduits = new ArrayList<IConduit>();
private final List<ITabPanel> tabs = new ArrayList<>(); private final List<ITabPanel> tabs = new ArrayList<ITabPanel>();
private int activeTab = 0; private int activeTab = 0;
private static final int tabYOffset = 4; private int tabYOffset = 4;
private final ExternalConnectionContainer container; private final ExternalConnectionContainer container;
@@ -86,8 +86,8 @@ public class GuiExternalConnection extends GuiContainerBaseEIO {
container.setInoutSlotsVisible(false, false); container.setInoutSlotsVisible(false, false);
List<IConduit> cons = new ArrayList<>(bundle.getConduits()); List<IConduit> cons = new ArrayList<IConduit>(bundle.getConduits());
Collections.sort(cons, new Comparator<>() { Collections.sort(cons, new Comparator<IConduit>() {
@Override @Override
public int compare(IConduit o1, IConduit o2) { public int compare(IConduit o1, IConduit o2) {
@@ -23,7 +23,6 @@ import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.IConduitBundle; import crazypants.enderio.conduit.IConduitBundle;
import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit; import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit;
import crazypants.enderio.network.PacketHandler; import crazypants.enderio.network.PacketHandler;
import crazypants.util.ForgeDirections;
public class GuiExternalConnectionSelector extends GuiScreen { public class GuiExternalConnectionSelector extends GuiScreen {
@@ -34,7 +33,7 @@ public class GuiExternalConnectionSelector extends GuiScreen {
public GuiExternalConnectionSelector(IConduitBundle cb) { public GuiExternalConnectionSelector(IConduitBundle cb) {
this.cb = cb; this.cb = cb;
cons = new HashSet<>(); cons = new HashSet<ForgeDirection>();
for (IConduit con : cb.getConduits()) { for (IConduit con : cb.getConduits()) {
if (con instanceof IInsulatedRedstoneConduit) { if (con instanceof IInsulatedRedstoneConduit) {
Set<ForgeDirection> conCons = con.getConduitConnections(); Set<ForgeDirection> conCons = con.getConduitConnections();
@@ -52,7 +51,7 @@ public class GuiExternalConnectionSelector extends GuiScreen {
@Override @Override
protected void actionPerformed(GuiButton b) { protected void actionPerformed(GuiButton b) {
ForgeDirection dir = ForgeDirections.DIRECTIONS[b.id]; ForgeDirection dir = ForgeDirection.values()[b.id];
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer; EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
BlockCoord loc = cb.getLocation(); BlockCoord loc = cb.getLocation();
PacketHandler.INSTANCE.sendToServer(new PacketOpenConduitUI(cb.getEntity(), dir)); PacketHandler.INSTANCE.sendToServer(new PacketOpenConduitUI(cb.getEntity(), dir));
@@ -62,7 +62,7 @@ public class LiquidSettings extends BaseSettingsPanel {
private final ILiquidConduit conduit; private final ILiquidConduit conduit;
private AbstractEnderLiquidConduit eConduit; private AbstractEnderLiquidConduit eConduit;
private final boolean isEnder; private boolean isEnder;
private static final int filterIX = 4; private static final int filterIX = 4;
private static final int filterEX = 104; private static final int filterEX = 104;
private static final int filterY = 63; private static final int filterY = 63;
@@ -70,7 +70,7 @@ public class LiquidSettings extends BaseSettingsPanel {
private static final Rectangle extractFilterBounds = new Rectangle(filterEX, filterY, 90, 18); private static final Rectangle extractFilterBounds = new Rectangle(filterEX, filterY, 90, 18);
private GuiToolTip[] filterToolTips; private GuiToolTip[] filterToolTips;
private static final boolean inOutShowIn = true; private boolean inOutShowIn = true;
private IconButton insertWhiteListB; private IconButton insertWhiteListB;
private IconButton extractWhiteListB; private IconButton extractWhiteListB;
@@ -172,7 +172,7 @@ public class LiquidSettings extends BaseSettingsPanel {
public void actionPerformed(GuiButton guiButton) { public void actionPerformed(GuiButton guiButton) {
super.actionPerformed(guiButton); super.actionPerformed(guiButton);
if (guiButton.id == ID_COLOR_BUTTON) { if (guiButton.id == ID_COLOR_BUTTON) {
conduit.setExtractionSignalColor(gui.getDir(), DyeColor.VALUES[colorB.getColorIndex()]); conduit.setExtractionSignalColor(gui.getDir(), DyeColor.values()[colorB.getColorIndex()]);
PacketHandler.INSTANCE.sendToServer(new PacketExtractMode(conduit, gui.getDir())); PacketHandler.INSTANCE.sendToServer(new PacketExtractMode(conduit, gui.getDir()));
} else if (guiButton.id == ID_INSERT_WHITELIST || guiButton.id == ID_EXTRACT_WHITELIST) { } else if (guiButton.id == ID_INSERT_WHITELIST || guiButton.id == ID_EXTRACT_WHITELIST) {
toggleBlacklist(guiButton.id == ID_EXTRACT_WHITELIST); toggleBlacklist(guiButton.id == ID_EXTRACT_WHITELIST);
@@ -180,7 +180,7 @@ public class LiquidSettings extends BaseSettingsPanel {
ColorButton btn = (ColorButton) guiButton; ColorButton btn = (ColorButton) guiButton;
if (isEnder) { if (isEnder) {
DyeColor col = DyeColor.VALUES[btn.getColorIndex()]; DyeColor col = DyeColor.values()[btn.getColorIndex()];
boolean isInput = guiButton.id == ID_EXTRACT_CHANNEL; boolean isInput = guiButton.id == ID_EXTRACT_CHANNEL;
if (isInput) { if (isInput) {
@@ -284,8 +284,6 @@ public class LiquidSettings extends BaseSettingsPanel {
rsB.onGuiInit(); rsB.onGuiInit();
colorB.onGuiInit(); colorB.onGuiInit();
gui.getContainer().setInventorySlotsVisible(true);
if (!isEnder) { if (!isEnder) {
return; return;
} }
@@ -297,6 +295,7 @@ public class LiquidSettings extends BaseSettingsPanel {
roundRobinB.onGuiInit(); roundRobinB.onGuiInit();
roundRobinB.setSelected(eConduit.isRoundRobin(gui.getDir())); roundRobinB.setSelected(eConduit.isRoundRobin(gui.getDir()));
gui.getContainer().setInventorySlotsVisible(true);
if (isFilterVisible()) { if (isFilterVisible()) {
addFilterTooltips(); addFilterTooltips();
@@ -18,9 +18,9 @@ import crazypants.enderio.network.PacketHandler;
public class OCSettings extends BaseSettingsPanel { public class OCSettings extends BaseSettingsPanel {
private static final int ID_COLOR_BUTTON = GuiExternalConnection.nextButtonId(); private static final int ID_COLOR_BUTTON = GuiExternalConnection.nextButtonId();
private final ColorButton cb; private ColorButton cb;
private final String signalColorStr = EnderIO.lang.localize("gui.conduit.redstone.color"); private String signalColorStr = EnderIO.lang.localize("gui.conduit.redstone.color");
private final IOCConduit occon; private final IOCConduit occon;
public OCSettings(GuiExternalConnection gui, IConduit con) { public OCSettings(GuiExternalConnection gui, IConduit con) {
@@ -42,7 +42,7 @@ public class OCSettings extends BaseSettingsPanel {
public void actionPerformed(GuiButton guiButton) { public void actionPerformed(GuiButton guiButton) {
super.actionPerformed(guiButton); super.actionPerformed(guiButton);
if (guiButton.id == ID_COLOR_BUTTON && cb != null) { if (guiButton.id == ID_COLOR_BUTTON && cb != null) {
occon.setSignalColor(gui.getDir(), DyeColor.VALUES[cb.getColorIndex()]); occon.setSignalColor(gui.getDir(), DyeColor.values()[cb.getColorIndex()]);
PacketHandler.INSTANCE.sendToServer(new PacketOCConduitSignalColor(occon, gui.getDir())); PacketHandler.INSTANCE.sendToServer(new PacketOCConduitSignalColor(occon, gui.getDir()));
} }
} }
@@ -11,7 +11,6 @@ import crazypants.enderio.conduit.liquid.AbstractEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.ILiquidConduit; import crazypants.enderio.conduit.liquid.ILiquidConduit;
import crazypants.enderio.conduit.packet.AbstractConduitPacket; import crazypants.enderio.conduit.packet.AbstractConduitPacket;
import crazypants.enderio.conduit.packet.ConTypeEnum; import crazypants.enderio.conduit.packet.ConTypeEnum;
import crazypants.util.ForgeDirections;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public class PacketFluidChannel extends AbstractConduitPacket<ILiquidConduit> public class PacketFluidChannel extends AbstractConduitPacket<ILiquidConduit>
@@ -43,9 +42,9 @@ public class PacketFluidChannel extends AbstractConduitPacket<ILiquidConduit>
@Override @Override
public void fromBytes(ByteBuf buf) { public void fromBytes(ByteBuf buf) {
super.fromBytes(buf); super.fromBytes(buf);
dir = ForgeDirections.DIRECTIONS[buf.readShort()]; dir = ForgeDirection.values()[buf.readShort()];
isInput = buf.readBoolean(); isInput = buf.readBoolean();
channel = DyeColor.VALUES[buf.readShort()]; channel = DyeColor.values()[buf.readShort()];
} }
@Override @Override
@@ -12,7 +12,6 @@ import crazypants.enderio.conduit.liquid.FluidFilter;
import crazypants.enderio.conduit.liquid.ILiquidConduit; import crazypants.enderio.conduit.liquid.ILiquidConduit;
import crazypants.enderio.conduit.packet.AbstractConduitPacket; import crazypants.enderio.conduit.packet.AbstractConduitPacket;
import crazypants.enderio.conduit.packet.ConTypeEnum; import crazypants.enderio.conduit.packet.ConTypeEnum;
import crazypants.util.ForgeDirections;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public class PacketFluidFilter extends AbstractConduitPacket<ILiquidConduit> public class PacketFluidFilter extends AbstractConduitPacket<ILiquidConduit>
@@ -45,7 +44,7 @@ public class PacketFluidFilter extends AbstractConduitPacket<ILiquidConduit>
@Override @Override
public void fromBytes(ByteBuf buf) { public void fromBytes(ByteBuf buf) {
super.fromBytes(buf); super.fromBytes(buf);
dir = ForgeDirections.DIRECTIONS[buf.readShort()]; dir = ForgeDirection.values()[buf.readShort()];
isInput = buf.readBoolean(); isInput = buf.readBoolean();
NBTTagCompound tag = ByteBufUtils.readTag(buf); NBTTagCompound tag = ByteBufUtils.readTag(buf);
filter = new FluidFilter(); filter = new FluidFilter();
@@ -11,7 +11,6 @@ import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import crazypants.enderio.EnderIO; import crazypants.enderio.EnderIO;
import crazypants.enderio.GuiHandler; import crazypants.enderio.GuiHandler;
import crazypants.util.ForgeDirections;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public class PacketOpenConduitUI extends MessageTileEntity<TileEntity> public class PacketOpenConduitUI extends MessageTileEntity<TileEntity>
@@ -35,7 +34,7 @@ public class PacketOpenConduitUI extends MessageTileEntity<TileEntity>
@Override @Override
public void fromBytes(ByteBuf buf) { public void fromBytes(ByteBuf buf) {
super.fromBytes(buf); super.fromBytes(buf);
dir = ForgeDirections.DIRECTIONS[buf.readShort()]; dir = ForgeDirection.values()[buf.readShort()];
} }
public IMessage onMessage(PacketOpenConduitUI message, MessageContext ctx) { public IMessage onMessage(PacketOpenConduitUI message, MessageContext ctx) {
@@ -21,9 +21,9 @@ public class PowerSettings extends BaseSettingsPanel {
private static final int ID_COLOR_BUTTON = GuiExternalConnection.nextButtonId(); private static final int ID_COLOR_BUTTON = GuiExternalConnection.nextButtonId();
private final IPowerConduit conduit; private IPowerConduit conduit;
private final RedstoneModeButton rsB; private RedstoneModeButton rsB;
private final ColorButton colorB; private ColorButton colorB;
protected PowerSettings(final GuiExternalConnection gui, IConduit con) { protected PowerSettings(final GuiExternalConnection gui, IConduit con) {
super(IconEIO.WRENCH_OVERLAY_POWER, EnderIO.lang.localize("itemPowerConduit.name"), gui, con); super(IconEIO.WRENCH_OVERLAY_POWER, EnderIO.lang.localize("itemPowerConduit.name"), gui, con);
@@ -59,7 +59,7 @@ public class PowerSettings extends BaseSettingsPanel {
public void actionPerformed(GuiButton guiButton) { public void actionPerformed(GuiButton guiButton) {
super.actionPerformed(guiButton); super.actionPerformed(guiButton);
if (guiButton.id == ID_COLOR_BUTTON) { if (guiButton.id == ID_COLOR_BUTTON) {
conduit.setExtractionSignalColor(gui.getDir(), DyeColor.VALUES[colorB.getColorIndex()]); conduit.setExtractionSignalColor(gui.getDir(), DyeColor.values()[colorB.getColorIndex()]);
PacketHandler.INSTANCE.sendToServer(new PacketExtractMode(conduit, gui.getDir())); PacketHandler.INSTANCE.sendToServer(new PacketExtractMode(conduit, gui.getDir()));
} }
} }
@@ -25,8 +25,8 @@ public class RedstoneSettings extends BaseSettingsPanel {
private CheckBox strongCB; private CheckBox strongCB;
private final String signalColorStr = EnderIO.lang.localize("gui.conduit.redstone.color"); private String signalColorStr = EnderIO.lang.localize("gui.conduit.redstone.color");
private final String signalStringthStr = EnderIO.lang.localize("gui.conduit.redstone.signalStrengh"); private String signalStringthStr = EnderIO.lang.localize("gui.conduit.redstone.signalStrengh");
private IInsulatedRedstoneConduit insCon; private IInsulatedRedstoneConduit insCon;
private int stongLabelX; private int stongLabelX;
@@ -61,7 +61,7 @@ public class RedstoneSettings extends BaseSettingsPanel {
public void actionPerformed(GuiButton guiButton) { public void actionPerformed(GuiButton guiButton) {
super.actionPerformed(guiButton); super.actionPerformed(guiButton);
if (guiButton.id == ID_COLOR_BUTTON && cb != null) { if (guiButton.id == ID_COLOR_BUTTON && cb != null) {
insCon.setSignalColor(gui.getDir(), DyeColor.VALUES[cb.getColorIndex()]); insCon.setSignalColor(gui.getDir(), DyeColor.values()[cb.getColorIndex()]);
PacketHandler.INSTANCE.sendToServer(new PacketRedstoneConduitSignalColor(insCon, gui.getDir())); PacketHandler.INSTANCE.sendToServer(new PacketRedstoneConduitSignalColor(insCon, gui.getDir()));
} else if (guiButton.id == ID_STRONG_BUTTON && strongCB != null) { } else if (guiButton.id == ID_STRONG_BUTTON && strongCB != null) {
insCon.setOutputStrength(gui.getDir(), strongCB.isSelected()); insCon.setOutputStrength(gui.getDir(), strongCB.isSelected());
@@ -39,11 +39,11 @@ public class BasicItemFilterGui implements IItemFilterGui {
private final IItemFilterContainer filterContainer; private final IItemFilterContainer filterContainer;
private final ItemFilter filter; private final ItemFilter filter;
private final int buttonIdOffset; private int buttonIdOffset;
private final int xOffset; private int xOffset;
private final int yOffset; private int yOffset;
private final boolean isInput; private boolean isInput;
public BasicItemFilterGui(GuiContainerBaseEIO gui, IItemFilterContainer filterContainer, public BasicItemFilterGui(GuiContainerBaseEIO gui, IItemFilterContainer filterContainer,
boolean isStickyModeAvailable, boolean isInput) { boolean isStickyModeAvailable, boolean isInput) {
@@ -107,7 +107,7 @@ public class BasicItemFilterGui implements IItemFilterGui {
useNbtB.setPaintSelectedBorder(false); useNbtB.setPaintSelectedBorder(false);
x += 16; x += 16;
fuzzyB = new CycleButton<>(gui, ID_FUZZY + buttonIdOffset, x, y, FuzzyMode.class); fuzzyB = new CycleButton(gui, ID_FUZZY + buttonIdOffset, x, y, FuzzyMode.class);
} }
public void createFilterSlots() { public void createFilterSlots() {
@@ -39,7 +39,7 @@ public class BigItemFilterGui implements IItemFilterGui {
private final IItemFilterContainer filterContainer; private final IItemFilterContainer filterContainer;
private final ItemFilter filter; private final ItemFilter filter;
private final int buttonIdOffset; private int buttonIdOffset;
private int xOffset; private int xOffset;
private int yOffset; private int yOffset;
@@ -92,7 +92,7 @@ public class BigItemFilterGui implements IItemFilterGui {
useNbtB.setPaintSelectedBorder(false); useNbtB.setPaintSelectedBorder(false);
x += 16; x += 16;
fuzzyB = new CycleButton<>(gui, ID_FUZZY + buttonIdOffset, x, y, FuzzyMode.class); fuzzyB = new CycleButton(gui, ID_FUZZY + buttonIdOffset, x, y, FuzzyMode.class);
x += 16; x += 16;
stickyB = new ToggleButton( stickyB = new ToggleButton(
@@ -38,26 +38,26 @@ public class ExistingItemFilterGui implements IItemFilterGui {
private static final int ID_SHOW = GuiExternalConnection.nextButtonId(); private static final int ID_SHOW = GuiExternalConnection.nextButtonId();
private static final int ID_MERGE = GuiExternalConnection.nextButtonId(); private static final int ID_MERGE = GuiExternalConnection.nextButtonId();
private final IItemConduit itemConduit; private IItemConduit itemConduit;
private final GuiExternalConnection gui; private GuiExternalConnection gui;
private final ToggleButton useMetaB; private ToggleButton useMetaB;
private final ToggleButton useNbtB; private ToggleButton useNbtB;
private final ToggleButton useOreDictB; private ToggleButton useOreDictB;
private final ToggleButton stickyB; private ToggleButton stickyB;
private final IconButton whiteListB; private final IconButton whiteListB;
private final GuiButton snapshotB; private GuiButton snapshotB;
private final GuiButton clearB; private GuiButton clearB;
private final GuiButton showB; private GuiButton showB;
private final GuiButton mergeB; private GuiButton mergeB;
private final SnapshotOverlay snapshotOverlay; private SnapshotOverlay snapshotOverlay;
boolean isInput; boolean isInput;
private int buttonIdOffset = 0; private int buttonIdOffset = 0;
private final ExistingItemFilter filter; private ExistingItemFilter filter;
public ExistingItemFilterGui(GuiExternalConnection gui, IItemConduit itemConduit, boolean isInput) { public ExistingItemFilterGui(GuiExternalConnection gui, IItemConduit itemConduit, boolean isInput) {
this.gui = gui; this.gui = gui;
@@ -9,9 +9,9 @@ import crazypants.enderio.network.PacketHandler;
public class ItemConduitFilterContainer implements IItemFilterContainer { public class ItemConduitFilterContainer implements IItemFilterContainer {
private final IItemConduit itemConduit; private IItemConduit itemConduit;
private final ForgeDirection dir; private ForgeDirection dir;
private final boolean isInput; private boolean isInput;
public ItemConduitFilterContainer(IItemConduit itemConduit, ForgeDirection dir, boolean isInput) { public ItemConduitFilterContainer(IItemConduit itemConduit, ForgeDirection dir, boolean isInput) {
this.itemConduit = itemConduit; this.itemConduit = itemConduit;
@@ -31,7 +31,6 @@ import crazypants.enderio.gui.RedstoneModeButton;
import crazypants.enderio.machine.IRedstoneModeControlable; import crazypants.enderio.machine.IRedstoneModeControlable;
import crazypants.enderio.machine.RedstoneControlMode; import crazypants.enderio.machine.RedstoneControlMode;
import crazypants.enderio.network.PacketHandler; import crazypants.enderio.network.PacketHandler;
import crazypants.util.ColorUtils;
public class ItemSettings extends BaseSettingsPanel { public class ItemSettings extends BaseSettingsPanel {
@@ -44,7 +43,7 @@ public class ItemSettings extends BaseSettingsPanel {
private static final int ID_INSERT_CHANNEL = 23; private static final int ID_INSERT_CHANNEL = 23;
private static final int ID_EXTRACT_CHANNEL = 27; private static final int ID_EXTRACT_CHANNEL = 27;
private final @Nonnull IItemConduit itemConduit; private @Nonnull IItemConduit itemConduit;
private final ToggleButton loopB; private final ToggleButton loopB;
private final ToggleButton roundRobinB; private final ToggleButton roundRobinB;
@@ -55,11 +54,11 @@ public class ItemSettings extends BaseSettingsPanel {
private final RedstoneModeButton rsB; private final RedstoneModeButton rsB;
private final @Nonnull ColorButton colorB; private final @Nonnull ColorButton colorB;
private final ColorButton insertChannelB; private ColorButton insertChannelB;
private final ColorButton extractChannelB; private ColorButton extractChannelB;
private static final int priLeft = 46; private int priLeft = 46;
private static final int priWidth = 32; private int priWidth = 32;
private IItemFilterGui insertFilterGui; private IItemFilterGui insertFilterGui;
private IItemFilterGui extractFilterGui; private IItemFilterGui extractFilterGui;
@@ -175,7 +174,6 @@ public class ItemSettings extends BaseSettingsPanel {
private void updateButtons() { private void updateButtons() {
rsB.onGuiInit(); rsB.onGuiInit();
rsB.setMode(itemConduit.getExtractionRedstoneMode(gui.getDir())); rsB.setMode(itemConduit.getExtractionRedstoneMode(gui.getDir()));
colorB.onGuiInit();
loopB.onGuiInit(); loopB.onGuiInit();
loopB.setSelected(itemConduit.isSelfFeedEnabled(gui.getDir())); loopB.setSelected(itemConduit.isSelfFeedEnabled(gui.getDir()));
@@ -241,7 +239,7 @@ public class ItemSettings extends BaseSettingsPanel {
String priority = EnderIO.lang.localize("gui.conduit.item.priority"); String priority = EnderIO.lang.localize("gui.conduit.item.priority");
fr.drawString(priority, left + 12, top1 + 25, ColorUtil.getRGB(Color.black)); fr.drawString(priority, left + 12, top1 + 25, ColorUtil.getRGB(Color.black));
fr.drawString(str, left + priLeft + priWidth - sw - gap, top1 + 25, ColorUtils.priorityString.getColor()); fr.drawString(str, left + priLeft + priWidth - sw - gap, top1 + 25, ColorUtil.getRGB(Color.black));
if (insertFilterGui != null) insertFilterGui.renderCustomOptions(top1, par1, par2, par3); if (insertFilterGui != null) insertFilterGui.renderCustomOptions(top1, par1, par2, par3);
if (extractFilterGui != null) extractFilterGui.renderCustomOptions(top1, par1, par2, par3); if (extractFilterGui != null) extractFilterGui.renderCustomOptions(top1, par1, par2, par3);
@@ -35,11 +35,11 @@ public class LimitedItemFilterGui implements IItemFilterGui {
private final IItemFilterContainer filterContainer; private final IItemFilterContainer filterContainer;
private final ItemFilter filter; private final ItemFilter filter;
private final int buttonIdOffset; private int buttonIdOffset;
private final int xOffset; private int xOffset;
private final int yOffset; private int yOffset;
final boolean isStickyModeAvailable; final boolean isStickyModeAvailable;
private final boolean isInput; private boolean isInput;
public LimitedItemFilterGui(GuiContainerBaseEIO gui, IItemFilterContainer filterContainer, public LimitedItemFilterGui(GuiContainerBaseEIO gui, IItemFilterContainer filterContainer,
boolean isStickyModeAvailable, boolean isInput) { boolean isStickyModeAvailable, boolean isInput) {
@@ -101,7 +101,7 @@ public class LimitedItemFilterGui implements IItemFilterGui {
useNbtB.setPaintSelectedBorder(false); useNbtB.setPaintSelectedBorder(false);
x += 16; x += 16;
fuzzyB = new CycleButton<>(gui, ID_FUZZY + buttonIdOffset, x, y, FuzzyMode.class); fuzzyB = new CycleButton(gui, ID_FUZZY + buttonIdOffset, x, y, FuzzyMode.class);
} }
public void createFilterSlots() { public void createFilterSlots() {
@@ -37,6 +37,7 @@ public class ModItemFilterGui implements IItemFilterGui {
private final IconButton whiteListB; private final IconButton whiteListB;
private final int inputOffsetX;
private final int tfWidth; private final int tfWidth;
private final int tfTextureX; private final int tfTextureX;
private final int tfTextureY; private final int tfTextureY;
@@ -55,12 +56,13 @@ public class ModItemFilterGui implements IItemFilterGui {
} else { } else {
filter = (ModItemFilter) itemConduit.getOutputFilter(gui.getDir()); filter = (ModItemFilter) itemConduit.getOutputFilter(gui.getDir());
} }
inputOffsetX = x;
tfWidth = 52; tfWidth = 52;
tfTextureX = 120; tfTextureX = 120;
tfTextureY = 214; tfTextureY = 214;
inputBounds = new Rectangle[] { new Rectangle(x, y, 16, 16), new Rectangle(x, y + 18, 16, 16), inputBounds = new Rectangle[] { new Rectangle(inputOffsetX, y, 16, 16),
new Rectangle(x, y + 36, 16, 16) }; new Rectangle(inputOffsetX, y + 18, 16, 16), new Rectangle(inputOffsetX, y + 36, 16, 16) };
deleteButs = new IconButton[inputBounds.length]; deleteButs = new IconButton[inputBounds.length];
for (int i = 0; i < deleteButs.length; i++) { for (int i = 0; i < deleteButs.length; i++) {
@@ -14,25 +14,17 @@ import crazypants.enderio.conduit.item.NetworkedInventory;
import crazypants.enderio.conduit.item.filter.ExistingItemFilter; import crazypants.enderio.conduit.item.filter.ExistingItemFilter;
import crazypants.enderio.conduit.packet.AbstractConduitPacket; import crazypants.enderio.conduit.packet.AbstractConduitPacket;
import crazypants.enderio.conduit.packet.ConTypeEnum; import crazypants.enderio.conduit.packet.ConTypeEnum;
import crazypants.util.ForgeDirections;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public class PacketExistingItemFilterSnapshot extends AbstractConduitPacket<IItemConduit> public class PacketExistingItemFilterSnapshot extends AbstractConduitPacket<IItemConduit>
implements IMessageHandler<PacketExistingItemFilterSnapshot, IMessage> { implements IMessageHandler<PacketExistingItemFilterSnapshot, IMessage> {
public enum Opcode { public static enum Opcode {
CLEAR, CLEAR,
SET, SET,
MERGE, MERGE,
SET_BLACK, SET_BLACK,
UNSET_BLACK; UNSET_BLACK
private static final Opcode[] VALUES = values();
public static Opcode fromOrdinal(int ordinal) {
return VALUES[ordinal];
}
} }
private ForgeDirection dir; private ForgeDirection dir;
@@ -51,9 +43,9 @@ public class PacketExistingItemFilterSnapshot extends AbstractConduitPacket<IIte
@Override @Override
public void fromBytes(ByteBuf buf) { public void fromBytes(ByteBuf buf) {
super.fromBytes(buf); super.fromBytes(buf);
dir = ForgeDirections.DIRECTIONS[buf.readShort()]; dir = ForgeDirection.values()[buf.readShort()];
isInput = buf.readBoolean(); isInput = buf.readBoolean();
opcode = Opcode.fromOrdinal(buf.readByte() & 255); opcode = Opcode.values()[buf.readByte() & 255];
} }
@Override @Override
@@ -10,7 +10,6 @@ import crazypants.enderio.conduit.item.IItemConduit;
import crazypants.enderio.conduit.item.filter.ModItemFilter; import crazypants.enderio.conduit.item.filter.ModItemFilter;
import crazypants.enderio.conduit.packet.AbstractConduitPacket; import crazypants.enderio.conduit.packet.AbstractConduitPacket;
import crazypants.enderio.conduit.packet.ConTypeEnum; import crazypants.enderio.conduit.packet.ConTypeEnum;
import crazypants.util.ForgeDirections;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public class PacketModItemFilter extends AbstractConduitPacket<IItemConduit> public class PacketModItemFilter extends AbstractConduitPacket<IItemConduit>
@@ -34,7 +33,7 @@ public class PacketModItemFilter extends AbstractConduitPacket<IItemConduit>
@Override @Override
public void fromBytes(ByteBuf buf) { public void fromBytes(ByteBuf buf) {
super.fromBytes(buf); super.fromBytes(buf);
dir = ForgeDirections.DIRECTIONS[buf.readShort()]; dir = ForgeDirection.values()[buf.readShort()];
isInput = buf.readBoolean(); isInput = buf.readBoolean();
index = buf.readInt(); index = buf.readInt();
boolean isNull = buf.readBoolean(); boolean isNull = buf.readBoolean();
@@ -60,7 +60,7 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
public static final String ICON_KEY_ENDER = "enderio:ender_still"; public static final String ICON_KEY_ENDER = "enderio:ender_still";
static final Map<String, IIcon> ICONS = new HashMap<>(); static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
public static void initIcons() { public static void initIcons() {
IconUtil.addIconProvider(new IconUtil.IIconProvider() { IconUtil.addIconProvider(new IconUtil.IIconProvider() {
@@ -87,24 +87,37 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
ItemConduitNetwork network; ItemConduitNetwork network;
protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes = new EnumMap<>(ForgeDirection.class); protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes = new EnumMap<ForgeDirection, RedstoneControlMode>(
protected final EnumMap<ForgeDirection, DyeColor> extractionColors = new EnumMap<>(ForgeDirection.class); ForgeDirection.class);
protected final EnumMap<ForgeDirection, DyeColor> extractionColors = new EnumMap<ForgeDirection, DyeColor>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, IItemFilter> outputFilters = new EnumMap<>(ForgeDirection.class); protected final EnumMap<ForgeDirection, IItemFilter> outputFilters = new EnumMap<ForgeDirection, IItemFilter>(
protected final EnumMap<ForgeDirection, IItemFilter> inputFilters = new EnumMap<>(ForgeDirection.class); ForgeDirection.class);
protected final EnumMap<ForgeDirection, ItemStack> outputFilterUpgrades = new EnumMap<>(ForgeDirection.class); protected final EnumMap<ForgeDirection, IItemFilter> inputFilters = new EnumMap<ForgeDirection, IItemFilter>(
protected final EnumMap<ForgeDirection, ItemStack> inputFilterUpgrades = new EnumMap<>(ForgeDirection.class); ForgeDirection.class);
protected final EnumMap<ForgeDirection, ItemStack> speedUpgrades = new EnumMap<>(ForgeDirection.class); protected final EnumMap<ForgeDirection, ItemStack> outputFilterUpgrades = new EnumMap<ForgeDirection, ItemStack>(
protected final EnumMap<ForgeDirection, ItemStack> functionUpgrades = new EnumMap<>(ForgeDirection.class); ForgeDirection.class);
protected final EnumMap<ForgeDirection, ItemStack> inputFilterUpgrades = new EnumMap<ForgeDirection, ItemStack>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, ItemStack> speedUpgrades = new EnumMap<ForgeDirection, ItemStack>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, ItemStack> functionUpgrades = new EnumMap<ForgeDirection, ItemStack>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, Boolean> selfFeed = new EnumMap<>(ForgeDirection.class); protected final EnumMap<ForgeDirection, Boolean> selfFeed = new EnumMap<ForgeDirection, Boolean>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, Boolean> roundRobin = new EnumMap<>(ForgeDirection.class); protected final EnumMap<ForgeDirection, Boolean> roundRobin = new EnumMap<ForgeDirection, Boolean>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, Integer> priority = new EnumMap<>(ForgeDirection.class); protected final EnumMap<ForgeDirection, Integer> priority = new EnumMap<ForgeDirection, Integer>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, DyeColor> outputColors = new EnumMap<>(ForgeDirection.class); protected final EnumMap<ForgeDirection, DyeColor> outputColors = new EnumMap<ForgeDirection, DyeColor>(
protected final EnumMap<ForgeDirection, DyeColor> inputColors = new EnumMap<>(ForgeDirection.class); ForgeDirection.class);
protected final EnumMap<ForgeDirection, DyeColor> inputColors = new EnumMap<ForgeDirection, DyeColor>(
ForgeDirection.class);
private int metaData; private int metaData;
@@ -133,7 +146,7 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
metaData = 0; metaData = 0;
} }
Map<ForgeDirection, ItemStack> converted = new HashMap<>(); Map<ForgeDirection, ItemStack> converted = new HashMap<ForgeDirection, ItemStack>();
convertToItemUpgrades(filterMeta, converted, inputFilters); convertToItemUpgrades(filterMeta, converted, inputFilters);
for (Entry<ForgeDirection, ItemStack> entry : converted.entrySet()) { for (Entry<ForgeDirection, ItemStack> entry : converted.entrySet()) {
@@ -151,10 +164,10 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
@Override @Override
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) { protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
setExtractionSignalColor(dir, DyeColor.VALUES[dataRoot.getShort("extractionSignalColor")]); setExtractionSignalColor(dir, DyeColor.values()[dataRoot.getShort("extractionSignalColor")]);
setExtractionRedstoneMode(RedstoneControlMode.VALUES[dataRoot.getShort("extractionRedstoneMode")], dir); setExtractionRedstoneMode(RedstoneControlMode.values()[dataRoot.getShort("extractionRedstoneMode")], dir);
setInputColor(dir, DyeColor.VALUES[dataRoot.getShort("inputColor")]); setInputColor(dir, DyeColor.values()[dataRoot.getShort("inputColor")]);
setOutputColor(dir, DyeColor.VALUES[dataRoot.getShort("outputColor")]); setOutputColor(dir, DyeColor.values()[dataRoot.getShort("outputColor")]);
setSelfFeedEnabled(dir, dataRoot.getBoolean("selfFeed")); setSelfFeedEnabled(dir, dataRoot.getBoolean("selfFeed"));
setRoundRobinEnabled(dir, dataRoot.getBoolean("roundRobin")); setRoundRobinEnabled(dir, dataRoot.getBoolean("roundRobin"));
setOutputPriority(dir, dataRoot.getInteger("outputPriority")); setOutputPriority(dir, dataRoot.getInteger("outputPriority"));
@@ -185,7 +198,7 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
@Override @Override
public List<ItemStack> getDrops() { public List<ItemStack> getDrops() {
List<ItemStack> res = new ArrayList<>(); List<ItemStack> res = new ArrayList<ItemStack>();
res.add(createItem()); res.add(createItem());
for (ItemStack stack : speedUpgrades.values()) { for (ItemStack stack : speedUpgrades.values()) {
res.add(stack); res.add(stack);
@@ -837,15 +850,15 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
key = "extRM." + dir.name(); key = "extRM." + dir.name();
if (nbtRoot.hasKey(key)) { if (nbtRoot.hasKey(key)) {
short ord = nbtRoot.getShort(key); short ord = nbtRoot.getShort(key);
if (ord >= 0 && ord < RedstoneControlMode.VALUES.length) { if (ord >= 0 && ord < RedstoneControlMode.values().length) {
extractionModes.put(dir, RedstoneControlMode.VALUES[ord]); extractionModes.put(dir, RedstoneControlMode.values()[ord]);
} }
} }
key = "extSC." + dir.name(); key = "extSC." + dir.name();
if (nbtRoot.hasKey(key)) { if (nbtRoot.hasKey(key)) {
short ord = nbtRoot.getShort(key); short ord = nbtRoot.getShort(key);
if (ord >= 0 && ord < DyeColor.VALUES.length) { if (ord >= 0 && ord < DyeColor.values().length) {
extractionColors.put(dir, DyeColor.VALUES[ord]); extractionColors.put(dir, DyeColor.values()[ord]);
} }
} }
key = "selfFeed." + dir.name(); key = "selfFeed." + dir.name();
@@ -869,16 +882,16 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
key = "inSC." + dir.name(); key = "inSC." + dir.name();
if (nbtRoot.hasKey(key)) { if (nbtRoot.hasKey(key)) {
short ord = nbtRoot.getShort(key); short ord = nbtRoot.getShort(key);
if (ord >= 0 && ord < DyeColor.VALUES.length) { if (ord >= 0 && ord < DyeColor.values().length) {
inputColors.put(dir, DyeColor.VALUES[ord]); inputColors.put(dir, DyeColor.values()[ord]);
} }
} }
key = "outSC." + dir.name(); key = "outSC." + dir.name();
if (nbtRoot.hasKey(key)) { if (nbtRoot.hasKey(key)) {
short ord = nbtRoot.getShort(key); short ord = nbtRoot.getShort(key);
if (ord >= 0 && ord < DyeColor.VALUES.length) { if (ord >= 0 && ord < DyeColor.values().length) {
outputColors.put(dir, DyeColor.VALUES[ord]); outputColors.put(dir, DyeColor.values()[ord]);
} }
} }
} }
@@ -8,13 +8,10 @@ import java.util.Map;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.IChatComponent;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import com.enderio.core.common.util.BlockCoord; import com.enderio.core.common.util.BlockCoord;
import crazypants.enderio.EnderIO;
import crazypants.enderio.conduit.AbstractConduitNetwork; import crazypants.enderio.conduit.AbstractConduitNetwork;
import crazypants.enderio.conduit.item.NetworkedInventory.Target; import crazypants.enderio.conduit.item.NetworkedInventory.Target;
import crazypants.enderio.conduit.item.filter.IItemFilter; import crazypants.enderio.conduit.item.filter.IItemFilter;
@@ -22,10 +19,10 @@ import crazypants.enderio.machine.invpanel.server.InventoryDatabaseServer;
public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IItemConduit> { public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IItemConduit> {
final List<NetworkedInventory> inventories = new ArrayList<>(); final List<NetworkedInventory> inventories = new ArrayList<NetworkedInventory>();
private final Map<BlockCoord, List<NetworkedInventory>> invMap = new HashMap<>(); private final Map<BlockCoord, List<NetworkedInventory>> invMap = new HashMap<BlockCoord, List<NetworkedInventory>>();
final Map<BlockCoord, IItemConduit> conMap = new HashMap<>(); final Map<BlockCoord, IItemConduit> conMap = new HashMap<BlockCoord, IItemConduit>();
private boolean requiresSort = true; private boolean requiresSort = true;
@@ -80,7 +77,7 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
} }
public List<NetworkedInventory> getInventoryPanelSources() { public List<NetworkedInventory> getInventoryPanelSources() {
ArrayList<NetworkedInventory> res = new ArrayList<>(); ArrayList<NetworkedInventory> res = new ArrayList<NetworkedInventory>();
for (NetworkedInventory inv : inventories) { for (NetworkedInventory inv : inventories) {
if (inv.con.hasInventoryPanelUpgrade(inv.conDir)) { if (inv.con.hasInventoryPanelUpgrade(inv.conDir)) {
res.add(inv); res.add(inv);
@@ -92,7 +89,7 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
private List<NetworkedInventory> getOrCreate(BlockCoord bc) { private List<NetworkedInventory> getOrCreate(BlockCoord bc) {
List<NetworkedInventory> res = invMap.get(bc); List<NetworkedInventory> res = invMap.get(bc);
if (res == null) { if (res == null) {
res = new ArrayList<>(); res = new ArrayList<NetworkedInventory>();
invMap.put(bc, res); invMap.put(bc, res);
} }
return res; return res;
@@ -179,8 +176,8 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
} }
} }
public List<IChatComponent> getTargetsForExtraction(BlockCoord extractFrom, IItemConduit con, ItemStack input) { public List<String> getTargetsForExtraction(BlockCoord extractFrom, IItemConduit con, ItemStack input) {
List<IChatComponent> result = new ArrayList<>(); List<String> result = new ArrayList<String>();
List<NetworkedInventory> invs = getOrCreate(extractFrom); List<NetworkedInventory> invs = getOrCreate(extractFrom);
for (NetworkedInventory source : invs) { for (NetworkedInventory source : invs) {
@@ -190,12 +187,12 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
for (Target t : source.sendPriority) { for (Target t : source.sendPriority) {
IItemFilter f = t.inv.con.getOutputFilter(t.inv.conDir); IItemFilter f = t.inv.con.getOutputFilter(t.inv.conDir);
if (input == null || f == null || f.doesItemPassFilter(t.inv, input)) { if (input == null || f == null || f.doesItemPassFilter(t.inv, input)) {
result.add( String s = t.inv.getLocalizedInventoryName() + " "
t.inv.getInventoryNameComponent() + t.inv.location.chatString()
.appendText(" " + t.inv.location.chatString() + " ").appendSibling( + " Distance ["
new ChatComponentTranslation( + t.distance
EnderIO.lang.addPrefix("gui.mjReader.distance"), + "] ";
t.distance))); result.add(s);
} }
} }
} }
@@ -205,13 +202,13 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
return result; return result;
} }
public List<IChatComponent> getInputSourcesFor(IItemConduit con, ForgeDirection dir, ItemStack input) { public List<String> getInputSourcesFor(IItemConduit con, ForgeDirection dir, ItemStack input) {
List<IChatComponent> result = new ArrayList<>(); List<String> result = new ArrayList<String>();
for (NetworkedInventory inv : inventories) { for (NetworkedInventory inv : inventories) {
if (inv.hasTarget(con, dir)) { if (inv.hasTarget(con, dir)) {
IItemFilter f = inv.con.getInputFilter(inv.conDir); IItemFilter f = inv.con.getInputFilter(inv.conDir);
if (input == null || f == null || f.doesItemPassFilter(inv, input)) { if (input == null || f == null || f.doesItemPassFilter(inv, input)) {
result.add(inv.getInventoryNameComponent().appendText(" " + inv.location.chatString())); result.add(inv.getLocalizedInventoryName() + " " + inv.location.chatString());
} }
} }
} }
@@ -64,8 +64,9 @@ public class ItemExtractSpeedUpgrade extends Item implements IResourceTooltipPro
} }
@Override @Override
@SuppressWarnings({ "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List<ItemStack> par3List) { public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int j = 0; j < UPGRADES.length; ++j) { for (int j = 0; j < UPGRADES.length; ++j) {
par3List.add(new ItemStack(par1, 1, j)); par3List.add(new ItemStack(par1, 1, j));
} }
@@ -64,8 +64,9 @@ public class ItemFunctionUpgrade extends Item implements IResourceTooltipProvide
} }
@Override @Override
@SuppressWarnings({ "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List<ItemStack> par3List) { public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int j = 0; j < UPGRADES.length; ++j) { for (int j = 0; j < UPGRADES.length; ++j) {
par3List.add(new ItemStack(par1, 1, j)); par3List.add(new ItemStack(par1, 1, j));
} }
@@ -14,7 +14,7 @@ public class ItemItemConduit extends AbstractItemConduit {
// new ItemConduitSubtype(ModObject.itemItemConduit.name(), "enderio:itemItemConduit"), // new ItemConduitSubtype(ModObject.itemItemConduit.name(), "enderio:itemItemConduit"),
// new ItemConduitSubtype(ModObject.itemItemConduit.name() + "Empowered", "enderio:itemItemConduitAdvanced") // new ItemConduitSubtype(ModObject.itemItemConduit.name() + "Empowered", "enderio:itemItemConduitAdvanced")
// }; // };
private static final ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] { private static ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
new ItemConduitSubtype(ModObject.itemItemConduit.name(), "enderio:itemItemConduit") }; new ItemConduitSubtype(ModObject.itemItemConduit.name(), "enderio:itemItemConduit") };
public static ItemItemConduit create() { public static ItemItemConduit create() {
@@ -6,15 +6,11 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.annotation.Nullable;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText; import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
@@ -29,7 +25,6 @@ import crazypants.enderio.conduit.item.filter.IItemFilter;
import crazypants.enderio.conduit.item.filter.ItemFilterLimited; import crazypants.enderio.conduit.item.filter.ItemFilterLimited;
import crazypants.enderio.config.Config; import crazypants.enderio.config.Config;
import crazypants.enderio.machine.invpanel.TileInventoryPanel; import crazypants.enderio.machine.invpanel.TileInventoryPanel;
import crazypants.util.ForgeDirections;
public class NetworkedInventory { public class NetworkedInventory {
@@ -39,15 +34,15 @@ public class NetworkedInventory {
BlockCoord location; BlockCoord location;
int inventorySide; int inventorySide;
List<Target> sendPriority = new ArrayList<>(); List<Target> sendPriority = new ArrayList<Target>();
RoundRobinIterator<Target> rrIter = new RoundRobinIterator<>(sendPriority); RoundRobinIterator<Target> rrIter = new RoundRobinIterator<Target>(sendPriority);
private int extractFromSlot = -1; private int extractFromSlot = -1;
int tickDeficit; int tickDeficit;
private TileEntity connectedTileEntity; // work around for a vanilla chest changing into a double chest without doing unneeded checks all the time
boolean recheckInv = false;
// Hack for TiC crafting station not working correctly when setting output slot to null // Hack for TiC crafting station not working correctly when setting output slot to null
boolean ticHack = false; boolean ticHack = false;
@@ -66,13 +61,19 @@ public class NetworkedInventory {
this.location = location; this.location = location;
world = con.getBundle().getWorld(); world = con.getBundle().getWorld();
TileEntity te = world.getTileEntity(location.x, location.y, location.z);
if (te.getClass().getName().equals("tconstruct.tools.logic.CraftingStationLogic")) {
ticHack = true;
} else if (te.getClass().getName().contains("cpw.mods.ironchest")) {
recheckInv = true;
} else if (te instanceof TileEntityChest) {
recheckInv = true;
} else if (te instanceof TileInventoryPanel) {
inventoryPanel = true;
}
updateInventory(); updateInventory();
} }
public boolean isInvalid() {
return connectedTileEntity == null || connectedTileEntity.isInvalid();
}
public boolean hasTarget(IItemConduit conduit, ForgeDirection dir) { public boolean hasTarget(IItemConduit conduit, ForgeDirection dir) {
for (Target t : sendPriority) { for (Target t : sendPriority) {
if (t.inv.con == conduit && t.inv.conDir == dir) { if (t.inv.con == conduit && t.inv.conDir == dir) {
@@ -109,13 +110,6 @@ public class NetworkedInventory {
} }
public void onTick() { public void onTick() {
if (isInvalid()) {
updateInventory();
if (isInvalid()) {
return;
}
}
if (tickDeficit > 0 || !canExtract() || !con.isExtractionRedstoneConditionMet(conDir)) { if (tickDeficit > 0 || !canExtract() || !con.isExtractionRedstoneConditionMet(conDir)) {
// do nothing // do nothing
} else { } else {
@@ -150,6 +144,11 @@ public class NetworkedInventory {
} }
private boolean transferItems() { private boolean transferItems() {
if (recheckInv) {
updateInventory();
}
int[] slotIndices = getInventory().getAccessibleSlotsFromSide(inventorySide); int[] slotIndices = getInventory().getAccessibleSlotsFromSide(inventorySide);
if (slotIndices == null) { if (slotIndices == null) {
return false; return false;
@@ -258,6 +257,9 @@ public class NetworkedInventory {
matchedStickyInput = of != null && of.isValid() && of.doesItemPassFilter(this, toExtract); matchedStickyInput = of != null && of.isValid() && of.doesItemPassFilter(this, toExtract);
} }
if (target.stickyInput || !matchedStickyInput) { if (target.stickyInput || !matchedStickyInput) {
if (target.inv.recheckInv) {
target.inv.updateInventory();
}
int inserted = target.inv.insertItem(toExtract); int inserted = target.inv.insertItem(toExtract);
if (inserted > 0) { if (inserted > 0) {
toExtract.stackSize -= inserted; toExtract.stackSize -= inserted;
@@ -279,38 +281,15 @@ public class NetworkedInventory {
} }
public final void updateInventory() { public final void updateInventory() {
TileEntity newTe = world.getTileEntity(location.x, location.y, location.z); TileEntity te = world.getTileEntity(location.x, location.y, location.z);
if (newTe != connectedTileEntity) { if (te instanceof ISidedInventory) {
connectedTileEntity = newTe; inv = (ISidedInventory) te;
ticHack = false; } else if (te instanceof IInventory) {
inventoryPanel = false; inv = new InventoryWrapper((IInventory) te);
if (connectedTileEntity != null) {
if (connectedTileEntity.getClass().getName().equals("tconstruct.tools.logic.CraftingStationLogic")) {
ticHack = true;
} else if (connectedTileEntity instanceof TileInventoryPanel) {
inventoryPanel = true;
}
}
network.routesChanged();
}
if (connectedTileEntity instanceof ISidedInventory) {
inv = (ISidedInventory) connectedTileEntity;
} else if (connectedTileEntity instanceof IInventory) {
inv = new InventoryWrapper((IInventory) connectedTileEntity);
} else {
inv = null;
} }
} }
private int insertItem(ItemStack item) { private int insertItem(ItemStack item) {
if (isInvalid()) {
updateInventory();
if (isInvalid()) {
return 0;
}
}
if (!canInsert() || item == null) { if (!canInsert() || item == null) {
return 0; return 0;
} }
@@ -333,7 +312,7 @@ public class NetworkedInventory {
return 0; return 0;
} }
} }
return ItemUtil.doInsertItem(getInventory(), item, ForgeDirections.DIRECTIONS[inventorySide]); return ItemUtil.doInsertItem(getInventory(), item, ForgeDirection.values()[inventorySide]);
} }
void updateInsertOrder() { void updateInsertOrder() {
@@ -341,7 +320,7 @@ public class NetworkedInventory {
if (!canExtract()) { if (!canExtract()) {
return; return;
} }
List<Target> result = new ArrayList<>(); List<Target> result = new ArrayList<NetworkedInventory.Target>();
for (NetworkedInventory other : network.inventories) { for (NetworkedInventory other : network.inventories) {
if ((con.isSelfFeedEnabled(conDir) || (other != this)) && other.canInsert() if ((con.isSelfFeedEnabled(conDir) || (other != this)) && other.canInsert()
@@ -359,8 +338,8 @@ public class NetworkedInventory {
Collections.sort(sendPriority); Collections.sort(sendPriority);
} else { } else {
if (!result.isEmpty()) { if (!result.isEmpty()) {
Map<BlockCoord, Integer> visited = new HashMap<>(); Map<BlockCoord, Integer> visited = new HashMap<BlockCoord, Integer>();
List<BlockCoord> steps = new ArrayList<>(); List<BlockCoord> steps = new ArrayList<BlockCoord>();
steps.add(con.getLocation()); steps.add(con.getLocation());
calculateDistances(result, visited, steps, 0); calculateDistances(result, visited, steps, 0);
@@ -377,7 +356,7 @@ public class NetworkedInventory {
return; return;
} }
ArrayList<BlockCoord> nextSteps = new ArrayList<>(); ArrayList<BlockCoord> nextSteps = new ArrayList<BlockCoord>();
for (BlockCoord bc : steps) { for (BlockCoord bc : steps) {
IItemConduit con = network.conMap.get(bc); IItemConduit con = network.conMap.get(bc);
if (con != null) { if (con != null) {
@@ -430,8 +409,8 @@ public class NetworkedInventory {
return inv; return inv;
} }
public @Nullable ISidedInventory getInventoryRecheck() { public ISidedInventory getInventoryRecheck() {
if (isInvalid()) { if (recheckInv) {
updateInventory(); updateInventory();
} }
return inv; return inv;
@@ -445,10 +424,6 @@ public class NetworkedInventory {
this.inventorySide = inventorySide; this.inventorySide = inventorySide;
} }
/**
* @deprecated Translates on the server. Use {@link #getInventoryNameComponent()} for chat.
*/
@Deprecated
public String getLocalizedInventoryName() { public String getLocalizedInventoryName() {
String inventoryName = getInventory().getInventoryName(); String inventoryName = getInventory().getInventoryName();
if (inventoryName == null) { if (inventoryName == null) {
@@ -460,22 +435,6 @@ public class NetworkedInventory {
} }
} }
public IChatComponent getInventoryNameComponent() {
String inventoryName = getInventory().getInventoryName();
if (inventoryName == null) {
return new ChatComponentText("null");
}
// Ask the tile entity: InventoryWrapper always reports no custom name.
// The client parses the translation as a format string and falls back to en_US if it fails, so a '%' in the
// en_US text (or in the key when untranslated) could crash it. A dedicated server translates to en_US.
boolean customName = connectedTileEntity instanceof IInventory
&& ((IInventory) connectedTileEntity).hasCustomInventoryName();
if (customName || StatCollector.translateToLocal(inventoryName).contains("%")) {
return new ChatComponentText(inventoryName);
}
return new ChatComponentTranslation(inventoryName);
}
static class Target implements Comparable<Target> { static class Target implements Comparable<Target> {
NetworkedInventory inv; NetworkedInventory inv;
@@ -47,8 +47,8 @@ public class ExistingItemFilter implements IItemFilter {
private boolean isStackInInventory(NetworkedInventory ni, ItemStack item) { private boolean isStackInInventory(NetworkedInventory ni, ItemStack item) {
int[] slots = ni.getInventory().getAccessibleSlotsFromSide(ni.getInventorySide()); int[] slots = ni.getInventory().getAccessibleSlotsFromSide(ni.getInventorySide());
for (int slot : slots) { for (int i = 0; i < slots.length; i++) {
ItemStack stack = ni.getInventory().getStackInSlot(slot); ItemStack stack = ni.getInventory().getStackInSlot(i);
if (stackEqual(item, stack)) { if (stackEqual(item, stack)) {
return true; return true;
} }
@@ -107,17 +107,17 @@ public class ExistingItemFilter implements IItemFilter {
} }
public void setSnapshot(NetworkedInventory ni) { public void setSnapshot(NetworkedInventory ni) {
snapshot = new ArrayList<>(); snapshot = new ArrayList<ItemStack>();
mergeSnapshot(ni); mergeSnapshot(ni);
} }
public void mergeSnapshot(NetworkedInventory ni) { public void mergeSnapshot(NetworkedInventory ni) {
if (snapshot == null) { if (snapshot == null) {
snapshot = new ArrayList<>(); snapshot = new ArrayList<ItemStack>();
} }
int[] slots = ni.getInventory().getAccessibleSlotsFromSide(ni.getInventorySide()); int[] slots = ni.getInventory().getAccessibleSlotsFromSide(ni.getInventorySide());
for (int slot : slots) { for (int i = 0; i < slots.length; i++) {
ItemStack stack = ni.getInventory().getStackInSlot(slot); ItemStack stack = ni.getInventory().getStackInSlot(i);
if (stack != null && !isStackInSnapshot(stack)) { if (stack != null && !isStackInSnapshot(stack)) {
snapshot.add(stack); snapshot.add(stack);
} }
@@ -126,7 +126,7 @@ public class ExistingItemFilter implements IItemFilter {
public boolean mergeSnapshot(IInventory inventory) { public boolean mergeSnapshot(IInventory inventory) {
if (snapshot == null) { if (snapshot == null) {
snapshot = new ArrayList<>(); snapshot = new ArrayList<ItemStack>();
} }
int size = inventory.getSizeInventory(); int size = inventory.getSizeInventory();
boolean added = false; boolean added = false;
@@ -200,7 +200,7 @@ public class ExistingItemFilter implements IItemFilter {
readSettingsFromNBT(nbtRoot); readSettingsFromNBT(nbtRoot);
if (nbtRoot.hasKey("snapshot")) { if (nbtRoot.hasKey("snapshot")) {
snapshot = new ArrayList<>(); snapshot = new ArrayList<ItemStack>();
NBTTagList itemList = (NBTTagList) nbtRoot.getTag("snapshot"); NBTTagList itemList = (NBTTagList) nbtRoot.getTag("snapshot");
for (int i = 0; i < itemList.tagCount(); i++) { for (int i = 0; i < itemList.tagCount(); i++) {
NBTTagCompound itemTag = itemList.getCompoundTagAt(i); NBTTagCompound itemTag = itemList.getCompoundTagAt(i);
@@ -274,7 +274,7 @@ public class ExistingItemFilter implements IItemFilter {
snapshot = null; snapshot = null;
return; return;
} }
snapshot = new ArrayList<>(numItems); snapshot = new ArrayList<ItemStack>(numItems);
for (int i = 0; i < numItems; i++) { for (int i = 0; i < numItems; i++) {
NBTTagCompound itemTag = NetworkUtil.readNBTTagCompound(buf); NBTTagCompound itemTag = NetworkUtil.readNBTTagCompound(buf);
ItemStack item = ItemStack.loadItemStackFromNBT(itemTag); ItemStack item = ItemStack.loadItemStackFromNBT(itemTag);
@@ -82,8 +82,9 @@ public class ItemBasicItemFilter extends Item implements IItemFilterUpgrade {
} }
@Override @Override
@SuppressWarnings({ "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List<ItemStack> par3List) { public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int j = 0; j < 2; ++j) { for (int j = 0; j < 2; ++j) {
par3List.add(new ItemStack(this, 1, j)); par3List.add(new ItemStack(this, 1, j));
} }
@@ -91,8 +92,7 @@ public class ItemBasicItemFilter extends Item implements IItemFilterUpgrade {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List<String> par3List, public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
boolean par4) {
if (FilterRegister.isFilterSet(par1ItemStack)) { if (FilterRegister.isFilterSet(par1ItemStack)) {
if (!SpecialTooltipHandler.showAdvancedTooltips()) { if (!SpecialTooltipHandler.showAdvancedTooltips()) {
par3List.add(EnderIO.lang.localize("itemConduitFilterUpgrade")); par3List.add(EnderIO.lang.localize("itemConduitFilterUpgrade"));
@@ -8,7 +8,6 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
@@ -68,7 +67,7 @@ public class ItemExistingItemFilter extends Item implements IItemFilterUpgrade,
ExistingItemFilter filter = (ExistingItemFilter) createFilterFromStack(item); ExistingItemFilter filter = (ExistingItemFilter) createFilterFromStack(item);
String unloc = "item.itemExistingItemFilter." String unloc = "item.itemExistingItemFilter."
+ (filter.mergeSnapshot(inv) ? "filterUpdated" : "filterNotUpdated"); + (filter.mergeSnapshot(inv) ? "filterUpdated" : "filterNotUpdated");
ChatUtil.sendNoSpam(player, new ChatComponentTranslation(EnderIO.lang.addPrefix(unloc))); ChatUtil.sendNoSpamUnloc(player, EnderIO.lang, unloc);
FilterRegister.writeFilterToStack(filter, item); FilterRegister.writeFilterToStack(filter, item);
return true; return true;
} }
@@ -90,8 +89,7 @@ public class ItemExistingItemFilter extends Item implements IItemFilterUpgrade,
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List<String> par3List, public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
boolean par4) {
if (FilterRegister.isFilterSet(par1ItemStack)) { if (FilterRegister.isFilterSet(par1ItemStack)) {
if (SpecialTooltipHandler.showAdvancedTooltips()) { if (SpecialTooltipHandler.showAdvancedTooltips()) {
par3List.add(EnumChatFormatting.ITALIC + EnderIO.lang.localize("itemConduitFilterUpgrade.configured")); par3List.add(EnumChatFormatting.ITALIC + EnderIO.lang.localize("itemConduitFilterUpgrade.configured"));
@@ -75,7 +75,7 @@ public class ItemFilter implements IInventory, IItemFilter {
this.isAdvanced = isAdvanced; this.isAdvanced = isAdvanced;
this.numItems = numItems; this.numItems = numItems;
items = new ItemStack[numItems]; items = new ItemStack[numItems];
oreIds = new ArrayList<>(numItems); oreIds = new ArrayList<int[]>(numItems);
for (int i = 0; i < numItems; i++) { for (int i = 0; i < numItems; i++) {
oreIds.add(null); oreIds.add(null);
} }
@@ -91,10 +91,11 @@ public class ItemFilter implements IInventory, IItemFilter {
return doesItemPassFilter(item); return doesItemPassFilter(item);
} }
@SuppressWarnings("SimplifiableConditionalExpression")
public boolean doesItemPassFilter(ItemStack item) { public boolean doesItemPassFilter(ItemStack item) {
boolean allow = isValid() && itemMatched(item); boolean allow = isValid() && itemMatched(item);
return isBlacklist ^ allow; return isBlacklist ? !allow : allow;
} }
protected boolean itemMatched(ItemStack item) { protected boolean itemMatched(ItemStack item) {
@@ -60,8 +60,7 @@ public class ItemLimitedItemFilter extends Item implements IItemFilterUpgrade, I
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List<String> par3List, public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
boolean par4) {
if (FilterRegister.isFilterSet(par1ItemStack)) { if (FilterRegister.isFilterSet(par1ItemStack)) {
if (SpecialTooltipHandler.showAdvancedTooltips()) { if (SpecialTooltipHandler.showAdvancedTooltips()) {
par3List.add(EnumChatFormatting.ITALIC + EnderIO.lang.localize("itemConduitFilterUpgrade.configured")); par3List.add(EnumChatFormatting.ITALIC + EnderIO.lang.localize("itemConduitFilterUpgrade.configured"));
@@ -60,8 +60,7 @@ public class ItemModItemFilter extends Item implements IItemFilterUpgrade, IReso
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List<String> par3List, public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
boolean par4) {
if (FilterRegister.isFilterSet(par1ItemStack)) { if (FilterRegister.isFilterSet(par1ItemStack)) {
if (SpecialTooltipHandler.showAdvancedTooltips()) { if (SpecialTooltipHandler.showAdvancedTooltips()) {
par3List.add(EnumChatFormatting.ITALIC + EnderIO.lang.localize("itemConduitFilterUpgrade.configured")); par3List.add(EnumChatFormatting.ITALIC + EnderIO.lang.localize("itemConduitFilterUpgrade.configured"));
@@ -7,7 +7,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import java.util.function.IntSupplier; import java.util.function.Supplier;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@@ -87,43 +87,37 @@ public abstract class AbstractEnderLiquidConduit extends AbstractLiquidConduit {
MELODIC(() -> Config.melodicEnderFluidConduitExtractRate, () -> Config.melodicEnderFluidConduitMaxIoRate), MELODIC(() -> Config.melodicEnderFluidConduitExtractRate, () -> Config.melodicEnderFluidConduitMaxIoRate),
STELLAR(() -> Config.stellarEnderFluidConduitExtractRate, () -> Config.stellarEnderFluidConduitMaxIoRate), STELLAR(() -> Config.stellarEnderFluidConduitExtractRate, () -> Config.stellarEnderFluidConduitMaxIoRate);
PRISMATIC_NAQUADAH(() -> Config.prismaticNaquadahEnderFluidConduitExtractRate, private final Supplier<Integer> getMaxExtractPerTick;
() -> Config.prismaticNaquadahEnderFluidConduitMaxIoRate), private final Supplier<Integer> getMaxIoPerTick;
FLUXED(() -> Config.fluxedEnderFluidConduitExtractRate, () -> Config.fluxedEnderFluidConduitMaxIoRate), Type(Supplier<Integer> getMaxExtractPerTick, Supplier<Integer> getMaxIoPerTick) {
TRANSCENDENT(() -> Config.transcendentEnderFluidConduitExtractRate,
() -> Config.transcendentEnderFluidConduitMaxIoRate),
COSMIC(() -> Config.cosmicEnderFluidConduitExtractRate, () -> Config.cosmicEnderFluidConduitMaxIoRate);
private final IntSupplier getMaxExtractPerTick;
private final IntSupplier getMaxIoPerTick;
Type(IntSupplier getMaxExtractPerTick, IntSupplier getMaxIoPerTick) {
this.getMaxExtractPerTick = getMaxExtractPerTick; this.getMaxExtractPerTick = getMaxExtractPerTick;
this.getMaxIoPerTick = getMaxIoPerTick; this.getMaxIoPerTick = getMaxIoPerTick;
} }
public int getMaxExtractPerTick() { public int getMaxExtractPerTick() {
return getMaxExtractPerTick.getAsInt(); return getMaxExtractPerTick.get();
} }
public int getMaxIoPerTick() { public int getMaxIoPerTick() {
return getMaxIoPerTick.getAsInt(); return getMaxIoPerTick.get();
} }
} }
private EnderLiquidConduitNetwork network; private EnderLiquidConduitNetwork network;
private int ticksSinceFailedExtract; private int ticksSinceFailedExtract;
private final EnumMap<ForgeDirection, FluidFilter> outputFilters = new EnumMap<>(ForgeDirection.class); private final EnumMap<ForgeDirection, FluidFilter> outputFilters = new EnumMap<ForgeDirection, FluidFilter>(
private final EnumMap<ForgeDirection, FluidFilter> inputFilters = new EnumMap<>(ForgeDirection.class); ForgeDirection.class);
private final EnumMap<ForgeDirection, FluidFilter> inputFilters = new EnumMap<ForgeDirection, FluidFilter>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, DyeColor> outputColors = new EnumMap<>(ForgeDirection.class); protected final EnumMap<ForgeDirection, DyeColor> outputColors = new EnumMap<ForgeDirection, DyeColor>(
protected final EnumMap<ForgeDirection, DyeColor> inputColors = new EnumMap<>(ForgeDirection.class); ForgeDirection.class);
protected final EnumMap<ForgeDirection, DyeColor> inputColors = new EnumMap<ForgeDirection, DyeColor>(
ForgeDirection.class);
private int roundRobin = 0; private int roundRobin = 0;
@@ -314,6 +308,7 @@ public abstract class AbstractEnderLiquidConduit extends AbstractLiquidConduit {
} }
private void doExtract() { private void doExtract() {
BlockCoord loc = getLocation();
if (!hasExtractableMode()) { if (!hasExtractableMode()) {
return; return;
} }
@@ -430,10 +425,10 @@ public abstract class AbstractEnderLiquidConduit extends AbstractLiquidConduit {
super.readTypeSettings(dir, dataRoot); super.readTypeSettings(dir, dataRoot);
if (dataRoot.hasKey("inputColor")) { if (dataRoot.hasKey("inputColor")) {
setInputColor(dir, DyeColor.VALUES[dataRoot.getShort("inputColor")]); setInputColor(dir, DyeColor.values()[dataRoot.getShort("inputColor")]);
} }
if (dataRoot.hasKey("outputColor")) { if (dataRoot.hasKey("outputColor")) {
setOutputColor(dir, DyeColor.VALUES[dataRoot.getShort("outputColor")]); setOutputColor(dir, DyeColor.values()[dataRoot.getShort("outputColor")]);
} }
if (dataRoot.hasKey("roundRobin")) { if (dataRoot.hasKey("roundRobin")) {
@@ -548,16 +543,16 @@ public abstract class AbstractEnderLiquidConduit extends AbstractLiquidConduit {
key = "inSC." + dir.name(); key = "inSC." + dir.name();
if (nbtRoot.hasKey(key)) { if (nbtRoot.hasKey(key)) {
short ord = nbtRoot.getShort(key); short ord = nbtRoot.getShort(key);
if (ord >= 0 && ord < DyeColor.VALUES.length) { if (ord >= 0 && ord < DyeColor.values().length) {
inputColors.put(dir, DyeColor.VALUES[ord]); inputColors.put(dir, DyeColor.values()[ord]);
} }
} }
key = "outSC." + dir.name(); key = "outSC." + dir.name();
if (nbtRoot.hasKey(key)) { if (nbtRoot.hasKey(key)) {
short ord = nbtRoot.getShort(key); short ord = nbtRoot.getShort(key);
if (ord >= 0 && ord < DyeColor.VALUES.length) { if (ord >= 0 && ord < DyeColor.values().length) {
outputColors.put(dir, DyeColor.VALUES[ord]); outputColors.put(dir, DyeColor.values()[ord]);
} }
} }
} }
@@ -29,10 +29,12 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
public abstract class AbstractLiquidConduit extends AbstractConduit implements ILiquidConduit { public abstract class AbstractLiquidConduit extends AbstractConduit implements ILiquidConduit {
protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes = new EnumMap<>(ForgeDirection.class); protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes = new EnumMap<ForgeDirection, RedstoneControlMode>(
protected final EnumMap<ForgeDirection, DyeColor> extractionColors = new EnumMap<>(ForgeDirection.class); ForgeDirection.class);
protected final EnumMap<ForgeDirection, DyeColor> extractionColors = new EnumMap<ForgeDirection, DyeColor>(
ForgeDirection.class);
protected final Map<ForgeDirection, Integer> externalRedstoneSignals = new HashMap<>(); protected final Map<ForgeDirection, Integer> externalRedstoneSignals = new HashMap<ForgeDirection, Integer>();
protected boolean redstoneStateDirty = true; protected boolean redstoneStateDirty = true;
public static IFluidHandler getExternalFluidHandler(IBlockAccess world, BlockCoord bc) { public static IFluidHandler getExternalFluidHandler(IBlockAccess world, BlockCoord bc) {
@@ -202,8 +204,8 @@ public abstract class AbstractLiquidConduit extends AbstractConduit implements I
@Override @Override
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) { protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
setExtractionSignalColor(dir, DyeColor.VALUES[dataRoot.getShort("extractionSignalColor")]); setExtractionSignalColor(dir, DyeColor.values()[dataRoot.getShort("extractionSignalColor")]);
setExtractionRedstoneMode(RedstoneControlMode.VALUES[dataRoot.getShort("extractionRedstoneMode")], dir); setExtractionRedstoneMode(RedstoneControlMode.values()[dataRoot.getShort("extractionRedstoneMode")], dir);
} }
@Override @Override
@@ -239,15 +241,15 @@ public abstract class AbstractLiquidConduit extends AbstractConduit implements I
String key = "extRM." + dir.name(); String key = "extRM." + dir.name();
if (nbtRoot.hasKey(key)) { if (nbtRoot.hasKey(key)) {
short ord = nbtRoot.getShort(key); short ord = nbtRoot.getShort(key);
if (ord >= 0 && ord < RedstoneControlMode.VALUES.length) { if (ord >= 0 && ord < RedstoneControlMode.values().length) {
extractionModes.put(dir, RedstoneControlMode.VALUES[ord]); extractionModes.put(dir, RedstoneControlMode.values()[ord]);
} }
} }
key = "extSC." + dir.name(); key = "extSC." + dir.name();
if (nbtRoot.hasKey(key)) { if (nbtRoot.hasKey(key)) {
short ord = nbtRoot.getShort(key); short ord = nbtRoot.getShort(key);
if (ord >= 0 && ord < DyeColor.VALUES.length) { if (ord >= 0 && ord < DyeColor.values().length) {
extractionColors.put(dir, DyeColor.VALUES[ord]); extractionColors.put(dir, DyeColor.values()[ord]);
} }
} }
} }
@@ -7,16 +7,15 @@ import java.util.Set;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import com.enderio.core.common.util.BlockCoord; import com.enderio.core.common.util.BlockCoord;
import com.enderio.core.common.util.ChatUtil; import com.enderio.core.common.util.ChatUtil;
import com.gtnewhorizon.gtnhlib.chat.customcomponents.ChatComponentFluidName;
import crazypants.enderio.EnderIO; import crazypants.enderio.EnderIO;
import crazypants.enderio.conduit.AbstractConduitNetwork; import crazypants.enderio.conduit.AbstractConduitNetwork;
@@ -111,9 +110,7 @@ public abstract class AbstractTankConduit extends AbstractLiquidConduit {
if (network.fluidTypeLocked) { if (network.fluidTypeLocked) {
network.setFluidTypeLocked(false); network.setFluidTypeLocked(false);
numEmptyEvents = 0; numEmptyEvents = 0;
ChatUtil.sendNoSpam( ChatUtil.sendNoSpamUnloc(player, EnderIO.lang, "itemLiquidConduit.unlockedType");
player,
new ChatComponentTranslation(EnderIO.lang.addPrefix("itemLiquidConduit.unlockedType")));
} }
} else if (network != null) { } else if (network != null) {
network.setFluidType(null); network.setFluidType(null);
@@ -131,10 +128,11 @@ public abstract class AbstractTankConduit extends AbstractLiquidConduit {
|| LiquidConduitNetwork.areFluidsCompatable(getFluidType(), fluid))) { || LiquidConduitNetwork.areFluidsCompatable(getFluidType(), fluid))) {
network.setFluidType(fluid); network.setFluidType(fluid);
network.setFluidTypeLocked(true); network.setFluidTypeLocked(true);
ChatUtil.sendNoSpam( ChatUtil.sendNoSpamUnloc(
player, player,
new ChatComponentTranslation(EnderIO.lang.addPrefix("itemLiquidConduit.lockedType")) EnderIO.lang,
.appendText(" ").appendSibling(new ChatComponentFluidName(fluid))); "itemLiquidConduit.lockedType",
" " + FluidRegistry.getFluidName(fluid));
} }
} }
return true; return true;
@@ -14,6 +14,7 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.FluidTankInfo;
import com.enderio.core.client.render.IconUtil; import com.enderio.core.client.render.IconUtil;
import com.enderio.core.common.util.BlockCoord;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -91,6 +92,7 @@ public class AdvancedLiquidConduit extends AbstractTankConduit {
} }
private void doExtract() { private void doExtract() {
BlockCoord loc = getLocation();
// Extraction can happen on extract mode or in/out mode // Extraction can happen on extract mode or in/out mode
if (!hasExtractableMode()) { if (!hasExtractableMode()) {
return; return;
@@ -106,6 +108,7 @@ public class AdvancedLiquidConduit extends AbstractTankConduit {
return; return;
} }
Fluid f = tank.getFluid() == null ? null : tank.getFluid().getFluid();
for (ForgeDirection dir : externalConnections) { for (ForgeDirection dir : externalConnections) {
if (autoExtractForDir(dir)) { if (autoExtractForDir(dir)) {
if (network.extractFrom(this, dir, MAX_EXTRACT_PER_TICK)) { if (network.extractFrom(this, dir, MAX_EXTRACT_PER_TICK)) {
@@ -19,7 +19,7 @@ public class AdvancedLiquidConduitNetwork extends AbstractTankConduitNetwork<Adv
private final ConduitTank tank = new ConduitTank(0); private final ConduitTank tank = new ConduitTank(0);
private final Set<LiquidOutput> outputs = new HashSet<>(); private final Set<LiquidOutput> outputs = new HashSet<LiquidOutput>();
private Iterator<LiquidOutput> outputIterator; private Iterator<LiquidOutput> outputIterator;
@@ -134,7 +134,7 @@ public class ConduitTank implements IFluidTank {
addAmount(-used); addAmount(-used);
} }
FluidStack drained = new FluidStack(fluid.getFluid(), used); FluidStack drained = new FluidStack(fluid.getFluidID(), used);
if (fluid.amount < 0) { if (fluid.amount < 0) {
fluid.amount = 0; fluid.amount = 0;
@@ -1,57 +0,0 @@
package crazypants.enderio.conduit.liquid;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import com.enderio.core.client.render.IconUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class CosmicEnderLiquidConduit extends AbstractEnderLiquidConduit {
public static final Type TYPE = Type.COSMIC;
public static final int METADATA = 10;
public static final String ICON_KEY = "enderio:liquidConduitCosmicEnder";
public static final String ICON_CORE_KEY = "enderio:liquidConduitCoreCosmicEnder";
static IIcon iconKey;
static IIcon iconCoreKey;
@SideOnly(Side.CLIENT)
public static void initIcons() {
IconUtil.addIconProvider(new IconUtil.IIconProvider() {
@Override
public void registerIcons(IIconRegister register) {
iconKey = register.registerIcon(ICON_KEY);
iconCoreKey = register.registerIcon(ICON_CORE_KEY);
}
@Override
public int getTextureType() {
return 0;
}
});
}
@Override
public Type getType() {
return TYPE;
}
@Override
public int getMetadata() {
return METADATA;
}
@Override
protected IIcon getIconKey() {
return iconKey;
}
@Override
protected IIcon getIconCoreKey() {
return iconCoreKey;
}
}
@@ -58,8 +58,8 @@ public class EnderLiquidConduitNetwork extends AbstractConduitNetwork<ILiquidCon
private final AbstractEnderLiquidConduit.Type type; private final AbstractEnderLiquidConduit.Type type;
List<NetworkTank> tanks = new ArrayList<>(); List<NetworkTank> tanks = new ArrayList<NetworkTank>();
Map<NetworkTankKey, NetworkTank> tankMap = new HashMap<>(); Map<NetworkTankKey, NetworkTank> tankMap = new HashMap<NetworkTankKey, NetworkTank>();
Map<NetworkTank, TankIterator> iterators; Map<NetworkTank, TankIterator> iterators;
@@ -85,13 +85,11 @@ public class EnderLiquidConduitNetwork extends AbstractConduitNetwork<ILiquidCon
return false; return false;
} }
FluidTankInfo[] tankInfos = tank.externalTank.getTankInfo(conDir.getOpposite()); if (tank.externalTank.getTankInfo(conDir.getOpposite()) != null) {
if (tankInfos != null) { for (FluidTankInfo tankInfo : tank.externalTank.getTankInfo(conDir.getOpposite())) {
for (FluidTankInfo tankInfo : tankInfos) {
if (tankInfo == null || tankInfo.fluid == null) { if (tankInfo == null || tankInfo.fluid == null) {
continue; continue;
} }
FluidStack tryDrain = tankInfo.fluid.copy(); FluidStack tryDrain = tankInfo.fluid.copy();
tryDrain.amount = type.getMaxExtractPerTick(); tryDrain.amount = type.getMaxExtractPerTick();
FluidStack drained = tank.externalTank.drain(conDir.getOpposite(), tryDrain, false); FluidStack drained = tank.externalTank.drain(conDir.getOpposite(), tryDrain, false);
@@ -100,12 +98,10 @@ public class EnderLiquidConduitNetwork extends AbstractConduitNetwork<ILiquidCon
|| !tryDrain.isFluidEqual(drained)) { || !tryDrain.isFluidEqual(drained)) {
continue; continue;
} }
int amountAccepted = fillFrom(tank, drained.copy(), true);
int amountAccepted = fillFrom(tank, drained, true);
if (amountAccepted <= 0) { if (amountAccepted <= 0) {
continue; continue;
} }
tryDrain.amount = amountAccepted; tryDrain.amount = amountAccepted;
drained = tank.externalTank.drain(conDir.getOpposite(), tryDrain, true); drained = tank.externalTank.drain(conDir.getOpposite(), tryDrain, true);
if (drained == null || drained.amount <= 0) { if (drained == null || drained.amount <= 0) {
@@ -119,7 +115,7 @@ public class EnderLiquidConduitNetwork extends AbstractConduitNetwork<ILiquidCon
if (drained == null || drained.amount <= 0 || !matchedFilter(drained, con, conDir, true)) { if (drained == null || drained.amount <= 0 || !matchedFilter(drained, con, conDir, true)) {
return false; return false;
} }
int amountAccepted = fillFrom(tank, drained, true); int amountAccepted = fillFrom(tank, drained.copy(), true);
if (amountAccepted <= 0) { if (amountAccepted <= 0) {
return false; return false;
} }
@@ -151,6 +147,7 @@ public class EnderLiquidConduitNetwork extends AbstractConduitNetwork<ILiquidCon
resource = resource.copy(); resource = resource.copy();
resource.amount = Math.min(resource.amount, type.getMaxIoPerTick()); resource.amount = Math.min(resource.amount, type.getMaxIoPerTick());
int filled = 0; int filled = 0;
int remaining = resource.amount;
// TODO: Only change starting pos of iterator is doFill is true so a false then true returns the same // TODO: Only change starting pos of iterator is doFill is true so a false then true returns the same
TankIterator iterator; TankIterator iterator;
@@ -161,13 +158,13 @@ public class EnderLiquidConduitNetwork extends AbstractConduitNetwork<ILiquidCon
&& target.acceptsOuput && target.acceptsOuput
&& target.isValid() && target.isValid()
&& matchedFilter(resource, target.con, target.conDir, false)) { && matchedFilter(resource, target.con, target.conDir, false)) {
// Use reused FluidStack instead of copying each iteration int vol = target.externalTank.fill(target.tankDir, resource.copy(), doFill);
int vol = target.externalTank.fill(target.tankDir, resource, doFill); remaining -= vol;
resource.amount -= vol;
filled += vol; filled += vol;
if (resource.amount <= 0) { if (remaining <= 0) {
break; break;
} }
resource.amount = remaining;
} }
} }
if (!tank.con.isRoundRobin(tank.conDir)) iterator.rewind(); if (!tank.con.isRoundRobin(tank.conDir)) iterator.rewind();
@@ -203,7 +200,7 @@ public class EnderLiquidConduitNetwork extends AbstractConduitNetwork<ILiquidCon
} }
public FluidTankInfo[] getTankInfo(AbstractEnderLiquidConduit con, ForgeDirection conDir) { public FluidTankInfo[] getTankInfo(AbstractEnderLiquidConduit con, ForgeDirection conDir) {
List<FluidTankInfo> res = new ArrayList<>(tanks.size()); List<FluidTankInfo> res = new ArrayList<FluidTankInfo>(tanks.size());
NetworkTank tank = getTank(con, conDir); NetworkTank tank = getTank(con, conDir);
for (NetworkTank target : tanks) { for (NetworkTank target : tanks) {
if (!target.equals(tank) && target.isValid()) { if (!target.equals(tank) && target.isValid()) {
@@ -1,57 +0,0 @@
package crazypants.enderio.conduit.liquid;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import com.enderio.core.client.render.IconUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class FluxedEnderLiquidConduit extends AbstractEnderLiquidConduit {
public static final Type TYPE = Type.FLUXED;
public static final int METADATA = 8;
public static final String ICON_KEY = "enderio:liquidConduitFluxedEnder";
public static final String ICON_CORE_KEY = "enderio:liquidConduitCoreFluxedEnder";
static IIcon iconKey;
static IIcon iconCoreKey;
@SideOnly(Side.CLIENT)
public static void initIcons() {
IconUtil.addIconProvider(new IconUtil.IIconProvider() {
@Override
public void registerIcons(IIconRegister register) {
iconKey = register.registerIcon(ICON_KEY);
iconCoreKey = register.registerIcon(ICON_CORE_KEY);
}
@Override
public int getTextureType() {
return 0;
}
});
}
@Override
public Type getType() {
return TYPE;
}
@Override
public int getMetadata() {
return METADATA;
}
@Override
protected IIcon getIconKey() {
return iconKey;
}
@Override
protected IIcon getIconCoreKey() {
return iconCoreKey;
}
}
@@ -16,11 +16,10 @@ import crazypants.enderio.conduit.AbstractItemConduit;
import crazypants.enderio.conduit.IConduit; import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.ItemConduitSubtype; import crazypants.enderio.conduit.ItemConduitSubtype;
import crazypants.enderio.config.Config; import crazypants.enderio.config.Config;
import crazypants.enderio.power.PowerDisplayUtil;
public class ItemLiquidConduit extends AbstractItemConduit implements IAdvancedTooltipProvider { public class ItemLiquidConduit extends AbstractItemConduit implements IAdvancedTooltipProvider {
private static final ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] { private static ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
new ItemConduitSubtype(ModObject.itemLiquidConduit.name(), "enderio:itemLiquidConduit"), new ItemConduitSubtype(ModObject.itemLiquidConduit.name(), "enderio:itemLiquidConduit"),
new ItemConduitSubtype( new ItemConduitSubtype(
ModObject.itemLiquidConduit.name() + "Advanced", ModObject.itemLiquidConduit.name() + "Advanced",
@@ -37,19 +36,7 @@ public class ItemLiquidConduit extends AbstractItemConduit implements IAdvancedT
"enderio:itemLiquidConduitMelodicEnder"), "enderio:itemLiquidConduitMelodicEnder"),
new ItemConduitSubtype( new ItemConduitSubtype(
ModObject.itemLiquidConduit.name() + "StellarEnder", ModObject.itemLiquidConduit.name() + "StellarEnder",
"enderio:itemLiquidConduitStellarEnder"), "enderio:itemLiquidConduitStellarEnder") };
new ItemConduitSubtype(
ModObject.itemLiquidConduit.name() + "PrismaticNaquadahEnder",
"enderio:itemLiquidConduitPrismaticNaquadahEnder"),
new ItemConduitSubtype(
ModObject.itemLiquidConduit.name() + "FluxedEnder",
"enderio:itemLiquidConduitFluxedEnder"),
new ItemConduitSubtype(
ModObject.itemLiquidConduit.name() + "TranscendentEnder",
"enderio:itemLiquidConduitTranscendentEnder"),
new ItemConduitSubtype(
ModObject.itemLiquidConduit.name() + "CosmicEnder",
"enderio:itemLiquidConduitCosmicEnder") };
public static ItemLiquidConduit create() { public static ItemLiquidConduit create() {
ItemLiquidConduit result = new ItemLiquidConduit(); ItemLiquidConduit result = new ItemLiquidConduit();
@@ -83,14 +70,6 @@ public class ItemLiquidConduit extends AbstractItemConduit implements IAdvancedT
return new MelodicEnderLiquidConduit(); return new MelodicEnderLiquidConduit();
case StellarEnderLiquidConduit.METADATA: case StellarEnderLiquidConduit.METADATA:
return new StellarEnderLiquidConduit(); return new StellarEnderLiquidConduit();
case PrismaticNaquadahEnderLiquidConduit.METADATA:
return new PrismaticNaquadahEnderLiquidConduit();
case FluxedEnderLiquidConduit.METADATA:
return new FluxedEnderLiquidConduit();
case TranscendentEnderLiquidConduit.METADATA:
return new TranscendentEnderLiquidConduit();
case CosmicEnderLiquidConduit.METADATA:
return new CosmicEnderLiquidConduit();
default: default:
throw new IllegalArgumentException("Unrecognized ender fluid conduit type: " + stack.getItemDamage()); throw new IllegalArgumentException("Unrecognized ender fluid conduit type: " + stack.getItemDamage());
} }
@@ -98,15 +77,15 @@ public class ItemLiquidConduit extends AbstractItemConduit implements IAdvancedT
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addCommonEntries(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag) {} public void addCommonEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addBasicEntries(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag) {} public void addBasicEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addDetailedEntries(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag) { public void addDetailedEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {
int extractRate; int extractRate;
int maxIo; int maxIo;
@@ -146,40 +125,14 @@ public class ItemLiquidConduit extends AbstractItemConduit implements IAdvancedT
maxIo = StellarEnderLiquidConduit.TYPE.getMaxIoPerTick(); maxIo = StellarEnderLiquidConduit.TYPE.getMaxIoPerTick();
break; break;
case PrismaticNaquadahEnderLiquidConduit.METADATA:
extractRate = PrismaticNaquadahEnderLiquidConduit.TYPE.getMaxExtractPerTick();
maxIo = PrismaticNaquadahEnderLiquidConduit.TYPE.getMaxIoPerTick();
break;
case FluxedEnderLiquidConduit.METADATA:
extractRate = FluxedEnderLiquidConduit.TYPE.getMaxExtractPerTick();
maxIo = FluxedEnderLiquidConduit.TYPE.getMaxIoPerTick();
break;
case TranscendentEnderLiquidConduit.METADATA:
extractRate = TranscendentEnderLiquidConduit.TYPE.getMaxExtractPerTick();
maxIo = TranscendentEnderLiquidConduit.TYPE.getMaxIoPerTick();
break;
case CosmicEnderLiquidConduit.METADATA:
extractRate = CosmicEnderLiquidConduit.TYPE.getMaxExtractPerTick();
maxIo = CosmicEnderLiquidConduit.TYPE.getMaxIoPerTick();
break;
default: default:
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Unrecognized ender fluid conduit type: " + itemstack.getItemDamage()); "Unrecognized ender fluid conduit type: " + itemstack.getItemDamage());
} }
String mbt = " " + EnderIO.lang.localize("fluid.millibucketsTick"); String mbt = " " + EnderIO.lang.localize("fluid.millibucketsTick");
list.add( list.add(EnderIO.lang.localize("itemLiquidConduit.tooltip.maxExtract") + " " + extractRate + mbt);
EnderIO.lang.localize("itemLiquidConduit.tooltip.maxExtract") + " " list.add(EnderIO.lang.localize("itemLiquidConduit.tooltip.maxIo") + " " + maxIo + mbt);
+ PowerDisplayUtil.formatPower(extractRate)
+ mbt);
list.add(
EnderIO.lang.localize("itemLiquidConduit.tooltip.maxIo") + " "
+ PowerDisplayUtil.formatPower(maxIo)
+ mbt);
if (itemstack.getItemDamage() == 0) { if (itemstack.getItemDamage() == 0) {
SpecialTooltipHandler.addDetailedTooltipFromResources(list, "enderio.itemLiquidConduit"); SpecialTooltipHandler.addDetailedTooltipFromResources(list, "enderio.itemLiquidConduit");
@@ -143,7 +143,7 @@ public class LiquidConduit extends AbstractTankConduit {
} }
} }
if (!foundFluid) { if (!foundFluid) {
continue; return;
} }
FluidStack couldDrain = extTank.drain(dir.getOpposite(), MAX_EXTRACT_PER_TICK, false); FluidStack couldDrain = extTank.drain(dir.getOpposite(), MAX_EXTRACT_PER_TICK, false);
@@ -360,7 +360,7 @@ public class LiquidConduit extends AbstractTankConduit {
return false; return false;
} }
AbstractTankConduitNetwork<?> n = (AbstractTankConduitNetwork<?>) network; AbstractTankConduitNetwork n = (AbstractTankConduitNetwork) network;
if (tank.getFluid() == null) { if (tank.getFluid() == null) {
tank.setLiquid(n.getFluidType() == null ? null : n.getFluidType().copy()); tank.setLiquid(n.getFluidType() == null ? null : n.getFluidType().copy());
} else if (n.getFluidType() == null) { } else if (n.getFluidType() == null) {
@@ -21,10 +21,10 @@ public class LiquidConduitNetwork extends AbstractTankConduitNetwork<LiquidCondu
private int ticksEmpty = 0; private int ticksEmpty = 0;
private static final int maxFlowsPerTick = 10; private int maxFlowsPerTick = 10;
private int lastFlowIndex = 0; private int lastFlowIndex = 0;
private static final boolean printFlowTiming = false; private boolean printFlowTiming = false;
private int lastPushToken = 0; private int lastPushToken = 0;
@@ -100,7 +100,7 @@ public class LiquidConduitNetwork extends AbstractTankConduitNetwork<LiquidCondu
private boolean doFlow() { private boolean doFlow() {
int pushToken = getNextPushToken(); int pushToken = getNextPushToken();
List<FlowAction> actions = new ArrayList<>(); List<FlowAction> actions = new ArrayList<FlowAction>();
for (int i = 0; i < Math.min(maxFlowsPerTick, conduits.size()); i++) { for (int i = 0; i < Math.min(maxFlowsPerTick, conduits.size()); i++) {
if (lastFlowIndex >= conduits.size()) { if (lastFlowIndex >= conduits.size()) {
@@ -116,7 +116,7 @@ public class LiquidConduitNetwork extends AbstractTankConduitNetwork<LiquidCondu
boolean result = !actions.isEmpty(); boolean result = !actions.isEmpty();
// Flush any tanks with a tiny bit left // Flush any tanks with a tiny bit left
List<LiquidConduit> toEmpty = new ArrayList<>(); List<LiquidConduit> toEmpty = new ArrayList<LiquidConduit>();
for (LiquidConduit con : conduits) { for (LiquidConduit con : conduits) {
if (con != null && con.getTank().getFluidAmount() < 10) { if (con != null && con.getTank().getFluidAmount() < 10) {
toEmpty.add(con); toEmpty.add(con);
@@ -129,7 +129,7 @@ public class LiquidConduitNetwork extends AbstractTankConduitNetwork<LiquidCondu
return result; return result;
} }
List<LocatedFluidHandler> externals = new ArrayList<>(); List<LocatedFluidHandler> externals = new ArrayList<LocatedFluidHandler>();
for (AbstractTankConduit con : conduits) { for (AbstractTankConduit con : conduits) {
Set<ForgeDirection> extCons = con.getExternalConnections(); Set<ForgeDirection> extCons = con.getExternalConnections();
@@ -279,11 +279,13 @@ public class LiquidConduitNetwork extends AbstractTankConduitNetwork<LiquidCondu
loc.y, loc.y,
loc.z, loc.z,
ILiquidConduit.class); ILiquidConduit.class);
int numTargets = 0;
for (ILiquidConduit n : connections) { for (ILiquidConduit n : connections) {
LiquidConduit neighbour = (LiquidConduit) n; LiquidConduit neighbour = (LiquidConduit) n;
if (canFlowTo(con, neighbour)) { // can only flow within same network if (canFlowTo(con, neighbour)) { // can only flow within same network
totalAmount += neighbour.getTank().getFluidAmount(); totalAmount += neighbour.getTank().getFluidAmount();
totalCapacity += neighbour.getTank().getCapacity(); totalCapacity += neighbour.getTank().getCapacity();
numTargets++;
} }
} }
@@ -1,11 +1,11 @@
package crazypants.enderio.conduit.liquid; package crazypants.enderio.conduit.liquid;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collection;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;
import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
@@ -56,17 +56,10 @@ public class LiquidConduitRenderer extends DefaultConduitRenderer implements IRe
super.renderEntity(conduitBundleRenderer, te, conduit, x, y, z, partialTick, worldLight, rb); super.renderEntity(conduitBundleRenderer, te, conduit, x, y, z, partialTick, worldLight, rb);
} }
public void renderDynamicEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit,
double x, double y, double z, float partialTick, float worldLight) {
}
@Override @Override
protected void renderConduit(IIcon tex, IConduit conduit, CollidableComponent component, float brightness) { protected void renderConduit(IIcon tex, IConduit conduit, CollidableComponent component, float brightness) {
Tessellator tessellator = Tessellator.instance;
if (isNSEWUD(component.dir)) { if (isNSEWUD(component.dir)) {
LiquidConduit lc = (LiquidConduit) conduit; LiquidConduit lc = (LiquidConduit) conduit;
IIcon fluidTex = conduit.getTransmitionTextureForState(component);
FluidStack fluid = lc.getFluidType(); FluidStack fluid = lc.getFluidType();
if (fluid != null) { if (fluid != null) {
renderFluidOutline(component, fluid); renderFluidOutline(component, fluid);
@@ -74,40 +67,33 @@ public class LiquidConduitRenderer extends DefaultConduitRenderer implements IRe
BoundingBox[] cubes = toCubes(component.bound); BoundingBox[] cubes = toCubes(component.bound);
for (BoundingBox cube : cubes) { for (BoundingBox cube : cubes) {
drawSection(cube, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV(), component.dir, false); drawSection(cube, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV(), component.dir, false);
// This check is kinda broken, but whatever, it was like that when this was done in a TESR too
if (lc.getTank().getFilledRatio() <= 0) {
continue;
}
tessellator.setColorOpaque_F(0.7f, 0.7f, 0.7f);
drawSection(
cube,
fluidTex.getMinU(),
fluidTex.getMaxU(),
fluidTex.getMinV(),
fluidTex.getMaxV(),
component.dir,
true);
} }
if (conduit.getConnectionMode(component.dir) == ConnectionMode.DISABLED) { } else {
final CubeRenderer cr = CubeRenderer.get(); drawSection(
int i; component.bound,
tex = EnderIO.blockConduitBundle.getConnectorIcon(component.data); tex.getMinU(),
List<Vertex> corners = component.bound.getCornersWithUvForFace( tex.getMaxU(),
component.dir, tex.getMinV(),
tex.getMinU(), tex.getMaxV(),
tex.getMaxU(), component.dir,
tex.getMinV(), true);
tex.getMaxV()); }
for (i = corners.size() - 1; i >= 0; i--) {
Vertex c = corners.get(i); if (conduit.getConnectionMode(component.dir) == ConnectionMode.DISABLED) {
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y); final CubeRenderer cr = CubeRenderer.get();
} int i;
// back face tex = EnderIO.blockConduitBundle.getConnectorIcon(component.data);
for (i = corners.size() - 1; i >= 0; i--) { List<Vertex> corners = component.bound
Vertex c = corners.get(i); .getCornersWithUvForFace(component.dir, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV());
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y); for (i = corners.size() - 1; i >= 0; i--) {
} Vertex c = corners.get(i);
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
}
// back face
for (i = corners.size() - 1; i >= 0; i--) {
Vertex c = corners.get(i);
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
} }
} }
} }
@@ -127,29 +113,27 @@ public class LiquidConduitRenderer extends DefaultConduitRenderer implements IRe
} }
} }
private static final Map<CollidableComponent, Map<Fluid, List<CachableRenderStatement>>> cache = Collections private static Map<CollidableComponent, Map<Fluid, List<CachableRenderStatement>>> cache = new WeakHashMap<CollidableComponent, Map<Fluid, List<CachableRenderStatement>>>();
.synchronizedMap(new WeakHashMap<>());
public static List<CachableRenderStatement> computeFluidOutlineToCache(CollidableComponent component, Fluid fluid, public static List<CachableRenderStatement> computeFluidOutlineToCache(CollidableComponent component, Fluid fluid,
double scaleFactor, float outlineWidth) { double scaleFactor, float outlineWidth) {
// Only init once per component across all threads so the cache stays accurate. Map<Fluid, List<CachableRenderStatement>> cache0 = cache.get(component);
Map<Fluid, List<CachableRenderStatement>> cache0 = cache if (cache0 == null) {
.computeIfAbsent(component, _k -> new ConcurrentHashMap<>()); cache0 = new HashMap<Fluid, List<CachableRenderStatement>>();
// The rest of this function 'should' be in a `computeIfAbsent` as well for: cache.put(component, cache0);
// `cache0.computeIfAbsent(fluid, _k -> ...)` but that won't cause a bug in this case, }
// just a bit more garbage.
List<CachableRenderStatement> data = cache0.get(fluid); List<CachableRenderStatement> data = cache0.get(fluid);
if (data != null) { if (data != null) {
return data; return data;
} }
data = new ArrayList<>(); data = new ArrayList<CachableRenderStatement>();
cache0.put(fluid, data);
IIcon texture = fluid.getStillIcon(); IIcon texture = fluid.getStillIcon();
if (texture == null) { if (texture == null) {
texture = fluid.getIcon(); texture = fluid.getIcon();
if (texture == null) { if (texture == null) {
cache0.put(fluid, data);
return data; return data;
} }
} }
@@ -208,7 +192,6 @@ public class LiquidConduitRenderer extends DefaultConduitRenderer implements IRe
} }
} }
} }
cache0.put(fluid, data);
return data; return data;
} }
@@ -256,6 +239,49 @@ public class LiquidConduitRenderer extends DefaultConduitRenderer implements IRe
// done in the dynamic section // done in the dynamic section
} }
@Override
public boolean isDynamic() {
return true;
}
@Override
public void renderDynamicEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit,
double x, double y, double z, float partialTick, float worldLight) {
if (((LiquidConduit) conduit).getTank().getFilledRatio() <= 0) {
return;
}
Collection<CollidableComponent> components = conduit.getCollidableComponents();
Tessellator tessellator = Tessellator.instance;
calculateRatios((LiquidConduit) conduit);
transmissionScaleFactor = conduit.getTransmitionGeometryScale();
IIcon tex;
for (CollidableComponent component : components) {
if (renderComponent(component)) {
if (isNSEWUD(component.dir) && conduit.getTransmitionTextureForState(component) != null) {
tessellator.setColorOpaque_F(1, 1, 1);
tex = conduit.getTransmitionTextureForState(component);
BoundingBox[] cubes = toCubes(component.bound);
for (BoundingBox cube : cubes) {
drawSection(
cube,
tex.getMinU(),
tex.getMaxU(),
tex.getMinV(),
tex.getMaxV(),
component.dir,
true);
}
}
}
}
}
@Override @Override
protected void setVerticesForTransmission(BoundingBox bound, ForgeDirection id) { protected void setVerticesForTransmission(BoundingBox bound, ForgeDirection id) {
@@ -1,57 +0,0 @@
package crazypants.enderio.conduit.liquid;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import com.enderio.core.client.render.IconUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class PrismaticNaquadahEnderLiquidConduit extends AbstractEnderLiquidConduit {
public static final Type TYPE = Type.PRISMATIC_NAQUADAH;
public static final int METADATA = 7;
public static final String ICON_KEY = "enderio:liquidConduitPrismaticNaquadahEnder";
public static final String ICON_CORE_KEY = "enderio:liquidConduitCorePrismaticNaquadahEnder";
static IIcon iconKey;
static IIcon iconCoreKey;
@SideOnly(Side.CLIENT)
public static void initIcons() {
IconUtil.addIconProvider(new IconUtil.IIconProvider() {
@Override
public void registerIcons(IIconRegister register) {
iconKey = register.registerIcon(ICON_KEY);
iconCoreKey = register.registerIcon(ICON_CORE_KEY);
}
@Override
public int getTextureType() {
return 0;
}
});
}
@Override
public Type getType() {
return TYPE;
}
@Override
public int getMetadata() {
return METADATA;
}
@Override
protected IIcon getIconKey() {
return iconKey;
}
@Override
protected IIcon getIconCoreKey() {
return iconCoreKey;
}
}
@@ -1,57 +0,0 @@
package crazypants.enderio.conduit.liquid;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import com.enderio.core.client.render.IconUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class TranscendentEnderLiquidConduit extends AbstractEnderLiquidConduit {
public static final Type TYPE = Type.TRANSCENDENT;
public static final int METADATA = 9;
public static final String ICON_KEY = "enderio:liquidConduitTranscendentEnder";
public static final String ICON_CORE_KEY = "enderio:liquidConduitCoreTranscendentEnder";
static IIcon iconKey;
static IIcon iconCoreKey;
@SideOnly(Side.CLIENT)
public static void initIcons() {
IconUtil.addIconProvider(new IconUtil.IIconProvider() {
@Override
public void registerIcons(IIconRegister register) {
iconKey = register.registerIcon(ICON_KEY);
iconCoreKey = register.registerIcon(ICON_CORE_KEY);
}
@Override
public int getTextureType() {
return 0;
}
});
}
@Override
public Type getType() {
return TYPE;
}
@Override
public int getMetadata() {
return METADATA;
}
@Override
protected IIcon getIconKey() {
return iconKey;
}
@Override
protected IIcon getIconCoreKey() {
return iconCoreKey;
}
}
@@ -14,5 +14,7 @@ public interface IMEConduit extends IConduit {
boolean isDense(); boolean isDense();
boolean isDenseUltra();
int getChannelsInUse(); int getChannelsInUse();
} }
@@ -13,9 +13,10 @@ import crazypants.enderio.gui.IconEIO;
public class ItemMEConduit extends AbstractItemConduit { public class ItemMEConduit extends AbstractItemConduit {
private static final ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] { private static ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
new ItemConduitSubtype(ModObject.itemMEConduit.name(), "enderio:itemMeConduit"), new ItemConduitSubtype(ModObject.itemMEConduit.name(), "enderio:itemMeConduit"),
new ItemConduitSubtype(ModObject.itemMEConduit.name() + "Dense", "enderio:itemMeConduitDense") }; new ItemConduitSubtype(ModObject.itemMEConduit.name() + "Dense", "enderio:itemMeConduitDense"),
new ItemConduitSubtype(ModObject.itemMEConduit.name() + "DenseUltra", "enderio:itemMeConduitDenseUltra") };
public static ItemMEConduit create() { public static ItemMEConduit create() {
ItemMEConduit result = new ItemMEConduit(); ItemMEConduit result = new ItemMEConduit();
@@ -16,6 +16,7 @@ import com.enderio.core.client.render.IconUtil;
import com.enderio.core.common.util.BlockCoord; import com.enderio.core.common.util.BlockCoord;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.networking.GridFlags;
import appeng.api.networking.IGridConnection; import appeng.api.networking.IGridConnection;
import appeng.api.networking.IGridHost; import appeng.api.networking.IGridHost;
import appeng.api.networking.IGridNode; import appeng.api.networking.IGridNode;
@@ -50,6 +51,7 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
public static IIcon[] longTextures; public static IIcon[] longTextures;
private boolean isDense; private boolean isDense;
private boolean isDenseUltra;
private int playerID = -1; private int playerID = -1;
public MEConduit() { public MEConduit() {
@@ -57,6 +59,7 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
} }
public MEConduit(int itemDamage) { public MEConduit(int itemDamage) {
isDenseUltra = itemDamage == 2;
isDense = itemDamage == 1; isDense = itemDamage == 1;
} }
@@ -65,14 +68,16 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
@Override @Override
public void registerIcons(IIconRegister register) { public void registerIcons(IIconRegister register) {
coreTextures = new IIcon[2]; coreTextures = new IIcon[3];
longTextures = new IIcon[2]; longTextures = new IIcon[3];
coreTextures[0] = register.registerIcon(EnderIO.DOMAIN + ":meConduitCore"); coreTextures[0] = register.registerIcon(EnderIO.DOMAIN + ":meConduitCore");
coreTextures[1] = register.registerIcon(EnderIO.DOMAIN + ":meConduitCoreDense"); coreTextures[1] = register.registerIcon(EnderIO.DOMAIN + ":meConduitCoreDense");
coreTextures[2] = register.registerIcon(EnderIO.DOMAIN + ":meConduitCoreDenseUltra");
longTextures[0] = register.registerIcon(EnderIO.DOMAIN + ":meConduit"); longTextures[0] = register.registerIcon(EnderIO.DOMAIN + ":meConduit");
longTextures[1] = register.registerIcon(EnderIO.DOMAIN + ":meConduitDense"); longTextures[1] = register.registerIcon(EnderIO.DOMAIN + ":meConduitDense");
longTextures[2] = register.registerIcon(EnderIO.DOMAIN + ":meConduitDenseUltra");
} }
@Override @Override
@@ -82,7 +87,10 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
}); });
} }
public static int getDamageForState(boolean isDense) { public static int getDamageForState(boolean isDense, boolean isDenseUltra) {
if (isDenseUltra) {
return 2;
}
if (isDense) { if (isDense) {
return 1; return 1;
} }
@@ -96,7 +104,7 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
@Override @Override
public ItemStack createItem() { public ItemStack createItem() {
return new ItemStack(EnderIO.itemMEConduit, 1, getDamageForState(isDense)); return new ItemStack(EnderIO.itemMEConduit, 1, getDamageForState(isDense, isDenseUltra));
} }
@Override @Override
@@ -114,6 +122,7 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
public void writeToNBT(NBTTagCompound nbtRoot) { public void writeToNBT(NBTTagCompound nbtRoot) {
super.writeToNBT(nbtRoot); super.writeToNBT(nbtRoot);
nbtRoot.setBoolean("isDense", isDense); nbtRoot.setBoolean("isDense", isDense);
nbtRoot.setBoolean("isDenseUltra", isDenseUltra);
nbtRoot.setInteger("playerID", playerID); nbtRoot.setInteger("playerID", playerID);
} }
@@ -126,6 +135,9 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
} else { } else {
playerID = -1; playerID = -1;
} }
if (nbtRoot.hasKey("isDenseUltra")) {
isDenseUltra = nbtRoot.getBoolean("isDenseUltra");
}
} }
public void setPlayerID(int playerID) { public void setPlayerID(int playerID) {
@@ -196,12 +208,22 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
@Method(modid = "appliedenergistics2") @Method(modid = "appliedenergistics2")
private Boolean canConnectToGridNode(IGridNode node, ForgeDirection dir) { private Boolean canConnectToGridNode(IGridNode node, ForgeDirection dir) {
return node.getGridBlock().getConnectableSides().contains(dir.getOpposite()); if (node.getGridBlock().getConnectableSides().contains(dir.getOpposite())) {
if (isDenseUltra()) {
return node.hasFlag(GridFlags.ULTRA_DENSE_CAPACITY)
|| ((node.hasFlag(GridFlags.DENSE_CAPACITY)) && !node.hasFlag(GridFlags.CANNOT_CARRY));
} else if (isDense()) {
return true;
} else {
return !node.hasFlag(GridFlags.ULTRA_DENSE_CAPACITY);
}
}
return false;
} }
@Override @Override
public IIcon getTextureForState(CollidableComponent component) { public IIcon getTextureForState(CollidableComponent component) {
int state = getDamageForState(isDense); int state = getDamageForState(isDense, isDenseUltra);
if (component.dir == ForgeDirection.UNKNOWN) { if (component.dir == ForgeDirection.UNKNOWN) {
return coreTextures[state]; return coreTextures[state];
} else { } else {
@@ -378,4 +400,9 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
public boolean isDense() { public boolean isDense() {
return isDense; return isDense;
} }
@Override
public boolean isDenseUltra() {
return isDenseUltra;
}
} }
@@ -43,6 +43,9 @@ public class MEConduitGrid implements IGridBlock {
@Override @Override
public EnumSet<GridFlags> getFlags() { public EnumSet<GridFlags> getFlags() {
if (conduit.isDenseUltra()) {
return EnumSet.of(GridFlags.ULTRA_DENSE_CAPACITY);
}
if (conduit.isDense()) { if (conduit.isDense()) {
return EnumSet.of(GridFlags.DENSE_CAPACITY); return EnumSet.of(GridFlags.DENSE_CAPACITY);
} }
@@ -12,7 +12,7 @@ import crazypants.enderio.gui.IconEIO;
public class ItemOCConduit extends AbstractItemConduit { public class ItemOCConduit extends AbstractItemConduit {
private static final ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] { private static ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
new ItemConduitSubtype(ModObject.itemOCConduit.name(), "enderio:itemOCConduit") }; new ItemConduitSubtype(ModObject.itemOCConduit.name(), "enderio:itemOCConduit") };
public static ItemOCConduit create() { public static ItemOCConduit create() {
@@ -15,9 +15,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
@@ -51,7 +49,7 @@ public class OCConduit extends AbstractConduit implements IOCConduit {
protected OCConduitNetwork network; protected OCConduitNetwork network;
private final Map<ForgeDirection, DyeColor> signalColors = new HashMap<>(); private Map<ForgeDirection, DyeColor> signalColors = new HashMap<ForgeDirection, DyeColor>();
public static IIcon[] coreTextures; public static IIcon[] coreTextures;
public static IIcon[] longTextures; public static IIcon[] longTextures;
@@ -88,7 +86,7 @@ public class OCConduit extends AbstractConduit implements IOCConduit {
@Override @Override
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) { protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
setSignalColor(dir, DyeColor.VALUES[dataRoot.getShort("signalColor")]); setSignalColor(dir, DyeColor.values()[dataRoot.getShort("signalColor")]);
} }
@Override @Override
@@ -115,7 +113,7 @@ public class OCConduit extends AbstractConduit implements IOCConduit {
BoundingBox bb = ConduitGeometryUtil.instance.createBoundsForConnectionController(key.dir, key.offset); BoundingBox bb = ConduitGeometryUtil.instance.createBoundsForConnectionController(key.dir, key.offset);
CollidableComponent cc = new CollidableComponent(IOCConduit.class, bb, key.dir, COLOR_CONTROLLER_ID); CollidableComponent cc = new CollidableComponent(IOCConduit.class, bb, key.dir, COLOR_CONTROLLER_ID);
List<CollidableComponent> result = new ArrayList<>(); List<CollidableComponent> result = new ArrayList<CollidableComponent>();
result.addAll(baseCollidables); result.addAll(baseCollidables);
result.add(cc); result.add(cc);
@@ -150,7 +148,7 @@ public class OCConduit extends AbstractConduit implements IOCConduit {
int i = 0; int i = 0;
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
if (cols[i] >= 0) { if (cols[i] >= 0) {
signalColors.put(dir, DyeColor.VALUES[cols[i]]); signalColors.put(dir, DyeColor.values()[cols[i]]);
} }
i++; i++;
} }
@@ -215,20 +213,14 @@ public class OCConduit extends AbstractConduit implements IOCConduit {
return null; return null;
} }
private static IChatComponent prettyNode(Node o) { private static String prettyNode(Node o) {
String at = "";
Environment host = o.host(); Environment host = o.host();
String name = host.getClass().getName().replaceFirst("^.*\\.", "");
if (host instanceof TileEntity) { if (host instanceof TileEntity) {
return new ChatComponentTranslation( BlockCoord bc = new BlockCoord((TileEntity) host);
EnderIO.lang.addPrefix("itemOCConduit.chat.nodeAt"), at = " at " + bc.x + "/" + bc.y + "/" + bc.z;
name,
coords(new BlockCoord((TileEntity) host)));
} }
return new ChatComponentText(name); return host.getClass().getName().replaceFirst("^.*\\.", "") + at;
}
private static String coords(BlockCoord bc) {
return bc.x + "/" + bc.y + "/" + bc.z;
} }
private static EnumChatFormatting dye2chat(DyeColor dyeColor) { private static EnumChatFormatting dye2chat(DyeColor dyeColor) {
@@ -282,37 +274,26 @@ public class OCConduit extends AbstractConduit implements IOCConduit {
BlockCoord bc = getLocation(); BlockCoord bc = getLocation();
if (network != null) { if (network != null) {
boolean noconnections = true; boolean noconnections = true;
for (DyeColor color : DyeColor.VALUES) { for (DyeColor color : DyeColor.values()) {
if (node(color).neighbors().iterator().hasNext()) { if (node(color).neighbors().iterator().hasNext()) {
noconnections = false; noconnections = false;
ChatComponentTranslation coltxt = new ChatComponentTranslation( ChatComponentText coltxt = new ChatComponentText(color.getLocalisedName());
DyeColor.DYE_ORE_UNLOCAL_NAMES[color.ordinal()]);
coltxt.getChatStyle().setColor(dye2chat(color)); coltxt.getChatStyle().setColor(dye2chat(color));
player.addChatMessage( ChatComponentText chantxt = new ChatComponentText("Channel ");
new ChatComponentTranslation( chantxt.appendSibling(coltxt);
EnderIO.lang.addPrefix("itemOCConduit.chat.channel"), chantxt.appendText(" at " + bc.x + "/" + bc.y + "/" + bc.z);
coltxt, player.addChatMessage(chantxt);
coords(bc)));
for (Node other : node(color).neighbors()) { for (Node other : node(color).neighbors()) {
player.addChatMessage( player.addChatMessage(new ChatComponentText(" Connected to: " + prettyNode(other)));
new ChatComponentText(" ").appendSibling(
new ChatComponentTranslation(
EnderIO.lang.addPrefix("itemOCConduit.chat.connectedTo"),
prettyNode(other))));
} }
} }
} }
if (noconnections) { if (noconnections) {
player.addChatMessage( player.addChatMessage(
new ChatComponentTranslation( new ChatComponentText("No connections at " + bc.x + "/" + bc.y + "/" + bc.z));
EnderIO.lang.addPrefix("itemOCConduit.chat.noConnections"),
coords(bc)));
} }
} else { } else {
player.addChatMessage( player.addChatMessage(new ChatComponentText("No network at " + bc.x + "/" + bc.y + "/" + bc.z));
new ChatComponentTranslation(
EnderIO.lang.addPrefix("itemOCConduit.chat.noNetwork"),
coords(bc)));
} }
} }
return true; return true;
@@ -369,8 +350,8 @@ public class OCConduit extends AbstractConduit implements IOCConduit {
if (loc != null && network != null) { if (loc != null && network != null) {
World world = getBundle().getWorld(); World world = getBundle().getWorld();
EnumSet<ForgeDirection> conns = getConnections(); EnumSet<ForgeDirection> conns = getConnections();
for (DyeColor color : DyeColor.VALUES) { for (DyeColor color : DyeColor.values()) {
Set<Node> should = new HashSet<>(); Set<Node> should = new HashSet<Node>();
for (ForgeDirection direction : conns) { for (ForgeDirection direction : conns) {
if (getSignalColor(direction) == color) { if (getSignalColor(direction) == color) {
TileEntity te = getLocation().getLocation(direction).getTileEntity(world); TileEntity te = getLocation().getLocation(direction).getTileEntity(world);
@@ -436,7 +417,7 @@ public class OCConduit extends AbstractConduit implements IOCConduit {
// we need to check if that node has another way of connecting to our // we need to check if that node has another way of connecting to our
// network. First find out which of our neighbor(s) it belongs to. May // network. First find out which of our neighbor(s) it belongs to. May
// be just one, may be many. // be just one, may be many.
List<TileEntity> toCheck = new ArrayList<>(); List<TileEntity> toCheck = new ArrayList<TileEntity>();
if (otherHost instanceof TileEntity) { if (otherHost instanceof TileEntity) {
TileEntity otherTe = (TileEntity) otherHost; TileEntity otherTe = (TileEntity) otherHost;
toCheck.add(otherTe); toCheck.add(otherTe);
@@ -16,11 +16,11 @@ import li.cil.oc.api.network.Visibility;
@Interface(iface = "li.cil.oc.api.network.ManagedEnvironment", modid = "OpenComputersAPI|Network") @Interface(iface = "li.cil.oc.api.network.ManagedEnvironment", modid = "OpenComputersAPI|Network")
public class OCConduitNetwork extends AbstractConduitNetwork<IOCConduit, IOCConduit> implements ManagedEnvironment { public class OCConduitNetwork extends AbstractConduitNetwork<IOCConduit, IOCConduit> implements ManagedEnvironment {
private final Node[] node = new Node[DyeColor.VALUES.length]; private Node[] node = new Node[DyeColor.values().length];
public OCConduitNetwork() { public OCConduitNetwork() {
super(IOCConduit.class, IOCConduit.class); super(IOCConduit.class, IOCConduit.class);
for (DyeColor dyeColor : DyeColor.VALUES) { for (DyeColor dyeColor : DyeColor.values()) {
node[dyeColor.ordinal()] = Network.newNode(this, Visibility.Network).create(); node[dyeColor.ordinal()] = Network.newNode(this, Visibility.Network).create();
Network.joinNewNetwork(node[dyeColor.ordinal()]); Network.joinNewNetwork(node[dyeColor.ordinal()]);
} }
@@ -68,7 +68,7 @@ public class OCConduitNetwork extends AbstractConduitNetwork<IOCConduit, IOCCond
@Override @Override
public void destroyNetwork() { public void destroyNetwork() {
for (DyeColor dyeColor : DyeColor.VALUES) { for (DyeColor dyeColor : DyeColor.values()) {
node[dyeColor.ordinal()].remove(); node[dyeColor.ordinal()].remove();
} }
super.destroyNetwork(); super.destroyNetwork();
@@ -8,7 +8,6 @@ import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import crazypants.enderio.conduit.ConnectionMode; import crazypants.enderio.conduit.ConnectionMode;
import crazypants.enderio.conduit.IConduit; import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit; import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit;
import crazypants.util.ForgeDirections;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public class PacketConnectionMode extends AbstractConduitPacket<IConduit> public class PacketConnectionMode extends AbstractConduitPacket<IConduit>
@@ -35,8 +34,8 @@ public class PacketConnectionMode extends AbstractConduitPacket<IConduit>
@Override @Override
public void fromBytes(ByteBuf buf) { public void fromBytes(ByteBuf buf) {
super.fromBytes(buf); super.fromBytes(buf);
dir = ForgeDirections.DIRECTIONS[buf.readShort()]; dir = ForgeDirection.values()[buf.readShort()];
mode = ConnectionMode.VALUES[buf.readShort()]; mode = ConnectionMode.values()[buf.readShort()];
} }
@Override @Override
@@ -9,7 +9,6 @@ import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import crazypants.enderio.conduit.IExtractor; import crazypants.enderio.conduit.IExtractor;
import crazypants.enderio.machine.RedstoneControlMode; import crazypants.enderio.machine.RedstoneControlMode;
import crazypants.util.ForgeDirections;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public class PacketExtractMode extends AbstractConduitPacket<IExtractor> public class PacketExtractMode extends AbstractConduitPacket<IExtractor>
@@ -39,9 +38,9 @@ public class PacketExtractMode extends AbstractConduitPacket<IExtractor>
@Override @Override
public void fromBytes(ByteBuf buf) { public void fromBytes(ByteBuf buf) {
super.fromBytes(buf); super.fromBytes(buf);
dir = ForgeDirections.DIRECTIONS[buf.readShort()]; dir = ForgeDirection.values()[buf.readShort()];
mode = RedstoneControlMode.VALUES[buf.readShort()]; mode = RedstoneControlMode.values()[buf.readShort()];
color = DyeColor.VALUES[buf.readShort()]; color = DyeColor.values()[buf.readShort()];
} }
@Override @Override
@@ -10,7 +10,6 @@ import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import crazypants.enderio.conduit.item.FilterRegister; import crazypants.enderio.conduit.item.FilterRegister;
import crazypants.enderio.conduit.item.IItemConduit; import crazypants.enderio.conduit.item.IItemConduit;
import crazypants.enderio.conduit.item.filter.IItemFilter; import crazypants.enderio.conduit.item.filter.IItemFilter;
import crazypants.util.ForgeDirections;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public class PacketItemConduitFilter extends AbstractConduitPacket<IItemConduit> public class PacketItemConduitFilter extends AbstractConduitPacket<IItemConduit>
@@ -57,12 +56,12 @@ public class PacketItemConduitFilter extends AbstractConduitPacket<IItemConduit>
@Override @Override
public void fromBytes(ByteBuf buf) { public void fromBytes(ByteBuf buf) {
super.fromBytes(buf); super.fromBytes(buf);
dir = ForgeDirections.DIRECTIONS[buf.readShort()]; dir = ForgeDirection.values()[buf.readShort()];
loopMode = buf.readBoolean(); loopMode = buf.readBoolean();
roundRobin = buf.readBoolean(); roundRobin = buf.readBoolean();
priority = buf.readInt(); priority = buf.readInt();
colIn = DyeColor.VALUES[buf.readShort()]; colIn = DyeColor.values()[buf.readShort()];
colOut = DyeColor.VALUES[buf.readShort()]; colOut = DyeColor.values()[buf.readShort()];
inputFilter = FilterRegister.readFilter(buf); inputFilter = FilterRegister.readFilter(buf);
outputFilter = FilterRegister.readFilter(buf); outputFilter = FilterRegister.readFilter(buf);
} }
@@ -8,7 +8,6 @@ import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import crazypants.enderio.conduit.oc.IOCConduit; import crazypants.enderio.conduit.oc.IOCConduit;
import crazypants.util.ForgeDirections;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public class PacketOCConduitSignalColor extends AbstractConduitPacket<IOCConduit> public class PacketOCConduitSignalColor extends AbstractConduitPacket<IOCConduit>
@@ -35,8 +34,8 @@ public class PacketOCConduitSignalColor extends AbstractConduitPacket<IOCConduit
@Override @Override
public void fromBytes(ByteBuf buf) { public void fromBytes(ByteBuf buf) {
super.fromBytes(buf); super.fromBytes(buf);
dir = ForgeDirections.DIRECTIONS[buf.readShort()]; dir = ForgeDirection.values()[buf.readShort()];
col = DyeColor.VALUES[buf.readShort()]; col = DyeColor.values()[buf.readShort()];
} }
@Override @Override
@@ -6,7 +6,6 @@ import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit; import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit;
import crazypants.util.ForgeDirections;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public class PacketRedstoneConduitOutputStrength extends AbstractConduitPacket<IInsulatedRedstoneConduit> public class PacketRedstoneConduitOutputStrength extends AbstractConduitPacket<IInsulatedRedstoneConduit>
@@ -33,7 +32,7 @@ public class PacketRedstoneConduitOutputStrength extends AbstractConduitPacket<I
@Override @Override
public void fromBytes(ByteBuf buf) { public void fromBytes(ByteBuf buf) {
super.fromBytes(buf); super.fromBytes(buf);
dir = ForgeDirections.DIRECTIONS[buf.readShort()]; dir = ForgeDirection.values()[buf.readShort()];
isStrong = buf.readBoolean(); isStrong = buf.readBoolean();
} }
@@ -8,7 +8,6 @@ import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit; import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit;
import crazypants.util.ForgeDirections;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public class PacketRedstoneConduitSignalColor extends AbstractConduitPacket<IInsulatedRedstoneConduit> public class PacketRedstoneConduitSignalColor extends AbstractConduitPacket<IInsulatedRedstoneConduit>
@@ -35,8 +34,8 @@ public class PacketRedstoneConduitSignalColor extends AbstractConduitPacket<IIns
@Override @Override
public void fromBytes(ByteBuf buf) { public void fromBytes(ByteBuf buf) {
super.fromBytes(buf); super.fromBytes(buf);
dir = ForgeDirections.DIRECTIONS[buf.readShort()]; dir = ForgeDirection.values()[buf.readShort()];
col = DyeColor.VALUES[buf.readShort()]; col = DyeColor.values()[buf.readShort()];
} }
@Override @Override
Loaded 100 of 1285 files, more files were not shown because too many files have changed in this diff. Show more