mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-14 17:14:50 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
749ea96c62 | ||
|
|
f4dfa9e6cf | ||
|
|
30958c201a | ||
|
|
8ead31ff76 | ||
|
|
7bebb05573 | ||
|
|
87e5a32b89 | ||
|
|
c232ea8534 | ||
|
|
d27f30951a | ||
|
|
8dcda4e822 | ||
|
|
e337597a3c | ||
|
|
a8197e0026 | ||
|
|
9549d9385c | ||
|
|
d44c6bb7c7 | ||
|
|
a4a40ee726 | ||
|
|
caec163702 | ||
|
|
673f832c2d | ||
|
|
ce11a2dcf2 | ||
|
|
68e209203c | ||
|
|
0715f8b536 | ||
|
|
d356dddedb | ||
|
|
604b47a394 | ||
|
|
42dc1f43aa | ||
|
|
cbeec42e47 | ||
|
|
046ad7441d | ||
|
|
8750005be5 | ||
|
|
b46cfbb351 | ||
|
|
070ef99694 | ||
|
|
fec675ef48 | ||
|
|
503b90a5d0 | ||
|
|
84052a1c42 | ||
|
|
554a08a515 | ||
|
|
55928c5234 | ||
|
|
65c5d3aec5 | ||
|
|
7737598e4f | ||
|
|
eb9845d3a0 | ||
|
|
7a61bb9dee | ||
|
|
ed24e1e1f0 | ||
|
|
76e50f8a32 | ||
|
|
5b8810633b | ||
|
|
48e30828cf | ||
|
|
924b4dbbf2 | ||
|
|
b5a2693d7c | ||
|
|
372c317077 | ||
|
|
44ee860a39 | ||
|
|
181d48ac60 | ||
|
|
267adc0a31 | ||
|
|
503a6e7a76 | ||
|
|
ff0e85142d | ||
|
|
94bd521739 | ||
|
|
e66c50bc24 | ||
|
|
d9df657f35 | ||
|
|
08553f8af2 | ||
|
|
0fe564d007 | ||
|
|
53ba0383fb | ||
|
|
2c5664ce08 | ||
|
|
da70f52b0d | ||
|
|
46644bc889 | ||
|
|
f615df5010 | ||
|
|
73891d20ff | ||
|
|
e21793245f | ||
|
|
ffe4296ef6 | ||
|
|
5083fb2a60 | ||
|
|
05ee12955d | ||
|
|
a7acc7e224 | ||
|
|
a59bb21e59 | ||
|
|
5b6c13ff0a | ||
|
|
6f8b6e2a9c | ||
|
|
479c8328b4 | ||
|
|
0c23f4937d | ||
|
|
cde2e4fa60 | ||
|
|
abbb6dc151 | ||
|
|
b3def82cde | ||
|
|
8b4e7f7ec3 | ||
|
|
d69d77ecae | ||
|
|
a233f6ba30 | ||
|
|
581150178f | ||
|
|
313a243bf5 | ||
|
|
d5f1008b08 | ||
|
|
e1e1f06dc6 |
No files matched your search
@@ -3,9 +3,9 @@ name: Build and test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, main ]
|
||||
branches: [ master, main, release/** ]
|
||||
push:
|
||||
branches: [ master, main ]
|
||||
branches: [ master, main, release/** ]
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
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
|
||||
@@ -28,3 +28,4 @@ whitelist.json
|
||||
src/main/resources/mixins.*.json
|
||||
*.bat
|
||||
layout.json
|
||||
.DS_Store
|
||||
+22
-17
@@ -1,30 +1,35 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:EnderCore:0.4.8:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.10.11:dev')
|
||||
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.7.52-GTNH:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.6.31:dev")
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.43:dev')
|
||||
api('com.github.GTNewHorizons:EnderCore:0.5.15:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.37:dev')
|
||||
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.8.130-GTNH:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.11.45:dev")
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.63:dev')
|
||||
api('curse.maven:cofh-lib-220333:2388748') // https://www.curseforge.com/minecraft/mc-mods/cofh-lib/files/2388748
|
||||
shadowImplementation('cglib:cglib-nodep:3.3.0')
|
||||
api("com.github.GTNewHorizons:TinkersConstruct:1.13.35-GTNH:dev")
|
||||
api("com.github.GTNewHorizons:TinkersConstruct:1.14.107-GTNH:dev")
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.8.7:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-632-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Baubles:1.0.4:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.339:dev') {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:ModularUI2:2.2.15-1.7.10:dev") {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.16.30:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.1.2-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Chisel:2.16.4-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.16-GTNH:api') {transitive = false}
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:waila:1.19.34:dev') {transitive = false}
|
||||
compileOnly('ganymedes01.etfuturum:Et-Futurum-Requiem:2.6.48-GTNH:dev') {transitive = false}
|
||||
runtimeOnlyNonPublishable('com.github.GTNewHorizons:WAILAPlugins:0.7.2:dev') {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:Backhand:1.8.14:dev") { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-999-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.22-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.54.129:dev') {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('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
compileOnly('curse.maven:ee3-65509:2305023') // https://www.curseforge.com/minecraft/mc-mods/ee3/files/2305023
|
||||
compileOnly(rfg.deobf('curse.maven:computercraft-67504:2269339')) // https://www.curseforge.com/minecraft/mc-mods/computercraft/files/2269339
|
||||
compileOnly(rfg.deobf('curse.maven:mekanism-268560:2475797')) // https://www.curseforge.com/minecraft/mc-mods/mekanism/files/2475797
|
||||
compileOnly(rfg.deobf('maven.modrinth:immibis-microblocks:59.1.2')) // https://modrinth.com/mod/immibis-microblocks/version/59.1.2
|
||||
|
||||
compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-beta46:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:BetterBuildersWands:0.13.12-GTNH:dev@jar')
|
||||
compileOnlyApi('com.github.GTNewHorizons:Angelica:2.2.10:api') {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.7.196:dev")
|
||||
compileOnly('curse.maven:automagy-222153:2285272')
|
||||
}
|
||||
+40
-5
@@ -39,9 +39,33 @@ remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/co
|
||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||
developmentEnvironmentUserName = Developer
|
||||
|
||||
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
||||
# See https://github.com/bsideup/jabel for details on how this works.
|
||||
enableModernJavaSyntax = true
|
||||
# Enables modern Java syntax support. Valid values:
|
||||
# - false: No modern syntax, Java 8 only
|
||||
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
|
||||
# - 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.
|
||||
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||
@@ -96,7 +120,9 @@ usesMixinDebug = false
|
||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||
mixinPlugin =
|
||||
|
||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||
# Specify the package that contains all of your Mixins. The package must exist or
|
||||
# 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 =
|
||||
|
||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||
@@ -151,7 +177,7 @@ modrinthProjectId =
|
||||
# type can be one of [project, version],
|
||||
# and the name is the Modrinth project or version slug/id of the other mod.
|
||||
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
|
||||
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
||||
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||
modrinthRelations =
|
||||
|
||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||
@@ -172,6 +198,12 @@ curseForgeRelations =
|
||||
# projects. New projects should not use this parameter.
|
||||
# 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.
|
||||
# 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.
|
||||
@@ -201,3 +233,6 @@ curseForgeRelations =
|
||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||
# ideaCheckSpotlessOnBuild = true
|
||||
|
||||
# Non-GTNH properties
|
||||
org.gradle.configuration-cache = true
|
||||
org.gradle.parallel = true
|
||||
@@ -0,0 +1,12 @@
|
||||
#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
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -57,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -114,7 +114,6 @@ case "$( uname )" in #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@@ -172,7 +171,6 @@ fi
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
@@ -212,8 +210,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
|
||||
Vendored
+1
-2
@@ -70,11 +70,10 @@ goto fail
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.38'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.29'
|
||||
}
|
||||
|
||||
|
||||
@@ -238,6 +238,8 @@ public class ClientProxy extends CommonProxy {
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockPainter), machRen);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCrafter), 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());
|
||||
|
||||
@@ -256,13 +258,15 @@ public class ClientProxy extends CommonProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileFarmStation.class, new FarmingStationSpecialRenderer());
|
||||
|
||||
BlockSoulBinder.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new SoulBinderRenderer());
|
||||
SoulBinderRenderer soulBinderRenderer = new SoulBinderRenderer();
|
||||
RenderingRegistry.registerBlockHandler(soulBinderRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockSoulFuser), soulBinderRenderer);
|
||||
|
||||
ObeliskRenderer defaultObeliskRenderer = new ObeliskRenderer();
|
||||
BlockObeliskAbstract.defaultObeliskRenderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(defaultObeliskRenderer);
|
||||
|
||||
ObeliskSpecialRenderer<TileAttractor> attRen = new ObeliskSpecialRenderer<TileAttractor>(
|
||||
ObeliskSpecialRenderer<TileAttractor> attRen = new ObeliskSpecialRenderer<>(
|
||||
new ItemStack(EnderIO.itemMaterial, 1, Material.ATTRACTOR_CRYSTAL.ordinal()),
|
||||
defaultObeliskRenderer);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileAttractor.class, attRen);
|
||||
@@ -272,7 +276,7 @@ public class ClientProxy extends CommonProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileAversionObelisk.class, sgr);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockSpawnGuard), sgr);
|
||||
|
||||
ObeliskSpecialRenderer<TileExperienceObelisk> eor = new ObeliskSpecialRenderer<TileExperienceObelisk>(
|
||||
ObeliskSpecialRenderer<TileExperienceObelisk> eor = new ObeliskSpecialRenderer<>(
|
||||
new ItemStack(EnderIO.itemXpTransfer),
|
||||
defaultObeliskRenderer);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileExperienceObelisk.class, eor);
|
||||
@@ -285,7 +289,7 @@ public class ClientProxy extends CommonProxy {
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockWeatherObelisk), twr);
|
||||
|
||||
BlockCombustionGenerator.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
TechneMachineRenderer<TileCombustionGenerator> cr = new TechneMachineRenderer<TileCombustionGenerator>(
|
||||
TechneMachineRenderer<TileCombustionGenerator> cr = new TechneMachineRenderer<>(
|
||||
EnderIO.blockCombustionGenerator,
|
||||
"models/combustionGen");
|
||||
RenderingRegistry.registerBlockHandler(cr);
|
||||
@@ -301,7 +305,7 @@ public class ClientProxy extends CommonProxy {
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockKillerJoe), kjr);
|
||||
|
||||
BlockVat.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
TechneMachineRenderer<TileVat> vr = new TechneMachineRenderer<TileVat>(EnderIO.blockVat, "models/vat");
|
||||
TechneMachineRenderer<TileVat> vr = new TechneMachineRenderer<>(EnderIO.blockVat, "models/vat");
|
||||
RenderingRegistry.registerBlockHandler(vr);
|
||||
|
||||
FusedQuartzFrameRenderer fqfr = new FusedQuartzFrameRenderer();
|
||||
@@ -360,6 +364,7 @@ public class ClientProxy extends CommonProxy {
|
||||
TelePadRenderer telePadRenderer = new TelePadRenderer();
|
||||
RenderingRegistry.registerBlockHandler(telePadRenderer);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileTelePad.class, new TelePadSpecialRenderer(telePadRenderer));
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockTelePad), telePadRenderer);
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(EnderIO.itemMachinePart, new MachinePartRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(EnderIO.itemConduitFacade, new FacadeRenderer());
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package crazypants.enderio;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
@@ -9,20 +7,27 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
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.gameevent.TickEvent.ClientTickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent;
|
||||
import crazypants.enderio.conduit.ConduitNetworkTickHandler;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
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 {
|
||||
|
||||
private static final DecimalFormat FORMAT = new DecimalFormat("########0.000");
|
||||
|
||||
protected long serverTickCount = 0;
|
||||
protected long clientTickCount = 0;
|
||||
protected final TickTimer tickTimer = new TickTimer();
|
||||
public ConduitNetworkTickHandler conduitNetworkTickHandler = null;
|
||||
public WirelessChargerController wirelessChargerController = null;
|
||||
|
||||
public CommonProxy() {}
|
||||
|
||||
@@ -44,7 +49,7 @@ public class CommonProxy {
|
||||
}
|
||||
|
||||
public void loadIcons() {
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
public void load() {
|
||||
@@ -76,6 +81,26 @@ public class CommonProxy {
|
||||
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 {
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -38,6 +38,7 @@ import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
|
||||
import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
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.FMLServerStoppedEvent;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -46,6 +47,7 @@ import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import crazypants.enderio.api.IMC;
|
||||
import crazypants.enderio.betterbuilderswands.PaintedCustomMapping;
|
||||
import crazypants.enderio.block.BlockDarkSteelAnvil;
|
||||
import crazypants.enderio.block.BlockDarkSteelLadder;
|
||||
import crazypants.enderio.block.BlockDarkSteelPressurePlate;
|
||||
@@ -111,7 +113,6 @@ import crazypants.enderio.machine.generator.zombie.BlockZombieGenerator.BlockEnd
|
||||
import crazypants.enderio.machine.generator.zombie.BlockZombieGenerator.BlockFrankenZombieGenerator;
|
||||
import crazypants.enderio.machine.generator.zombie.PacketNutrientTank;
|
||||
import crazypants.enderio.machine.hypercube.BlockHyperCube;
|
||||
import crazypants.enderio.machine.hypercube.HyperCubeRegister;
|
||||
import crazypants.enderio.machine.invpanel.BlockInventoryPanel;
|
||||
import crazypants.enderio.machine.killera.BlockKillerJoe;
|
||||
import crazypants.enderio.machine.light.BlockElectricLight;
|
||||
@@ -184,14 +185,14 @@ import crazypants.util.EE3Util;
|
||||
@Mod(modid = MODID, name = MOD_NAME, version = VERSION, dependencies = """
|
||||
required-after:CoFHLib@[1.7.10R1.0.3B3,);\
|
||||
required-after:endercore;\
|
||||
required-after:gtnhlib@[0.2.10,);\
|
||||
required-after:gtnhlib@[0.9.47,);\
|
||||
after:MineFactoryReloaded;\
|
||||
after:Forestry;\
|
||||
after:Waila@[1.5.8,);\
|
||||
after:Thaumcraft;\
|
||||
after:appliedenergistics2@[rv2-beta-8,);\
|
||||
after:chisel;\
|
||||
after:Railcraft@[9.16.7,)\
|
||||
after:Railcraft@[9.16.7,);\
|
||||
after:betterbuilderswands@[0.13.12,)\
|
||||
""", guiFactory = "crazypants.enderio.config.ConfigFactoryEIO")
|
||||
public class EnderIO {
|
||||
|
||||
@@ -214,6 +215,10 @@ public class EnderIO {
|
||||
|
||||
public static final boolean hasLwjgl3 = Loader.isModLoaded("lwjgl3ify");
|
||||
public static final boolean hasGT5 = Loader.isModLoaded("gregtech") && !Loader.isModLoaded("gregapi");
|
||||
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");
|
||||
|
||||
// Materials
|
||||
public static ItemCapacitor itemBasicCapacitor;
|
||||
@@ -487,7 +492,9 @@ public class EnderIO {
|
||||
itemGrindingBall = ItemGrindingBall.create();
|
||||
itemAlloyEndergy = ItemAlloyEndergy.create();
|
||||
itemGrindingBallEndergy = ItemGrindingBallEndergy.create();
|
||||
itemPowderIngot = ItemPowderIngot.create();
|
||||
if (!hasGT5) {
|
||||
itemPowderIngot = ItemPowderIngot.create();
|
||||
}
|
||||
|
||||
registerFluids();
|
||||
|
||||
@@ -727,7 +734,9 @@ public class EnderIO {
|
||||
SkeletonHandler.registerSkeleton(this);
|
||||
}
|
||||
|
||||
MaterialRecipes.registerDependantOresInDictionary();
|
||||
if (!hasGT5) {
|
||||
MaterialRecipes.registerDependantOresInDictionary();
|
||||
}
|
||||
|
||||
EnderfaceRecipes.addRecipes();
|
||||
MaterialRecipes.addRecipes();
|
||||
@@ -832,6 +841,9 @@ public class EnderIO {
|
||||
Log.info("Failed to registered Capacitor Banks as Tinkers Construct Flux Upgrades");
|
||||
}
|
||||
}
|
||||
if (Loader.isModLoaded("betterbuilderswands")) {
|
||||
PaintedCustomMapping.registerMappings();
|
||||
}
|
||||
|
||||
ThaumcraftCompat.load();
|
||||
}
|
||||
@@ -890,22 +902,18 @@ public class EnderIO {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStarted(FMLServerStartedEvent 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();
|
||||
}
|
||||
public void onServerAboutToStart(FMLServerAboutToStartEvent event) {
|
||||
proxy.onServerAboutToStart(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStopped(FMLServerStoppedEvent event) {
|
||||
HyperCubeRegister.unload();
|
||||
public void onServerStarted(FMLServerStartedEvent event) {
|
||||
proxy.onServerStarted(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onServerStopped(FMLServerStoppedEvent event) {
|
||||
proxy.onServerStopped(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -917,4 +925,12 @@ 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
|
||||
|
||||
protected final Map<Integer, IGuiHandler> guiHandlers = new HashMap<Integer, IGuiHandler>();
|
||||
protected final Map<Integer, IGuiHandler> guiHandlers = new HashMap<>();
|
||||
|
||||
public void registerGuiHandler(int id, IGuiHandler handler) {
|
||||
guiHandlers.put(id, handler);
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,12 +16,9 @@ import crazypants.enderio.config.Config;
|
||||
|
||||
public class ContainerDarkSteelAnvil extends ContainerRepair {
|
||||
|
||||
private int x, y, 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");
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int z;
|
||||
|
||||
public ContainerDarkSteelAnvil(InventoryPlayer playerInv, final World world, final int x, final int y, final int z,
|
||||
EntityPlayer player) {
|
||||
@@ -31,8 +28,12 @@ public class ContainerDarkSteelAnvil extends ContainerRepair {
|
||||
final int materialCost;
|
||||
|
||||
try {
|
||||
Field _outputSlot = ReflectionHelper.findField(ContainerRepair.class, "outputSlot", "field_82852_f");
|
||||
outputSlot = (IInventory) _outputSlot.get(this);
|
||||
Field _inputSlots = ReflectionHelper.findField(ContainerRepair.class, "inputSlots", "field_82853_g");
|
||||
inputSlots = (IInventory) _inputSlots.get(this);
|
||||
Field _materialCost = ReflectionHelper
|
||||
.findField(ContainerRepair.class, "materialCost", "stackSizeToBeUsedInRepair", "field_82856_l");
|
||||
materialCost = _materialCost.getInt(this);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
|
||||
@@ -47,6 +47,7 @@ import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
import crazypants.enderio.conduit.power.PowerConduitNetwork;
|
||||
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.RedstoneConduitNetwork;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import mods.immibis.microblocks.api.EnumPartClass;
|
||||
import mods.immibis.microblocks.api.EnumPosition;
|
||||
import mods.immibis.microblocks.api.IMicroblockCoverSystem;
|
||||
@@ -72,8 +73,7 @@ public abstract class AbstractConduit implements IConduit {
|
||||
|
||||
protected List<CollidableComponent> collidables;
|
||||
|
||||
protected final EnumMap<ForgeDirection, ConnectionMode> conectionModes = new EnumMap<ForgeDirection, ConnectionMode>(
|
||||
ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, ConnectionMode> conectionModes = new EnumMap<>(ForgeDirection.class);
|
||||
|
||||
protected boolean collidablesDirty = true;
|
||||
|
||||
@@ -118,7 +118,7 @@ public abstract class AbstractConduit implements IConduit {
|
||||
return false;
|
||||
}
|
||||
if (dataRoot.hasKey("connectionMode")) {
|
||||
ConnectionMode mode = ConnectionMode.values()[dataRoot.getShort("connectionMode")];
|
||||
ConnectionMode mode = ConnectionMode.VALUES[dataRoot.getShort("connectionMode")];
|
||||
setConnectionMode(dir, mode);
|
||||
}
|
||||
readTypeSettings(dir, dataRoot);
|
||||
@@ -382,13 +382,13 @@ public abstract class AbstractConduit implements IConduit {
|
||||
conduitConnections.clear();
|
||||
int[] dirs = nbtRoot.getIntArray("connections");
|
||||
for (int i = 0; i < dirs.length; i++) {
|
||||
conduitConnections.add(ForgeDirection.values()[dirs[i]]);
|
||||
conduitConnections.add(ForgeDirections.DIRECTIONS[dirs[i]]);
|
||||
}
|
||||
|
||||
externalConnections.clear();
|
||||
dirs = nbtRoot.getIntArray("externalConnections");
|
||||
for (int i = 0; i < dirs.length; i++) {
|
||||
externalConnections.add(ForgeDirection.values()[dirs[i]]);
|
||||
externalConnections.add(ForgeDirections.DIRECTIONS[dirs[i]]);
|
||||
}
|
||||
active = nbtRoot.getBoolean("signalActive");
|
||||
|
||||
@@ -397,7 +397,7 @@ public abstract class AbstractConduit implements IConduit {
|
||||
if (modes != null && modes.length == 6) {
|
||||
int i = 0;
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
conectionModes.put(dir, ConnectionMode.values()[modes[i]]);
|
||||
conectionModes.put(dir, ConnectionMode.VALUES[modes[i]]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -453,7 +453,7 @@ public abstract class AbstractConduit implements IConduit {
|
||||
needUpdateConnections = false;
|
||||
|
||||
boolean externalConnectionsChanged = false;
|
||||
List<ForgeDirection> copy = new ArrayList<ForgeDirection>(externalConnections);
|
||||
List<ForgeDirection> copy = new ArrayList<>(externalConnections);
|
||||
// remove any no longer valid connections
|
||||
for (ForgeDirection dir : copy) {
|
||||
if (!canConnectToExternal(dir, false)) {
|
||||
@@ -633,7 +633,7 @@ public abstract class AbstractConduit implements IConduit {
|
||||
return collidables;
|
||||
}
|
||||
|
||||
List<CollidableComponent> result = new ArrayList<CollidableComponent>();
|
||||
List<CollidableComponent> result = new ArrayList<>();
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
Collection<CollidableComponent> col = getCollidables(dir);
|
||||
if (col != null) {
|
||||
|
||||
@@ -7,10 +7,12 @@ import java.util.List;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
|
||||
// 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> {
|
||||
|
||||
protected final List<I> conduits = new ArrayList<I>();
|
||||
protected final List<I> conduits = new ArrayList<>();
|
||||
|
||||
protected final Class<I> implClass;
|
||||
protected final Class<T> baseConduitClass;
|
||||
@@ -64,7 +66,7 @@ public abstract class AbstractConduitNetwork<T extends IConduit, I extends T> {
|
||||
public void addConduit(I con) {
|
||||
if (!conduits.contains(con)) {
|
||||
if (conduits.isEmpty()) {
|
||||
ConduitNetworkTickHandler.instance.registerNetwork(this);
|
||||
EnderIO.proxy.conduitNetworkTickHandler.registerNetwork(this);
|
||||
}
|
||||
conduits.add(con);
|
||||
}
|
||||
@@ -75,7 +77,7 @@ public abstract class AbstractConduitNetwork<T extends IConduit, I extends T> {
|
||||
con.setNetwork(null);
|
||||
}
|
||||
conduits.clear();
|
||||
ConduitNetworkTickHandler.instance.unregisterNetwork(this);
|
||||
EnderIO.proxy.conduitNetworkTickHandler.unregisterNetwork(this);
|
||||
}
|
||||
|
||||
public List<I> getConduits() {
|
||||
|
||||
@@ -24,6 +24,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import mods.immibis.microblocks.api.IMicroblockCoverSystem;
|
||||
import mods.immibis.microblocks.api.IMicroblockSupporterTile;
|
||||
import mods.immibis.microblocks.api.MicroblockAPIUtils;
|
||||
@@ -84,7 +85,7 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
ForgeDirection dir = ForgeDirection.values()[side];
|
||||
ForgeDirection dir = ForgeDirections.DIRECTIONS[side];
|
||||
int placeX = x + dir.offsetX;
|
||||
int placeY = y + dir.offsetY;
|
||||
int placeZ = z + dir.offsetZ;
|
||||
|
||||
@@ -32,7 +32,6 @@ import com.enderio.core.client.render.BoundingBox;
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
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.Interface;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -72,6 +71,7 @@ import crazypants.enderio.item.ItemConduitProbe;
|
||||
import crazypants.enderio.machine.painter.PainterUtil;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.tool.ToolUtil;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import crazypants.util.IFacade;
|
||||
import mods.immibis.core.api.multipart.IMultipartRenderingBlockMarker;
|
||||
import mods.immibis.core.api.multipart.IMultipartSystem;
|
||||
@@ -93,9 +93,6 @@ public class BlockConduitBundle extends BlockEio
|
||||
|
||||
public static BlockConduitBundle create() {
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(ConduitNetworkTickHandler.instance);
|
||||
FMLCommonHandler.instance().bus().register(ConduitNetworkTickHandler.instance);
|
||||
|
||||
PacketHandler.INSTANCE
|
||||
.registerMessage(PacketFluidLevel.class, PacketFluidLevel.class, PacketHandler.nextID(), Side.CLIENT);
|
||||
PacketHandler.INSTANCE
|
||||
@@ -160,7 +157,6 @@ public class BlockConduitBundle extends BlockEio
|
||||
|
||||
BlockConduitBundle result = new BlockConduitBundle();
|
||||
result.init();
|
||||
MinecraftForge.EVENT_BUS.register(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -292,41 +288,6 @@ public class BlockConduitBundle extends BlockEio
|
||||
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
|
||||
protected void init() {
|
||||
super.init();
|
||||
@@ -334,6 +295,7 @@ 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_SELECTOR, this);
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -473,24 +435,6 @@ public class BlockConduitBundle extends BlockEio
|
||||
: 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
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
@@ -536,7 +480,7 @@ public class BlockConduitBundle extends BlockEio
|
||||
IConduitBundle te = (IConduitBundle) rte;
|
||||
|
||||
boolean breakBlock = true;
|
||||
List<ItemStack> drop = new ArrayList<ItemStack>();
|
||||
List<ItemStack> drop = new ArrayList<>();
|
||||
if (ConduitUtil.isSolidFacadeRendered(te, player)) {
|
||||
breakBlock = false;
|
||||
ItemStack fac = new ItemStack(EnderIO.itemConduitFacade, 1, te.getFacadeType().ordinal());
|
||||
@@ -594,7 +538,7 @@ public class BlockConduitBundle extends BlockEio
|
||||
if (type == null) {
|
||||
// broke a conector so drop any conduits with no connections as there
|
||||
// is no other way to remove these
|
||||
List<IConduit> cons = new ArrayList<IConduit>(te.getConduits());
|
||||
List<IConduit> cons = new ArrayList<>(te.getConduits());
|
||||
boolean droppedUnconected = false;
|
||||
for (IConduit con : cons) {
|
||||
if (con.getConduitConnections().isEmpty() && con.getExternalConnections().isEmpty()
|
||||
@@ -827,7 +771,7 @@ public class BlockConduitBundle extends BlockEio
|
||||
|
||||
bundle.setFacadeId(facadeID);
|
||||
bundle.setFacadeMetadata(facadeMeta);
|
||||
bundle.setFacadeType(FacadeType.values()[facadeType]);
|
||||
bundle.setFacadeType(FacadeType.VALUES[facadeType]);
|
||||
if (!world.isRemote) {
|
||||
ConduitUtil.playPlaceSound(facadeID.stepSound, world, x, y, z);
|
||||
}
|
||||
@@ -876,7 +820,7 @@ public class BlockConduitBundle extends BlockEio
|
||||
return new ExternalConnectionContainer(
|
||||
player.inventory,
|
||||
(IConduitBundle) te,
|
||||
ForgeDirection.values()[id - GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE]);
|
||||
ForgeDirections.DIRECTIONS[id - GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE]);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -891,7 +835,7 @@ public class BlockConduitBundle extends BlockEio
|
||||
return new GuiExternalConnection(
|
||||
player.inventory,
|
||||
(IConduitBundle) te,
|
||||
ForgeDirection.values()[id - GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE]);
|
||||
ForgeDirections.DIRECTIONS[id - GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE]);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -1091,7 +1035,7 @@ public class BlockConduitBundle extends BlockEio
|
||||
return null;
|
||||
}
|
||||
IConduitBundle bundle = (IConduitBundle) te;
|
||||
List<RaytraceResult> hits = new ArrayList<RaytraceResult>();
|
||||
List<RaytraceResult> hits = new ArrayList<>();
|
||||
|
||||
if (player == null) {
|
||||
player = EnderIO.proxy.getClientPlayer();
|
||||
@@ -1108,8 +1052,7 @@ public class BlockConduitBundle extends BlockEio
|
||||
}
|
||||
} else {
|
||||
ConduitDisplayMode mode = ConduitUtil.getDisplayMode(player);
|
||||
Collection<CollidableComponent> components = new ArrayList<CollidableComponent>(
|
||||
bundle.getCollidableComponents());
|
||||
Collection<CollidableComponent> components = new ArrayList<>(bundle.getCollidableComponents());
|
||||
for (CollidableComponent component : components) {
|
||||
if ((component.conduitType != null || mode == ConduitDisplayMode.ALL)
|
||||
&& ConduitUtil.renderConduit(player, component.conduitType)) {
|
||||
@@ -1274,4 +1217,61 @@ public class BlockConduitBundle extends BlockEio
|
||||
private boolean hasMicroblocks(IConduitBundle bundle) {
|
||||
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() {
|
||||
return FluentIterable.from(registrar).filter(new Predicate<ConduitDisplayMode>() {
|
||||
return FluentIterable.from(registrar).filter(new Predicate<>() {
|
||||
|
||||
@Override
|
||||
public boolean apply(ConduitDisplayMode input) {
|
||||
|
||||
@@ -10,18 +10,15 @@ import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
|
||||
public class ConduitNetworkTickHandler {
|
||||
|
||||
public static final ConduitNetworkTickHandler instance = new ConduitNetworkTickHandler();
|
||||
public interface TickListener {
|
||||
|
||||
public static interface TickListener {
|
||||
void tickStart(TickEvent.ServerTickEvent evt);
|
||||
|
||||
public void tickStart(TickEvent.ServerTickEvent evt);
|
||||
|
||||
public void tickEnd(TickEvent.ServerTickEvent evt);
|
||||
void tickEnd(TickEvent.ServerTickEvent evt);
|
||||
}
|
||||
|
||||
private final List<TickListener> listeners = new ArrayList<TickListener>();
|
||||
|
||||
private final IdentityHashMap<AbstractConduitNetwork<?, ?>, Boolean> networks = new IdentityHashMap<AbstractConduitNetwork<?, ?>, Boolean>();
|
||||
private final List<TickListener> listeners = new ArrayList<>();
|
||||
private final IdentityHashMap<AbstractConduitNetwork<?, ?>, Boolean> networks = new IdentityHashMap<>();
|
||||
|
||||
public void addListener(TickListener listener) {
|
||||
listeners.add(listener);
|
||||
|
||||
@@ -254,7 +254,7 @@ public class ConduitUtil {
|
||||
if (!(te instanceof IConduitBundle)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<T> result = new ArrayList<T>();
|
||||
List<T> result = new ArrayList<>();
|
||||
IConduitBundle root = (IConduitBundle) te;
|
||||
T con = root.getConduit(type);
|
||||
if (con != null) {
|
||||
@@ -320,7 +320,7 @@ public class ConduitUtil {
|
||||
}
|
||||
|
||||
int signalStrength = getInternalSignalForColor(bundle, col);
|
||||
if (signalStrength < 15 && DyeColor.RED == col && bundle != null && bundle.getEntity() != null) {
|
||||
if (signalStrength < 15 && bundle != null && bundle.getEntity() != null) {
|
||||
TileEntity te = bundle.getEntity();
|
||||
signalStrength = Math
|
||||
.max(signalStrength, te.getWorldObj().getStrongestIndirectPower(te.xCoord, te.yCoord, te.zCoord));
|
||||
@@ -363,7 +363,7 @@ public class ConduitUtil {
|
||||
return;
|
||||
}
|
||||
IConduitBundle cb = (IConduitBundle) te;
|
||||
Set<ForgeDirection> cons = new HashSet<ForgeDirection>();
|
||||
Set<ForgeDirection> cons = new HashSet<>();
|
||||
boolean hasInsulated = false;
|
||||
for (IConduit con : cb.getConduits()) {
|
||||
cons.addAll(con.getExternalConnections());
|
||||
|
||||
@@ -10,6 +10,10 @@ public enum ConnectionMode {
|
||||
DISABLED("gui.conduit.ioMode.disabled"),
|
||||
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;
|
||||
|
||||
ConnectionMode(String unlocalisedName) {
|
||||
@@ -22,19 +26,19 @@ public enum ConnectionMode {
|
||||
|
||||
public static ConnectionMode getNext(ConnectionMode mode) {
|
||||
int ord = mode.ordinal() + 1;
|
||||
if (ord >= ConnectionMode.values().length) {
|
||||
if (ord >= ConnectionMode.VALUES.length) {
|
||||
ord = 0;
|
||||
}
|
||||
return ConnectionMode.values()[ord];
|
||||
return ConnectionMode.VALUES[ord];
|
||||
}
|
||||
|
||||
public static ConnectionMode getPrevious(ConnectionMode mode) {
|
||||
|
||||
int ord = mode.ordinal() - 1;
|
||||
if (ord < 0) {
|
||||
ord = ConnectionMode.values().length - 1;
|
||||
ord = ConnectionMode.VALUES.length - 1;
|
||||
}
|
||||
return ConnectionMode.values()[ord];
|
||||
return ConnectionMode.VALUES[ord];
|
||||
}
|
||||
|
||||
public boolean acceptsInput() {
|
||||
|
||||
@@ -33,7 +33,7 @@ public class RaytraceResult {
|
||||
if (origin == null || toSort == null) {
|
||||
return;
|
||||
}
|
||||
Collections.sort(toSort, new Comparator<RaytraceResult>() {
|
||||
Collections.sort(toSort, new Comparator<>() {
|
||||
|
||||
@Override
|
||||
public int compare(RaytraceResult o1, RaytraceResult o2) {
|
||||
|
||||
@@ -51,6 +51,7 @@ import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduit;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import li.cil.oc.api.network.Message;
|
||||
import li.cil.oc.api.network.Node;
|
||||
import mekanism.api.gas.Gas;
|
||||
@@ -412,7 +413,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
|
||||
// persist, some of which causes crashes with energy conduits.
|
||||
NBTTagCompound[] originalData = new NBTTagCompound[ForgeDirection.values().length];
|
||||
NBTTagCompound[] originalData = new NBTTagCompound[ForgeDirections.DIRECTIONS.length];
|
||||
for (ForgeDirection conduitConnection : original.getExternalConnections()) {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
original.writeConnectionSettingsToNBT(conduitConnection, tag);
|
||||
@@ -423,7 +424,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
for (int i = 0; i < originalData.length; i++) {
|
||||
NBTTagCompound nbt = originalData[i];
|
||||
if (nbt != null) {
|
||||
replacement.readConduitSettingsFromNBT(ForgeDirection.values()[i], nbt);
|
||||
replacement.readConduitSettingsFromNBT(ForgeDirections.DIRECTIONS[i], nbt);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -563,7 +564,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
cachedConnectors.clear();
|
||||
|
||||
// TODO: What an unholly mess! (and it doesn't even work correctly...)
|
||||
List<CollidableComponent> coreBounds = new ArrayList<CollidableComponent>();
|
||||
List<CollidableComponent> coreBounds = new ArrayList<>();
|
||||
for (IConduit con : conduits) {
|
||||
addConduitCores(coreBounds, con);
|
||||
}
|
||||
@@ -571,13 +572,13 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
result.addAll(coreBounds);
|
||||
|
||||
// 1st algorithm
|
||||
List<CollidableComponent> conduitsBounds = new ArrayList<CollidableComponent>();
|
||||
List<CollidableComponent> conduitsBounds = new ArrayList<>();
|
||||
for (IConduit con : conduits) {
|
||||
conduitsBounds.addAll(con.getCollidableComponents());
|
||||
addConduitCores(conduitsBounds, con);
|
||||
}
|
||||
|
||||
Set<Class<IConduit>> collidingTypes = new HashSet<Class<IConduit>>();
|
||||
Set<Class<IConduit>> collidingTypes = new HashSet<>();
|
||||
for (CollidableComponent conCC : conduitsBounds) {
|
||||
for (CollidableComponent innerCC : conduitsBounds) {
|
||||
if (!InsulatedRedstoneConduit.COLOR_CONTROLLER_ID.equals(innerCC.data)
|
||||
@@ -591,7 +592,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
|
||||
// TODO: Remove the core geometries covered up by this as no point in rendering these
|
||||
if (!collidingTypes.isEmpty()) {
|
||||
List<CollidableComponent> colCores = new ArrayList<CollidableComponent>();
|
||||
List<CollidableComponent> colCores = new ArrayList<>();
|
||||
for (Class<IConduit> c : collidingTypes) {
|
||||
IConduit con = getConduit(c);
|
||||
if (con != null) {
|
||||
@@ -623,7 +624,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
for (IConduit con : conduits) {
|
||||
|
||||
if (con.hasConnections()) {
|
||||
List<CollidableComponent> cores = new ArrayList<CollidableComponent>();
|
||||
List<CollidableComponent> cores = new ArrayList<>();
|
||||
addConduitCores(cores, con);
|
||||
if (cores.size() > 1) {
|
||||
BoundingBox bb = cores.get(0).bound;
|
||||
|
||||
@@ -140,7 +140,7 @@ public class BlockConduitFacade extends BlockEio implements IPaintedBlock, Clone
|
||||
return new Mimic(id, meta);
|
||||
}
|
||||
|
||||
class Mimic {
|
||||
static class Mimic {
|
||||
|
||||
int meta;
|
||||
Block block;
|
||||
|
||||
@@ -32,14 +32,17 @@ import crazypants.enderio.machine.painter.BasicPainterTemplate;
|
||||
import crazypants.enderio.machine.painter.IPaintedBlock;
|
||||
import crazypants.enderio.machine.painter.PaintSourceValidator;
|
||||
import crazypants.enderio.machine.painter.PainterUtil;
|
||||
import crazypants.util.ForgeDirections;
|
||||
|
||||
public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider, IResourceTooltipProvider {
|
||||
|
||||
public static enum FacadeType {
|
||||
public enum FacadeType {
|
||||
|
||||
BASIC,
|
||||
HARDENED;
|
||||
|
||||
public static final FacadeType[] VALUES = values();
|
||||
|
||||
public String getUnlocName(Item me) {
|
||||
return this == BASIC ? me.getUnlocalizedName() : me.getUnlocalizedName() + ".hardened";
|
||||
}
|
||||
@@ -68,14 +71,14 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs p_150895_2_, List<ItemStack> list) {
|
||||
for (FacadeType t : FacadeType.values()) {
|
||||
for (FacadeType t : FacadeType.VALUES) {
|
||||
list.add(new ItemStack(item, 1, t.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return FacadeType.values()[stack.getItemDamage()].getUnlocName(this);
|
||||
return FacadeType.VALUES[stack.getItemDamage()].getUnlocName(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,7 +89,7 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
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[1] = IIconRegister.registerIcon("enderio:conduitFacadeHardened");
|
||||
overlayIcon = IIconRegister.registerIcon("enderio:conduitFacadeOverlay");
|
||||
@@ -115,7 +118,7 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
|
||||
return true;
|
||||
}
|
||||
|
||||
ForgeDirection dir = ForgeDirection.values()[side];
|
||||
ForgeDirection dir = ForgeDirections.DIRECTIONS[side];
|
||||
int placeX = x + dir.offsetX;
|
||||
int placeY = y + dir.offsetY;
|
||||
int placeZ = z + dir.offsetZ;
|
||||
@@ -130,7 +133,7 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
|
||||
facadeMeta = PainterUtil.adjustFacadeMetadata(facadeID, facadeMeta, side);
|
||||
bundle.setFacadeId(facadeID);
|
||||
bundle.setFacadeMetadata(facadeMeta);
|
||||
bundle.setFacadeType(FacadeType.values()[itemStack.getItemDamage()]);
|
||||
bundle.setFacadeType(FacadeType.VALUES[itemStack.getItemDamage()]);
|
||||
ConduitUtil.playPlaceSound(facadeID.stepSound, world, x, y, z);
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
itemStack.stackSize--;
|
||||
|
||||
@@ -25,12 +25,10 @@ import mekanism.api.gas.IGasHandler;
|
||||
|
||||
public abstract class AbstractGasConduit extends AbstractConduit implements IGasConduit {
|
||||
|
||||
protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes = new EnumMap<ForgeDirection, RedstoneControlMode>(
|
||||
ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> extractionColors = new EnumMap<ForgeDirection, DyeColor>(
|
||||
ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes = new EnumMap<>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> extractionColors = new EnumMap<>(ForgeDirection.class);
|
||||
|
||||
protected final Map<ForgeDirection, Integer> externalRedstoneSignals = new HashMap<ForgeDirection, Integer>();
|
||||
protected final Map<ForgeDirection, Integer> externalRedstoneSignals = new HashMap<>();
|
||||
protected boolean redstoneStateDirty = true;
|
||||
|
||||
@Method(modid = GasUtil.API_NAME)
|
||||
@@ -186,15 +184,15 @@ public abstract class AbstractGasConduit extends AbstractConduit implements IGas
|
||||
String key = "extRM." + dir.name();
|
||||
if (nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if (ord >= 0 && ord < RedstoneControlMode.values().length) {
|
||||
extractionModes.put(dir, RedstoneControlMode.values()[ord]);
|
||||
if (ord >= 0 && ord < RedstoneControlMode.VALUES.length) {
|
||||
extractionModes.put(dir, RedstoneControlMode.VALUES[ord]);
|
||||
}
|
||||
}
|
||||
key = "extSC." + dir.name();
|
||||
if (nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if (ord >= 0 && ord < DyeColor.values().length) {
|
||||
extractionColors.put(dir, DyeColor.values()[ord]);
|
||||
if (ord >= 0 && ord < DyeColor.VALUES.length) {
|
||||
extractionColors.put(dir, DyeColor.VALUES[ord]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public class GasConduitNetwork extends AbstractGasTankConduitNetwork<GasConduit>
|
||||
|
||||
private final ConduitGasTank tank = new ConduitGasTank(0);
|
||||
|
||||
private final Set<GasOutput> outputs = new HashSet<GasOutput>();
|
||||
private final Set<GasOutput> outputs = new HashSet<>();
|
||||
|
||||
private Iterator<GasOutput> outputIterator;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import crazypants.enderio.gui.IconEIO;
|
||||
|
||||
public class ItemGasConduit extends AbstractItemConduit implements IAdvancedTooltipProvider {
|
||||
|
||||
private static ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
|
||||
private static final ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
|
||||
new ItemConduitSubtype(ModObject.itemGasConduit.name(), "enderio:itemGasConduit"), };
|
||||
|
||||
public static ItemGasConduit create() {
|
||||
|
||||
@@ -12,7 +12,7 @@ public class CollidableCache {
|
||||
|
||||
public static final CollidableCache instance = new CollidableCache();
|
||||
|
||||
private final Map<CacheKey, Collection<CollidableComponent>> cache = new HashMap<CollidableCache.CacheKey, Collection<CollidableComponent>>();
|
||||
private final Map<CacheKey, Collection<CollidableComponent>> cache = new HashMap<>();
|
||||
|
||||
public CacheKey createKey(Class<? extends IConduit> baseType, Offset offset, ForgeDirection dir, boolean isStub) {
|
||||
return new CacheKey(baseType, offset, dir, isStub);
|
||||
|
||||
@@ -33,7 +33,7 @@ public class ConduitGeometryUtil {
|
||||
|
||||
public static final float CONNECTOR_DEPTH = 0.05f;
|
||||
|
||||
private static Map<ForgeDirection, BoundingBox[]> EXTERNAL_CONNECTOR_BOUNDS = new HashMap<ForgeDirection, BoundingBox[]>();
|
||||
private static final Map<ForgeDirection, BoundingBox[]> EXTERNAL_CONNECTOR_BOUNDS = new HashMap<>();
|
||||
|
||||
static {
|
||||
setupBounds(0.5f);
|
||||
@@ -106,9 +106,9 @@ public class ConduitGeometryUtil {
|
||||
return val < 0 ? 1 + val : val;
|
||||
}
|
||||
|
||||
private Map<GeometryKey, BoundingBox> boundsCache = new HashMap<GeometryKey, BoundingBox>();
|
||||
private final Map<GeometryKey, BoundingBox> boundsCache = new HashMap<>();
|
||||
|
||||
private EnumMap<ConduitConnectorType, BoundingBox> connectorBounds = new EnumMap<ConduitConnectorType, BoundingBox>(
|
||||
private final EnumMap<ConduitConnectorType, BoundingBox> connectorBounds = new EnumMap<>(
|
||||
ConduitConnectorType.class);
|
||||
|
||||
private ConduitGeometryUtil() {}
|
||||
|
||||
@@ -21,8 +21,7 @@ import com.enderio.core.common.vecmath.Vertex;
|
||||
|
||||
public class ConnectionModeGeometry {
|
||||
|
||||
private static final EnumMap<ForgeDirection, List<Vertex>> VERTS = new EnumMap<ForgeDirection, List<Vertex>>(
|
||||
ForgeDirection.class);
|
||||
private static final EnumMap<ForgeDirection, List<Vertex>> VERTS = new EnumMap<>(ForgeDirection.class);
|
||||
|
||||
static {
|
||||
float scale = 0.9f;
|
||||
@@ -84,7 +83,7 @@ public class ConnectionModeGeometry {
|
||||
}
|
||||
|
||||
private static List<Vertex> createVerticesForDir(BoundingBox refBB, VertexTransform xform) {
|
||||
List<Vertex> result = new ArrayList<Vertex>(24);
|
||||
List<Vertex> result = new ArrayList<>(24);
|
||||
for (ForgeDirection face : ForgeDirection.VALID_DIRECTIONS) {
|
||||
result.addAll(refBB.getCornersWithUvForFace(face));
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
|
||||
public class Offsets {
|
||||
|
||||
private static Map<OffsetKey, Offset> OFFSETS = new HashMap<OffsetKey, Offset>();
|
||||
private static final Map<OffsetKey, Offset> OFFSETS = new HashMap<>();
|
||||
|
||||
static {
|
||||
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;
|
||||
protected static final int ID_INSERT_FILTER_OPTIONS = 329;
|
||||
protected static final int ID_EXTRACT_FILTER_OPTIONS = 330;
|
||||
protected final int ID_ENABLED = 331;
|
||||
protected static final int ID_ENABLED = 331;
|
||||
|
||||
protected final @Nonnull IWidgetIcon icon;
|
||||
protected final @Nonnull GuiExternalConnection gui;
|
||||
@@ -41,8 +41,8 @@ public class BaseSettingsPanel implements ITabPanel {
|
||||
|
||||
protected ConnectionMode oldConnectionMode;
|
||||
|
||||
private @Nonnull String inputHeading;
|
||||
private @Nonnull String outputHeading;
|
||||
private final @Nonnull String inputHeading;
|
||||
private final @Nonnull String outputHeading;
|
||||
|
||||
private boolean insertEnabled = false;
|
||||
private boolean extractEnabled = false;
|
||||
@@ -142,7 +142,7 @@ public class BaseSettingsPanel implements ITabPanel {
|
||||
}
|
||||
};
|
||||
|
||||
ArrayList<String> funcUpgradeTips = new ArrayList<String>();
|
||||
ArrayList<String> funcUpgradeTips = new ArrayList<>();
|
||||
SpecialTooltipHandler.addTooltipFromResources(funcUpgradeTips, "enderio.gui.conduit.item.functionupgrade.line");
|
||||
for (FunctionUpgrade upgrade : FunctionUpgrade.values()) {
|
||||
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 RedstoneModeButton rsB;
|
||||
private final RedstoneModeButton rsB;
|
||||
|
||||
private ColorButton colorB;
|
||||
private final ColorButton colorB;
|
||||
|
||||
private String autoExtractStr = EnderIO.lang.localize("gui.conduit.gas.autoExtract");
|
||||
private final String autoExtractStr = EnderIO.lang.localize("gui.conduit.gas.autoExtract");
|
||||
|
||||
private IGasConduit conduit;
|
||||
private final IGasConduit conduit;
|
||||
|
||||
protected GasSettings(final GuiExternalConnection gui, IConduit 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) {
|
||||
super.actionPerformed(guiButton);
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class GuiExternalConnection extends GuiContainerBaseEIO {
|
||||
return id;
|
||||
}
|
||||
|
||||
private static final Map<Class<? extends IConduit>, Integer> TAB_ORDER = new HashMap<Class<? extends IConduit>, Integer>();
|
||||
private static final Map<Class<? extends IConduit>, Integer> TAB_ORDER = new HashMap<>();
|
||||
|
||||
static {
|
||||
TAB_ORDER.put(IItemConduit.class, 0);
|
||||
@@ -66,11 +66,11 @@ public class GuiExternalConnection extends GuiContainerBaseEIO {
|
||||
final IConduitBundle bundle;
|
||||
private final ForgeDirection dir;
|
||||
|
||||
private final List<IConduit> conduits = new ArrayList<IConduit>();
|
||||
private final List<ITabPanel> tabs = new ArrayList<ITabPanel>();
|
||||
private final List<IConduit> conduits = new ArrayList<>();
|
||||
private final List<ITabPanel> tabs = new ArrayList<>();
|
||||
private int activeTab = 0;
|
||||
|
||||
private int tabYOffset = 4;
|
||||
private static final int tabYOffset = 4;
|
||||
|
||||
private final ExternalConnectionContainer container;
|
||||
|
||||
@@ -86,8 +86,8 @@ public class GuiExternalConnection extends GuiContainerBaseEIO {
|
||||
|
||||
container.setInoutSlotsVisible(false, false);
|
||||
|
||||
List<IConduit> cons = new ArrayList<IConduit>(bundle.getConduits());
|
||||
Collections.sort(cons, new Comparator<IConduit>() {
|
||||
List<IConduit> cons = new ArrayList<>(bundle.getConduits());
|
||||
Collections.sort(cons, new Comparator<>() {
|
||||
|
||||
@Override
|
||||
public int compare(IConduit o1, IConduit o2) {
|
||||
|
||||
@@ -23,6 +23,7 @@ import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.util.ForgeDirections;
|
||||
|
||||
public class GuiExternalConnectionSelector extends GuiScreen {
|
||||
|
||||
@@ -33,7 +34,7 @@ public class GuiExternalConnectionSelector extends GuiScreen {
|
||||
|
||||
public GuiExternalConnectionSelector(IConduitBundle cb) {
|
||||
this.cb = cb;
|
||||
cons = new HashSet<ForgeDirection>();
|
||||
cons = new HashSet<>();
|
||||
for (IConduit con : cb.getConduits()) {
|
||||
if (con instanceof IInsulatedRedstoneConduit) {
|
||||
Set<ForgeDirection> conCons = con.getConduitConnections();
|
||||
@@ -51,7 +52,7 @@ public class GuiExternalConnectionSelector extends GuiScreen {
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton b) {
|
||||
ForgeDirection dir = ForgeDirection.values()[b.id];
|
||||
ForgeDirection dir = ForgeDirections.DIRECTIONS[b.id];
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
BlockCoord loc = cb.getLocation();
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketOpenConduitUI(cb.getEntity(), dir));
|
||||
|
||||
@@ -62,7 +62,7 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
private final ILiquidConduit conduit;
|
||||
|
||||
private AbstractEnderLiquidConduit eConduit;
|
||||
private boolean isEnder;
|
||||
private final boolean isEnder;
|
||||
private static final int filterIX = 4;
|
||||
private static final int filterEX = 104;
|
||||
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 GuiToolTip[] filterToolTips;
|
||||
|
||||
private boolean inOutShowIn = true;
|
||||
private static final boolean inOutShowIn = true;
|
||||
private IconButton insertWhiteListB;
|
||||
private IconButton extractWhiteListB;
|
||||
|
||||
@@ -172,7 +172,7 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
public void actionPerformed(GuiButton guiButton) {
|
||||
super.actionPerformed(guiButton);
|
||||
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()));
|
||||
} else if (guiButton.id == ID_INSERT_WHITELIST || guiButton.id == ID_EXTRACT_WHITELIST) {
|
||||
toggleBlacklist(guiButton.id == ID_EXTRACT_WHITELIST);
|
||||
@@ -180,7 +180,7 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
ColorButton btn = (ColorButton) guiButton;
|
||||
if (isEnder) {
|
||||
|
||||
DyeColor col = DyeColor.values()[btn.getColorIndex()];
|
||||
DyeColor col = DyeColor.VALUES[btn.getColorIndex()];
|
||||
boolean isInput = guiButton.id == ID_EXTRACT_CHANNEL;
|
||||
|
||||
if (isInput) {
|
||||
@@ -284,6 +284,8 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
rsB.onGuiInit();
|
||||
colorB.onGuiInit();
|
||||
|
||||
gui.getContainer().setInventorySlotsVisible(true);
|
||||
|
||||
if (!isEnder) {
|
||||
return;
|
||||
}
|
||||
@@ -295,7 +297,6 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
roundRobinB.onGuiInit();
|
||||
roundRobinB.setSelected(eConduit.isRoundRobin(gui.getDir()));
|
||||
|
||||
gui.getContainer().setInventorySlotsVisible(true);
|
||||
if (isFilterVisible()) {
|
||||
addFilterTooltips();
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@ import crazypants.enderio.network.PacketHandler;
|
||||
public class OCSettings extends BaseSettingsPanel {
|
||||
|
||||
private static final int ID_COLOR_BUTTON = GuiExternalConnection.nextButtonId();
|
||||
private ColorButton cb;
|
||||
private final ColorButton cb;
|
||||
|
||||
private String signalColorStr = EnderIO.lang.localize("gui.conduit.redstone.color");
|
||||
private final String signalColorStr = EnderIO.lang.localize("gui.conduit.redstone.color");
|
||||
private final IOCConduit occon;
|
||||
|
||||
public OCSettings(GuiExternalConnection gui, IConduit con) {
|
||||
@@ -42,7 +42,7 @@ public class OCSettings extends BaseSettingsPanel {
|
||||
public void actionPerformed(GuiButton guiButton) {
|
||||
super.actionPerformed(guiButton);
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import crazypants.enderio.conduit.liquid.AbstractEnderLiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import crazypants.enderio.conduit.packet.AbstractConduitPacket;
|
||||
import crazypants.enderio.conduit.packet.ConTypeEnum;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class PacketFluidChannel extends AbstractConduitPacket<ILiquidConduit>
|
||||
@@ -42,9 +43,9 @@ public class PacketFluidChannel extends AbstractConduitPacket<ILiquidConduit>
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
dir = ForgeDirection.values()[buf.readShort()];
|
||||
dir = ForgeDirections.DIRECTIONS[buf.readShort()];
|
||||
isInput = buf.readBoolean();
|
||||
channel = DyeColor.values()[buf.readShort()];
|
||||
channel = DyeColor.VALUES[buf.readShort()];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,6 +12,7 @@ import crazypants.enderio.conduit.liquid.FluidFilter;
|
||||
import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import crazypants.enderio.conduit.packet.AbstractConduitPacket;
|
||||
import crazypants.enderio.conduit.packet.ConTypeEnum;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class PacketFluidFilter extends AbstractConduitPacket<ILiquidConduit>
|
||||
@@ -44,7 +45,7 @@ public class PacketFluidFilter extends AbstractConduitPacket<ILiquidConduit>
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
dir = ForgeDirection.values()[buf.readShort()];
|
||||
dir = ForgeDirections.DIRECTIONS[buf.readShort()];
|
||||
isInput = buf.readBoolean();
|
||||
NBTTagCompound tag = ByteBufUtils.readTag(buf);
|
||||
filter = new FluidFilter();
|
||||
|
||||
@@ -11,6 +11,7 @@ import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.GuiHandler;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class PacketOpenConduitUI extends MessageTileEntity<TileEntity>
|
||||
@@ -34,7 +35,7 @@ public class PacketOpenConduitUI extends MessageTileEntity<TileEntity>
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
dir = ForgeDirection.values()[buf.readShort()];
|
||||
dir = ForgeDirections.DIRECTIONS[buf.readShort()];
|
||||
}
|
||||
|
||||
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 IPowerConduit conduit;
|
||||
private RedstoneModeButton rsB;
|
||||
private ColorButton colorB;
|
||||
private final IPowerConduit conduit;
|
||||
private final RedstoneModeButton rsB;
|
||||
private final ColorButton colorB;
|
||||
|
||||
protected PowerSettings(final GuiExternalConnection gui, IConduit 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) {
|
||||
super.actionPerformed(guiButton);
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ public class RedstoneSettings extends BaseSettingsPanel {
|
||||
|
||||
private CheckBox strongCB;
|
||||
|
||||
private String signalColorStr = EnderIO.lang.localize("gui.conduit.redstone.color");
|
||||
private String signalStringthStr = EnderIO.lang.localize("gui.conduit.redstone.signalStrengh");
|
||||
private final String signalColorStr = EnderIO.lang.localize("gui.conduit.redstone.color");
|
||||
private final String signalStringthStr = EnderIO.lang.localize("gui.conduit.redstone.signalStrengh");
|
||||
private IInsulatedRedstoneConduit insCon;
|
||||
|
||||
private int stongLabelX;
|
||||
@@ -61,7 +61,7 @@ public class RedstoneSettings extends BaseSettingsPanel {
|
||||
public void actionPerformed(GuiButton guiButton) {
|
||||
super.actionPerformed(guiButton);
|
||||
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()));
|
||||
} else if (guiButton.id == ID_STRONG_BUTTON && strongCB != null) {
|
||||
insCon.setOutputStrength(gui.getDir(), strongCB.isSelected());
|
||||
|
||||
@@ -39,11 +39,11 @@ public class BasicItemFilterGui implements IItemFilterGui {
|
||||
private final IItemFilterContainer filterContainer;
|
||||
private final ItemFilter filter;
|
||||
|
||||
private int buttonIdOffset;
|
||||
private int xOffset;
|
||||
private int yOffset;
|
||||
private final int buttonIdOffset;
|
||||
private final int xOffset;
|
||||
private final int yOffset;
|
||||
|
||||
private boolean isInput;
|
||||
private final boolean isInput;
|
||||
|
||||
public BasicItemFilterGui(GuiContainerBaseEIO gui, IItemFilterContainer filterContainer,
|
||||
boolean isStickyModeAvailable, boolean isInput) {
|
||||
|
||||
@@ -39,7 +39,7 @@ public class BigItemFilterGui implements IItemFilterGui {
|
||||
private final IItemFilterContainer filterContainer;
|
||||
private final ItemFilter filter;
|
||||
|
||||
private int buttonIdOffset;
|
||||
private final int buttonIdOffset;
|
||||
private int xOffset;
|
||||
private int yOffset;
|
||||
|
||||
|
||||
@@ -38,26 +38,26 @@ public class ExistingItemFilterGui implements IItemFilterGui {
|
||||
private static final int ID_SHOW = GuiExternalConnection.nextButtonId();
|
||||
private static final int ID_MERGE = GuiExternalConnection.nextButtonId();
|
||||
|
||||
private IItemConduit itemConduit;
|
||||
private GuiExternalConnection gui;
|
||||
private final IItemConduit itemConduit;
|
||||
private final GuiExternalConnection gui;
|
||||
|
||||
private ToggleButton useMetaB;
|
||||
private ToggleButton useNbtB;
|
||||
private ToggleButton useOreDictB;
|
||||
private ToggleButton stickyB;
|
||||
private final ToggleButton useMetaB;
|
||||
private final ToggleButton useNbtB;
|
||||
private final ToggleButton useOreDictB;
|
||||
private final ToggleButton stickyB;
|
||||
|
||||
private final IconButton whiteListB;
|
||||
|
||||
private GuiButton snapshotB;
|
||||
private GuiButton clearB;
|
||||
private GuiButton showB;
|
||||
private GuiButton mergeB;
|
||||
private SnapshotOverlay snapshotOverlay;
|
||||
private final GuiButton snapshotB;
|
||||
private final GuiButton clearB;
|
||||
private final GuiButton showB;
|
||||
private final GuiButton mergeB;
|
||||
private final SnapshotOverlay snapshotOverlay;
|
||||
|
||||
boolean isInput;
|
||||
private int buttonIdOffset = 0;
|
||||
|
||||
private ExistingItemFilter filter;
|
||||
private final ExistingItemFilter filter;
|
||||
|
||||
public ExistingItemFilterGui(GuiExternalConnection gui, IItemConduit itemConduit, boolean isInput) {
|
||||
this.gui = gui;
|
||||
|
||||
@@ -9,9 +9,9 @@ import crazypants.enderio.network.PacketHandler;
|
||||
|
||||
public class ItemConduitFilterContainer implements IItemFilterContainer {
|
||||
|
||||
private IItemConduit itemConduit;
|
||||
private ForgeDirection dir;
|
||||
private boolean isInput;
|
||||
private final IItemConduit itemConduit;
|
||||
private final ForgeDirection dir;
|
||||
private final boolean isInput;
|
||||
|
||||
public ItemConduitFilterContainer(IItemConduit itemConduit, ForgeDirection dir, boolean isInput) {
|
||||
this.itemConduit = itemConduit;
|
||||
|
||||
@@ -31,6 +31,7 @@ import crazypants.enderio.gui.RedstoneModeButton;
|
||||
import crazypants.enderio.machine.IRedstoneModeControlable;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.util.ColorUtils;
|
||||
|
||||
public class ItemSettings extends BaseSettingsPanel {
|
||||
|
||||
@@ -43,7 +44,7 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
private static final int ID_INSERT_CHANNEL = 23;
|
||||
private static final int ID_EXTRACT_CHANNEL = 27;
|
||||
|
||||
private @Nonnull IItemConduit itemConduit;
|
||||
private final @Nonnull IItemConduit itemConduit;
|
||||
|
||||
private final ToggleButton loopB;
|
||||
private final ToggleButton roundRobinB;
|
||||
@@ -54,11 +55,11 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
private final RedstoneModeButton rsB;
|
||||
private final @Nonnull ColorButton colorB;
|
||||
|
||||
private ColorButton insertChannelB;
|
||||
private ColorButton extractChannelB;
|
||||
private final ColorButton insertChannelB;
|
||||
private final ColorButton extractChannelB;
|
||||
|
||||
private int priLeft = 46;
|
||||
private int priWidth = 32;
|
||||
private static final int priLeft = 46;
|
||||
private static final int priWidth = 32;
|
||||
|
||||
private IItemFilterGui insertFilterGui;
|
||||
private IItemFilterGui extractFilterGui;
|
||||
@@ -174,6 +175,7 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
private void updateButtons() {
|
||||
rsB.onGuiInit();
|
||||
rsB.setMode(itemConduit.getExtractionRedstoneMode(gui.getDir()));
|
||||
colorB.onGuiInit();
|
||||
|
||||
loopB.onGuiInit();
|
||||
loopB.setSelected(itemConduit.isSelfFeedEnabled(gui.getDir()));
|
||||
@@ -239,7 +241,7 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
|
||||
String priority = EnderIO.lang.localize("gui.conduit.item.priority");
|
||||
fr.drawString(priority, left + 12, top1 + 25, ColorUtil.getRGB(Color.black));
|
||||
fr.drawString(str, left + priLeft + priWidth - sw - gap, top1 + 25, ColorUtil.getRGB(Color.black));
|
||||
fr.drawString(str, left + priLeft + priWidth - sw - gap, top1 + 25, ColorUtils.priorityString.getColor());
|
||||
|
||||
if (insertFilterGui != null) insertFilterGui.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 ItemFilter filter;
|
||||
private int buttonIdOffset;
|
||||
private int xOffset;
|
||||
private int yOffset;
|
||||
private final int buttonIdOffset;
|
||||
private final int xOffset;
|
||||
private final int yOffset;
|
||||
final boolean isStickyModeAvailable;
|
||||
private boolean isInput;
|
||||
private final boolean isInput;
|
||||
|
||||
public LimitedItemFilterGui(GuiContainerBaseEIO gui, IItemFilterContainer filterContainer,
|
||||
boolean isStickyModeAvailable, boolean isInput) {
|
||||
|
||||
@@ -37,7 +37,6 @@ public class ModItemFilterGui implements IItemFilterGui {
|
||||
|
||||
private final IconButton whiteListB;
|
||||
|
||||
private final int inputOffsetX;
|
||||
private final int tfWidth;
|
||||
private final int tfTextureX;
|
||||
private final int tfTextureY;
|
||||
@@ -56,13 +55,12 @@ public class ModItemFilterGui implements IItemFilterGui {
|
||||
} else {
|
||||
filter = (ModItemFilter) itemConduit.getOutputFilter(gui.getDir());
|
||||
}
|
||||
inputOffsetX = x;
|
||||
tfWidth = 52;
|
||||
tfTextureX = 120;
|
||||
tfTextureY = 214;
|
||||
|
||||
inputBounds = new Rectangle[] { new Rectangle(inputOffsetX, y, 16, 16),
|
||||
new Rectangle(inputOffsetX, y + 18, 16, 16), new Rectangle(inputOffsetX, y + 36, 16, 16) };
|
||||
inputBounds = new Rectangle[] { new Rectangle(x, y, 16, 16), new Rectangle(x, y + 18, 16, 16),
|
||||
new Rectangle(x, y + 36, 16, 16) };
|
||||
|
||||
deleteButs = new IconButton[inputBounds.length];
|
||||
for (int i = 0; i < deleteButs.length; i++) {
|
||||
|
||||
+12
-4
@@ -14,17 +14,25 @@ import crazypants.enderio.conduit.item.NetworkedInventory;
|
||||
import crazypants.enderio.conduit.item.filter.ExistingItemFilter;
|
||||
import crazypants.enderio.conduit.packet.AbstractConduitPacket;
|
||||
import crazypants.enderio.conduit.packet.ConTypeEnum;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class PacketExistingItemFilterSnapshot extends AbstractConduitPacket<IItemConduit>
|
||||
implements IMessageHandler<PacketExistingItemFilterSnapshot, IMessage> {
|
||||
|
||||
public static enum Opcode {
|
||||
public enum Opcode {
|
||||
|
||||
CLEAR,
|
||||
SET,
|
||||
MERGE,
|
||||
SET_BLACK,
|
||||
UNSET_BLACK
|
||||
UNSET_BLACK;
|
||||
|
||||
private static final Opcode[] VALUES = values();
|
||||
|
||||
public static Opcode fromOrdinal(int ordinal) {
|
||||
return VALUES[ordinal];
|
||||
}
|
||||
}
|
||||
|
||||
private ForgeDirection dir;
|
||||
@@ -43,9 +51,9 @@ public class PacketExistingItemFilterSnapshot extends AbstractConduitPacket<IIte
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
dir = ForgeDirection.values()[buf.readShort()];
|
||||
dir = ForgeDirections.DIRECTIONS[buf.readShort()];
|
||||
isInput = buf.readBoolean();
|
||||
opcode = Opcode.values()[buf.readByte() & 255];
|
||||
opcode = Opcode.fromOrdinal(buf.readByte() & 255);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,6 +10,7 @@ import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.item.filter.ModItemFilter;
|
||||
import crazypants.enderio.conduit.packet.AbstractConduitPacket;
|
||||
import crazypants.enderio.conduit.packet.ConTypeEnum;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class PacketModItemFilter extends AbstractConduitPacket<IItemConduit>
|
||||
@@ -33,7 +34,7 @@ public class PacketModItemFilter extends AbstractConduitPacket<IItemConduit>
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
dir = ForgeDirection.values()[buf.readShort()];
|
||||
dir = ForgeDirections.DIRECTIONS[buf.readShort()];
|
||||
isInput = buf.readBoolean();
|
||||
index = buf.readInt();
|
||||
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";
|
||||
|
||||
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
|
||||
static final Map<String, IIcon> ICONS = new HashMap<>();
|
||||
|
||||
public static void initIcons() {
|
||||
IconUtil.addIconProvider(new IconUtil.IIconProvider() {
|
||||
@@ -87,37 +87,24 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
|
||||
|
||||
ItemConduitNetwork network;
|
||||
|
||||
protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes = new EnumMap<ForgeDirection, RedstoneControlMode>(
|
||||
ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> extractionColors = new EnumMap<ForgeDirection, DyeColor>(
|
||||
ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes = new EnumMap<>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> extractionColors = new EnumMap<>(ForgeDirection.class);
|
||||
|
||||
protected final EnumMap<ForgeDirection, IItemFilter> outputFilters = new EnumMap<ForgeDirection, IItemFilter>(
|
||||
ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, IItemFilter> inputFilters = new EnumMap<ForgeDirection, IItemFilter>(
|
||||
ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, ItemStack> outputFilterUpgrades = new EnumMap<ForgeDirection, ItemStack>(
|
||||
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, IItemFilter> outputFilters = new EnumMap<>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, IItemFilter> inputFilters = new EnumMap<>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, ItemStack> outputFilterUpgrades = new EnumMap<>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, ItemStack> inputFilterUpgrades = new EnumMap<>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, ItemStack> speedUpgrades = new EnumMap<>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, ItemStack> functionUpgrades = new EnumMap<>(ForgeDirection.class);
|
||||
|
||||
protected final EnumMap<ForgeDirection, Boolean> selfFeed = new EnumMap<ForgeDirection, Boolean>(
|
||||
ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, Boolean> selfFeed = new EnumMap<>(ForgeDirection.class);
|
||||
|
||||
protected final EnumMap<ForgeDirection, Boolean> roundRobin = new EnumMap<ForgeDirection, Boolean>(
|
||||
ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, Boolean> roundRobin = new EnumMap<>(ForgeDirection.class);
|
||||
|
||||
protected final EnumMap<ForgeDirection, Integer> priority = new EnumMap<ForgeDirection, Integer>(
|
||||
ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, Integer> priority = new EnumMap<>(ForgeDirection.class);
|
||||
|
||||
protected final EnumMap<ForgeDirection, DyeColor> outputColors = new EnumMap<ForgeDirection, DyeColor>(
|
||||
ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> inputColors = new EnumMap<ForgeDirection, DyeColor>(
|
||||
ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> outputColors = new EnumMap<>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> inputColors = new EnumMap<>(ForgeDirection.class);
|
||||
|
||||
private int metaData;
|
||||
|
||||
@@ -146,7 +133,7 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
|
||||
metaData = 0;
|
||||
}
|
||||
|
||||
Map<ForgeDirection, ItemStack> converted = new HashMap<ForgeDirection, ItemStack>();
|
||||
Map<ForgeDirection, ItemStack> converted = new HashMap<>();
|
||||
|
||||
convertToItemUpgrades(filterMeta, converted, inputFilters);
|
||||
for (Entry<ForgeDirection, ItemStack> entry : converted.entrySet()) {
|
||||
@@ -164,10 +151,10 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
|
||||
|
||||
@Override
|
||||
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
setExtractionSignalColor(dir, DyeColor.values()[dataRoot.getShort("extractionSignalColor")]);
|
||||
setExtractionRedstoneMode(RedstoneControlMode.values()[dataRoot.getShort("extractionRedstoneMode")], dir);
|
||||
setInputColor(dir, DyeColor.values()[dataRoot.getShort("inputColor")]);
|
||||
setOutputColor(dir, DyeColor.values()[dataRoot.getShort("outputColor")]);
|
||||
setExtractionSignalColor(dir, DyeColor.VALUES[dataRoot.getShort("extractionSignalColor")]);
|
||||
setExtractionRedstoneMode(RedstoneControlMode.VALUES[dataRoot.getShort("extractionRedstoneMode")], dir);
|
||||
setInputColor(dir, DyeColor.VALUES[dataRoot.getShort("inputColor")]);
|
||||
setOutputColor(dir, DyeColor.VALUES[dataRoot.getShort("outputColor")]);
|
||||
setSelfFeedEnabled(dir, dataRoot.getBoolean("selfFeed"));
|
||||
setRoundRobinEnabled(dir, dataRoot.getBoolean("roundRobin"));
|
||||
setOutputPriority(dir, dataRoot.getInteger("outputPriority"));
|
||||
@@ -198,7 +185,7 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops() {
|
||||
List<ItemStack> res = new ArrayList<ItemStack>();
|
||||
List<ItemStack> res = new ArrayList<>();
|
||||
res.add(createItem());
|
||||
for (ItemStack stack : speedUpgrades.values()) {
|
||||
res.add(stack);
|
||||
@@ -850,15 +837,15 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
|
||||
key = "extRM." + dir.name();
|
||||
if (nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if (ord >= 0 && ord < RedstoneControlMode.values().length) {
|
||||
extractionModes.put(dir, RedstoneControlMode.values()[ord]);
|
||||
if (ord >= 0 && ord < RedstoneControlMode.VALUES.length) {
|
||||
extractionModes.put(dir, RedstoneControlMode.VALUES[ord]);
|
||||
}
|
||||
}
|
||||
key = "extSC." + dir.name();
|
||||
if (nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if (ord >= 0 && ord < DyeColor.values().length) {
|
||||
extractionColors.put(dir, DyeColor.values()[ord]);
|
||||
if (ord >= 0 && ord < DyeColor.VALUES.length) {
|
||||
extractionColors.put(dir, DyeColor.VALUES[ord]);
|
||||
}
|
||||
}
|
||||
key = "selfFeed." + dir.name();
|
||||
@@ -882,16 +869,16 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
|
||||
key = "inSC." + dir.name();
|
||||
if (nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if (ord >= 0 && ord < DyeColor.values().length) {
|
||||
inputColors.put(dir, DyeColor.values()[ord]);
|
||||
if (ord >= 0 && ord < DyeColor.VALUES.length) {
|
||||
inputColors.put(dir, DyeColor.VALUES[ord]);
|
||||
}
|
||||
}
|
||||
|
||||
key = "outSC." + dir.name();
|
||||
if (nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if (ord >= 0 && ord < DyeColor.values().length) {
|
||||
outputColors.put(dir, DyeColor.values()[ord]);
|
||||
if (ord >= 0 && ord < DyeColor.VALUES.length) {
|
||||
outputColors.put(dir, DyeColor.VALUES[ord]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,10 +8,13 @@ import java.util.Map;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
import crazypants.enderio.conduit.item.NetworkedInventory.Target;
|
||||
import crazypants.enderio.conduit.item.filter.IItemFilter;
|
||||
@@ -19,10 +22,10 @@ import crazypants.enderio.machine.invpanel.server.InventoryDatabaseServer;
|
||||
|
||||
public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IItemConduit> {
|
||||
|
||||
final List<NetworkedInventory> inventories = new ArrayList<NetworkedInventory>();
|
||||
private final Map<BlockCoord, List<NetworkedInventory>> invMap = new HashMap<BlockCoord, List<NetworkedInventory>>();
|
||||
final List<NetworkedInventory> inventories = new ArrayList<>();
|
||||
private final Map<BlockCoord, List<NetworkedInventory>> invMap = new HashMap<>();
|
||||
|
||||
final Map<BlockCoord, IItemConduit> conMap = new HashMap<BlockCoord, IItemConduit>();
|
||||
final Map<BlockCoord, IItemConduit> conMap = new HashMap<>();
|
||||
|
||||
private boolean requiresSort = true;
|
||||
|
||||
@@ -77,7 +80,7 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
|
||||
}
|
||||
|
||||
public List<NetworkedInventory> getInventoryPanelSources() {
|
||||
ArrayList<NetworkedInventory> res = new ArrayList<NetworkedInventory>();
|
||||
ArrayList<NetworkedInventory> res = new ArrayList<>();
|
||||
for (NetworkedInventory inv : inventories) {
|
||||
if (inv.con.hasInventoryPanelUpgrade(inv.conDir)) {
|
||||
res.add(inv);
|
||||
@@ -89,7 +92,7 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
|
||||
private List<NetworkedInventory> getOrCreate(BlockCoord bc) {
|
||||
List<NetworkedInventory> res = invMap.get(bc);
|
||||
if (res == null) {
|
||||
res = new ArrayList<NetworkedInventory>();
|
||||
res = new ArrayList<>();
|
||||
invMap.put(bc, res);
|
||||
}
|
||||
return res;
|
||||
@@ -176,8 +179,8 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getTargetsForExtraction(BlockCoord extractFrom, IItemConduit con, ItemStack input) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
public List<IChatComponent> getTargetsForExtraction(BlockCoord extractFrom, IItemConduit con, ItemStack input) {
|
||||
List<IChatComponent> result = new ArrayList<>();
|
||||
|
||||
List<NetworkedInventory> invs = getOrCreate(extractFrom);
|
||||
for (NetworkedInventory source : invs) {
|
||||
@@ -187,12 +190,12 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
|
||||
for (Target t : source.sendPriority) {
|
||||
IItemFilter f = t.inv.con.getOutputFilter(t.inv.conDir);
|
||||
if (input == null || f == null || f.doesItemPassFilter(t.inv, input)) {
|
||||
String s = t.inv.getLocalizedInventoryName() + " "
|
||||
+ t.inv.location.chatString()
|
||||
+ " Distance ["
|
||||
+ t.distance
|
||||
+ "] ";
|
||||
result.add(s);
|
||||
result.add(
|
||||
t.inv.getInventoryNameComponent()
|
||||
.appendText(" " + t.inv.location.chatString() + " ").appendSibling(
|
||||
new ChatComponentTranslation(
|
||||
EnderIO.lang.addPrefix("gui.mjReader.distance"),
|
||||
t.distance)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -202,13 +205,13 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<String> getInputSourcesFor(IItemConduit con, ForgeDirection dir, ItemStack input) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
public List<IChatComponent> getInputSourcesFor(IItemConduit con, ForgeDirection dir, ItemStack input) {
|
||||
List<IChatComponent> result = new ArrayList<>();
|
||||
for (NetworkedInventory inv : inventories) {
|
||||
if (inv.hasTarget(con, dir)) {
|
||||
IItemFilter f = inv.con.getInputFilter(inv.conDir);
|
||||
if (input == null || f == null || f.doesItemPassFilter(inv, input)) {
|
||||
result.add(inv.getLocalizedInventoryName() + " " + inv.location.chatString());
|
||||
result.add(inv.getInventoryNameComponent().appendText(" " + inv.location.chatString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ public class ItemItemConduit extends AbstractItemConduit {
|
||||
// new ItemConduitSubtype(ModObject.itemItemConduit.name(), "enderio:itemItemConduit"),
|
||||
// new ItemConduitSubtype(ModObject.itemItemConduit.name() + "Empowered", "enderio:itemItemConduitAdvanced")
|
||||
// };
|
||||
private static ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
|
||||
private static final ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
|
||||
new ItemConduitSubtype(ModObject.itemItemConduit.name(), "enderio:itemItemConduit") };
|
||||
|
||||
public static ItemItemConduit create() {
|
||||
|
||||
@@ -6,11 +6,15 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityChest;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -25,6 +29,7 @@ import crazypants.enderio.conduit.item.filter.IItemFilter;
|
||||
import crazypants.enderio.conduit.item.filter.ItemFilterLimited;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.invpanel.TileInventoryPanel;
|
||||
import crazypants.util.ForgeDirections;
|
||||
|
||||
public class NetworkedInventory {
|
||||
|
||||
@@ -34,15 +39,15 @@ public class NetworkedInventory {
|
||||
BlockCoord location;
|
||||
int inventorySide;
|
||||
|
||||
List<Target> sendPriority = new ArrayList<Target>();
|
||||
RoundRobinIterator<Target> rrIter = new RoundRobinIterator<Target>(sendPriority);
|
||||
List<Target> sendPriority = new ArrayList<>();
|
||||
RoundRobinIterator<Target> rrIter = new RoundRobinIterator<>(sendPriority);
|
||||
|
||||
private int extractFromSlot = -1;
|
||||
|
||||
int tickDeficit;
|
||||
|
||||
// work around for a vanilla chest changing into a double chest without doing unneeded checks all the time
|
||||
boolean recheckInv = false;
|
||||
private TileEntity connectedTileEntity;
|
||||
|
||||
// Hack for TiC crafting station not working correctly when setting output slot to null
|
||||
boolean ticHack = false;
|
||||
|
||||
@@ -61,19 +66,13 @@ public class NetworkedInventory {
|
||||
this.location = location;
|
||||
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();
|
||||
}
|
||||
|
||||
public boolean isInvalid() {
|
||||
return connectedTileEntity == null || connectedTileEntity.isInvalid();
|
||||
}
|
||||
|
||||
public boolean hasTarget(IItemConduit conduit, ForgeDirection dir) {
|
||||
for (Target t : sendPriority) {
|
||||
if (t.inv.con == conduit && t.inv.conDir == dir) {
|
||||
@@ -110,6 +109,13 @@ public class NetworkedInventory {
|
||||
}
|
||||
|
||||
public void onTick() {
|
||||
if (isInvalid()) {
|
||||
updateInventory();
|
||||
if (isInvalid()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (tickDeficit > 0 || !canExtract() || !con.isExtractionRedstoneConditionMet(conDir)) {
|
||||
// do nothing
|
||||
} else {
|
||||
@@ -144,11 +150,6 @@ public class NetworkedInventory {
|
||||
}
|
||||
|
||||
private boolean transferItems() {
|
||||
|
||||
if (recheckInv) {
|
||||
updateInventory();
|
||||
}
|
||||
|
||||
int[] slotIndices = getInventory().getAccessibleSlotsFromSide(inventorySide);
|
||||
if (slotIndices == null) {
|
||||
return false;
|
||||
@@ -257,9 +258,6 @@ public class NetworkedInventory {
|
||||
matchedStickyInput = of != null && of.isValid() && of.doesItemPassFilter(this, toExtract);
|
||||
}
|
||||
if (target.stickyInput || !matchedStickyInput) {
|
||||
if (target.inv.recheckInv) {
|
||||
target.inv.updateInventory();
|
||||
}
|
||||
int inserted = target.inv.insertItem(toExtract);
|
||||
if (inserted > 0) {
|
||||
toExtract.stackSize -= inserted;
|
||||
@@ -281,15 +279,38 @@ public class NetworkedInventory {
|
||||
}
|
||||
|
||||
public final void updateInventory() {
|
||||
TileEntity te = world.getTileEntity(location.x, location.y, location.z);
|
||||
if (te instanceof ISidedInventory) {
|
||||
inv = (ISidedInventory) te;
|
||||
} else if (te instanceof IInventory) {
|
||||
inv = new InventoryWrapper((IInventory) te);
|
||||
TileEntity newTe = world.getTileEntity(location.x, location.y, location.z);
|
||||
if (newTe != connectedTileEntity) {
|
||||
connectedTileEntity = newTe;
|
||||
ticHack = false;
|
||||
inventoryPanel = false;
|
||||
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) {
|
||||
if (isInvalid()) {
|
||||
updateInventory();
|
||||
if (isInvalid()) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!canInsert() || item == null) {
|
||||
return 0;
|
||||
}
|
||||
@@ -312,7 +333,7 @@ public class NetworkedInventory {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return ItemUtil.doInsertItem(getInventory(), item, ForgeDirection.values()[inventorySide]);
|
||||
return ItemUtil.doInsertItem(getInventory(), item, ForgeDirections.DIRECTIONS[inventorySide]);
|
||||
}
|
||||
|
||||
void updateInsertOrder() {
|
||||
@@ -320,7 +341,7 @@ public class NetworkedInventory {
|
||||
if (!canExtract()) {
|
||||
return;
|
||||
}
|
||||
List<Target> result = new ArrayList<NetworkedInventory.Target>();
|
||||
List<Target> result = new ArrayList<>();
|
||||
|
||||
for (NetworkedInventory other : network.inventories) {
|
||||
if ((con.isSelfFeedEnabled(conDir) || (other != this)) && other.canInsert()
|
||||
@@ -338,8 +359,8 @@ public class NetworkedInventory {
|
||||
Collections.sort(sendPriority);
|
||||
} else {
|
||||
if (!result.isEmpty()) {
|
||||
Map<BlockCoord, Integer> visited = new HashMap<BlockCoord, Integer>();
|
||||
List<BlockCoord> steps = new ArrayList<BlockCoord>();
|
||||
Map<BlockCoord, Integer> visited = new HashMap<>();
|
||||
List<BlockCoord> steps = new ArrayList<>();
|
||||
steps.add(con.getLocation());
|
||||
calculateDistances(result, visited, steps, 0);
|
||||
|
||||
@@ -356,7 +377,7 @@ public class NetworkedInventory {
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<BlockCoord> nextSteps = new ArrayList<BlockCoord>();
|
||||
ArrayList<BlockCoord> nextSteps = new ArrayList<>();
|
||||
for (BlockCoord bc : steps) {
|
||||
IItemConduit con = network.conMap.get(bc);
|
||||
if (con != null) {
|
||||
@@ -409,8 +430,8 @@ public class NetworkedInventory {
|
||||
return inv;
|
||||
}
|
||||
|
||||
public ISidedInventory getInventoryRecheck() {
|
||||
if (recheckInv) {
|
||||
public @Nullable ISidedInventory getInventoryRecheck() {
|
||||
if (isInvalid()) {
|
||||
updateInventory();
|
||||
}
|
||||
return inv;
|
||||
@@ -424,6 +445,10 @@ public class NetworkedInventory {
|
||||
this.inventorySide = inventorySide;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Translates on the server. Use {@link #getInventoryNameComponent()} for chat.
|
||||
*/
|
||||
@Deprecated
|
||||
public String getLocalizedInventoryName() {
|
||||
String inventoryName = getInventory().getInventoryName();
|
||||
if (inventoryName == null) {
|
||||
@@ -435,6 +460,22 @@ 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> {
|
||||
|
||||
NetworkedInventory inv;
|
||||
|
||||
@@ -47,8 +47,8 @@ public class ExistingItemFilter implements IItemFilter {
|
||||
|
||||
private boolean isStackInInventory(NetworkedInventory ni, ItemStack item) {
|
||||
int[] slots = ni.getInventory().getAccessibleSlotsFromSide(ni.getInventorySide());
|
||||
for (int i = 0; i < slots.length; i++) {
|
||||
ItemStack stack = ni.getInventory().getStackInSlot(i);
|
||||
for (int slot : slots) {
|
||||
ItemStack stack = ni.getInventory().getStackInSlot(slot);
|
||||
if (stackEqual(item, stack)) {
|
||||
return true;
|
||||
}
|
||||
@@ -107,17 +107,17 @@ public class ExistingItemFilter implements IItemFilter {
|
||||
}
|
||||
|
||||
public void setSnapshot(NetworkedInventory ni) {
|
||||
snapshot = new ArrayList<ItemStack>();
|
||||
snapshot = new ArrayList<>();
|
||||
mergeSnapshot(ni);
|
||||
}
|
||||
|
||||
public void mergeSnapshot(NetworkedInventory ni) {
|
||||
if (snapshot == null) {
|
||||
snapshot = new ArrayList<ItemStack>();
|
||||
snapshot = new ArrayList<>();
|
||||
}
|
||||
int[] slots = ni.getInventory().getAccessibleSlotsFromSide(ni.getInventorySide());
|
||||
for (int i = 0; i < slots.length; i++) {
|
||||
ItemStack stack = ni.getInventory().getStackInSlot(i);
|
||||
for (int slot : slots) {
|
||||
ItemStack stack = ni.getInventory().getStackInSlot(slot);
|
||||
if (stack != null && !isStackInSnapshot(stack)) {
|
||||
snapshot.add(stack);
|
||||
}
|
||||
@@ -126,7 +126,7 @@ public class ExistingItemFilter implements IItemFilter {
|
||||
|
||||
public boolean mergeSnapshot(IInventory inventory) {
|
||||
if (snapshot == null) {
|
||||
snapshot = new ArrayList<ItemStack>();
|
||||
snapshot = new ArrayList<>();
|
||||
}
|
||||
int size = inventory.getSizeInventory();
|
||||
boolean added = false;
|
||||
@@ -200,7 +200,7 @@ public class ExistingItemFilter implements IItemFilter {
|
||||
readSettingsFromNBT(nbtRoot);
|
||||
|
||||
if (nbtRoot.hasKey("snapshot")) {
|
||||
snapshot = new ArrayList<ItemStack>();
|
||||
snapshot = new ArrayList<>();
|
||||
NBTTagList itemList = (NBTTagList) nbtRoot.getTag("snapshot");
|
||||
for (int i = 0; i < itemList.tagCount(); i++) {
|
||||
NBTTagCompound itemTag = itemList.getCompoundTagAt(i);
|
||||
@@ -274,7 +274,7 @@ public class ExistingItemFilter implements IItemFilter {
|
||||
snapshot = null;
|
||||
return;
|
||||
}
|
||||
snapshot = new ArrayList<ItemStack>(numItems);
|
||||
snapshot = new ArrayList<>(numItems);
|
||||
for (int i = 0; i < numItems; i++) {
|
||||
NBTTagCompound itemTag = NetworkUtil.readNBTTagCompound(buf);
|
||||
ItemStack item = ItemStack.loadItemStackFromNBT(itemTag);
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -67,7 +68,7 @@ public class ItemExistingItemFilter extends Item implements IItemFilterUpgrade,
|
||||
ExistingItemFilter filter = (ExistingItemFilter) createFilterFromStack(item);
|
||||
String unloc = "item.itemExistingItemFilter."
|
||||
+ (filter.mergeSnapshot(inv) ? "filterUpdated" : "filterNotUpdated");
|
||||
ChatUtil.sendNoSpamUnloc(player, EnderIO.lang, unloc);
|
||||
ChatUtil.sendNoSpam(player, new ChatComponentTranslation(EnderIO.lang.addPrefix(unloc)));
|
||||
FilterRegister.writeFilterToStack(filter, item);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class ItemFilter implements IInventory, IItemFilter {
|
||||
this.isAdvanced = isAdvanced;
|
||||
this.numItems = numItems;
|
||||
items = new ItemStack[numItems];
|
||||
oreIds = new ArrayList<int[]>(numItems);
|
||||
oreIds = new ArrayList<>(numItems);
|
||||
for (int i = 0; i < numItems; i++) {
|
||||
oreIds.add(null);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.function.IntSupplier;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -89,35 +89,31 @@ public abstract class AbstractEnderLiquidConduit extends AbstractLiquidConduit {
|
||||
|
||||
STELLAR(() -> Config.stellarEnderFluidConduitExtractRate, () -> Config.stellarEnderFluidConduitMaxIoRate);
|
||||
|
||||
private final Supplier<Integer> getMaxExtractPerTick;
|
||||
private final Supplier<Integer> getMaxIoPerTick;
|
||||
private final IntSupplier getMaxExtractPerTick;
|
||||
private final IntSupplier getMaxIoPerTick;
|
||||
|
||||
Type(Supplier<Integer> getMaxExtractPerTick, Supplier<Integer> getMaxIoPerTick) {
|
||||
Type(IntSupplier getMaxExtractPerTick, IntSupplier getMaxIoPerTick) {
|
||||
this.getMaxExtractPerTick = getMaxExtractPerTick;
|
||||
this.getMaxIoPerTick = getMaxIoPerTick;
|
||||
}
|
||||
|
||||
public int getMaxExtractPerTick() {
|
||||
return getMaxExtractPerTick.get();
|
||||
return getMaxExtractPerTick.getAsInt();
|
||||
}
|
||||
|
||||
public int getMaxIoPerTick() {
|
||||
return getMaxIoPerTick.get();
|
||||
return getMaxIoPerTick.getAsInt();
|
||||
}
|
||||
}
|
||||
|
||||
private EnderLiquidConduitNetwork network;
|
||||
private int ticksSinceFailedExtract;
|
||||
|
||||
private final EnumMap<ForgeDirection, FluidFilter> outputFilters = new EnumMap<ForgeDirection, FluidFilter>(
|
||||
ForgeDirection.class);
|
||||
private final EnumMap<ForgeDirection, FluidFilter> inputFilters = new EnumMap<ForgeDirection, FluidFilter>(
|
||||
ForgeDirection.class);
|
||||
private final EnumMap<ForgeDirection, FluidFilter> outputFilters = new EnumMap<>(ForgeDirection.class);
|
||||
private final EnumMap<ForgeDirection, FluidFilter> inputFilters = new EnumMap<>(ForgeDirection.class);
|
||||
|
||||
protected final EnumMap<ForgeDirection, DyeColor> outputColors = new EnumMap<ForgeDirection, DyeColor>(
|
||||
ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> inputColors = new EnumMap<ForgeDirection, DyeColor>(
|
||||
ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> outputColors = new EnumMap<>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> inputColors = new EnumMap<>(ForgeDirection.class);
|
||||
|
||||
private int roundRobin = 0;
|
||||
|
||||
@@ -424,10 +420,10 @@ public abstract class AbstractEnderLiquidConduit extends AbstractLiquidConduit {
|
||||
super.readTypeSettings(dir, dataRoot);
|
||||
|
||||
if (dataRoot.hasKey("inputColor")) {
|
||||
setInputColor(dir, DyeColor.values()[dataRoot.getShort("inputColor")]);
|
||||
setInputColor(dir, DyeColor.VALUES[dataRoot.getShort("inputColor")]);
|
||||
}
|
||||
if (dataRoot.hasKey("outputColor")) {
|
||||
setOutputColor(dir, DyeColor.values()[dataRoot.getShort("outputColor")]);
|
||||
setOutputColor(dir, DyeColor.VALUES[dataRoot.getShort("outputColor")]);
|
||||
}
|
||||
|
||||
if (dataRoot.hasKey("roundRobin")) {
|
||||
@@ -542,16 +538,16 @@ public abstract class AbstractEnderLiquidConduit extends AbstractLiquidConduit {
|
||||
key = "inSC." + dir.name();
|
||||
if (nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if (ord >= 0 && ord < DyeColor.values().length) {
|
||||
inputColors.put(dir, DyeColor.values()[ord]);
|
||||
if (ord >= 0 && ord < DyeColor.VALUES.length) {
|
||||
inputColors.put(dir, DyeColor.VALUES[ord]);
|
||||
}
|
||||
}
|
||||
|
||||
key = "outSC." + dir.name();
|
||||
if (nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if (ord >= 0 && ord < DyeColor.values().length) {
|
||||
outputColors.put(dir, DyeColor.values()[ord]);
|
||||
if (ord >= 0 && ord < DyeColor.VALUES.length) {
|
||||
outputColors.put(dir, DyeColor.VALUES[ord]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,12 +29,10 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
|
||||
|
||||
public abstract class AbstractLiquidConduit extends AbstractConduit implements ILiquidConduit {
|
||||
|
||||
protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes = new EnumMap<ForgeDirection, RedstoneControlMode>(
|
||||
ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> extractionColors = new EnumMap<ForgeDirection, DyeColor>(
|
||||
ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes = new EnumMap<>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> extractionColors = new EnumMap<>(ForgeDirection.class);
|
||||
|
||||
protected final Map<ForgeDirection, Integer> externalRedstoneSignals = new HashMap<ForgeDirection, Integer>();
|
||||
protected final Map<ForgeDirection, Integer> externalRedstoneSignals = new HashMap<>();
|
||||
protected boolean redstoneStateDirty = true;
|
||||
|
||||
public static IFluidHandler getExternalFluidHandler(IBlockAccess world, BlockCoord bc) {
|
||||
@@ -204,8 +202,8 @@ public abstract class AbstractLiquidConduit extends AbstractConduit implements I
|
||||
|
||||
@Override
|
||||
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
setExtractionSignalColor(dir, DyeColor.values()[dataRoot.getShort("extractionSignalColor")]);
|
||||
setExtractionRedstoneMode(RedstoneControlMode.values()[dataRoot.getShort("extractionRedstoneMode")], dir);
|
||||
setExtractionSignalColor(dir, DyeColor.VALUES[dataRoot.getShort("extractionSignalColor")]);
|
||||
setExtractionRedstoneMode(RedstoneControlMode.VALUES[dataRoot.getShort("extractionRedstoneMode")], dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -241,15 +239,15 @@ public abstract class AbstractLiquidConduit extends AbstractConduit implements I
|
||||
String key = "extRM." + dir.name();
|
||||
if (nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if (ord >= 0 && ord < RedstoneControlMode.values().length) {
|
||||
extractionModes.put(dir, RedstoneControlMode.values()[ord]);
|
||||
if (ord >= 0 && ord < RedstoneControlMode.VALUES.length) {
|
||||
extractionModes.put(dir, RedstoneControlMode.VALUES[ord]);
|
||||
}
|
||||
}
|
||||
key = "extSC." + dir.name();
|
||||
if (nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if (ord >= 0 && ord < DyeColor.values().length) {
|
||||
extractionColors.put(dir, DyeColor.values()[ord]);
|
||||
if (ord >= 0 && ord < DyeColor.VALUES.length) {
|
||||
extractionColors.put(dir, DyeColor.VALUES[ord]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,15 +7,16 @@ import java.util.Set;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import com.enderio.core.common.util.ChatUtil;
|
||||
import com.gtnewhorizon.gtnhlib.chat.customcomponents.ChatComponentFluidName;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
@@ -110,7 +111,9 @@ public abstract class AbstractTankConduit extends AbstractLiquidConduit {
|
||||
if (network.fluidTypeLocked) {
|
||||
network.setFluidTypeLocked(false);
|
||||
numEmptyEvents = 0;
|
||||
ChatUtil.sendNoSpamUnloc(player, EnderIO.lang, "itemLiquidConduit.unlockedType");
|
||||
ChatUtil.sendNoSpam(
|
||||
player,
|
||||
new ChatComponentTranslation(EnderIO.lang.addPrefix("itemLiquidConduit.unlockedType")));
|
||||
}
|
||||
} else if (network != null) {
|
||||
network.setFluidType(null);
|
||||
@@ -128,11 +131,10 @@ public abstract class AbstractTankConduit extends AbstractLiquidConduit {
|
||||
|| LiquidConduitNetwork.areFluidsCompatable(getFluidType(), fluid))) {
|
||||
network.setFluidType(fluid);
|
||||
network.setFluidTypeLocked(true);
|
||||
ChatUtil.sendNoSpamUnloc(
|
||||
ChatUtil.sendNoSpam(
|
||||
player,
|
||||
EnderIO.lang,
|
||||
"itemLiquidConduit.lockedType",
|
||||
" " + FluidRegistry.getFluidName(fluid));
|
||||
new ChatComponentTranslation(EnderIO.lang.addPrefix("itemLiquidConduit.lockedType"))
|
||||
.appendText(" ").appendSibling(new ChatComponentFluidName(fluid)));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -19,7 +19,7 @@ public class AdvancedLiquidConduitNetwork extends AbstractTankConduitNetwork<Adv
|
||||
|
||||
private final ConduitTank tank = new ConduitTank(0);
|
||||
|
||||
private final Set<LiquidOutput> outputs = new HashSet<LiquidOutput>();
|
||||
private final Set<LiquidOutput> outputs = new HashSet<>();
|
||||
|
||||
private Iterator<LiquidOutput> outputIterator;
|
||||
|
||||
|
||||
@@ -58,8 +58,8 @@ public class EnderLiquidConduitNetwork extends AbstractConduitNetwork<ILiquidCon
|
||||
|
||||
private final AbstractEnderLiquidConduit.Type type;
|
||||
|
||||
List<NetworkTank> tanks = new ArrayList<NetworkTank>();
|
||||
Map<NetworkTankKey, NetworkTank> tankMap = new HashMap<NetworkTankKey, NetworkTank>();
|
||||
List<NetworkTank> tanks = new ArrayList<>();
|
||||
Map<NetworkTankKey, NetworkTank> tankMap = new HashMap<>();
|
||||
|
||||
Map<NetworkTank, TankIterator> iterators;
|
||||
|
||||
@@ -85,11 +85,13 @@ public class EnderLiquidConduitNetwork extends AbstractConduitNetwork<ILiquidCon
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tank.externalTank.getTankInfo(conDir.getOpposite()) != null) {
|
||||
for (FluidTankInfo tankInfo : tank.externalTank.getTankInfo(conDir.getOpposite())) {
|
||||
FluidTankInfo[] tankInfos = tank.externalTank.getTankInfo(conDir.getOpposite());
|
||||
if (tankInfos != null) {
|
||||
for (FluidTankInfo tankInfo : tankInfos) {
|
||||
if (tankInfo == null || tankInfo.fluid == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
FluidStack tryDrain = tankInfo.fluid.copy();
|
||||
tryDrain.amount = type.getMaxExtractPerTick();
|
||||
FluidStack drained = tank.externalTank.drain(conDir.getOpposite(), tryDrain, false);
|
||||
@@ -98,10 +100,12 @@ public class EnderLiquidConduitNetwork extends AbstractConduitNetwork<ILiquidCon
|
||||
|| !tryDrain.isFluidEqual(drained)) {
|
||||
continue;
|
||||
}
|
||||
int amountAccepted = fillFrom(tank, drained.copy(), true);
|
||||
|
||||
int amountAccepted = fillFrom(tank, drained, true);
|
||||
if (amountAccepted <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
tryDrain.amount = amountAccepted;
|
||||
drained = tank.externalTank.drain(conDir.getOpposite(), tryDrain, true);
|
||||
if (drained == null || drained.amount <= 0) {
|
||||
@@ -115,7 +119,7 @@ public class EnderLiquidConduitNetwork extends AbstractConduitNetwork<ILiquidCon
|
||||
if (drained == null || drained.amount <= 0 || !matchedFilter(drained, con, conDir, true)) {
|
||||
return false;
|
||||
}
|
||||
int amountAccepted = fillFrom(tank, drained.copy(), true);
|
||||
int amountAccepted = fillFrom(tank, drained, true);
|
||||
if (amountAccepted <= 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -147,7 +151,6 @@ public class EnderLiquidConduitNetwork extends AbstractConduitNetwork<ILiquidCon
|
||||
resource = resource.copy();
|
||||
resource.amount = Math.min(resource.amount, type.getMaxIoPerTick());
|
||||
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
|
||||
|
||||
TankIterator iterator;
|
||||
@@ -158,13 +161,13 @@ public class EnderLiquidConduitNetwork extends AbstractConduitNetwork<ILiquidCon
|
||||
&& target.acceptsOuput
|
||||
&& target.isValid()
|
||||
&& matchedFilter(resource, target.con, target.conDir, false)) {
|
||||
int vol = target.externalTank.fill(target.tankDir, resource.copy(), doFill);
|
||||
remaining -= vol;
|
||||
// Use reused FluidStack instead of copying each iteration
|
||||
int vol = target.externalTank.fill(target.tankDir, resource, doFill);
|
||||
resource.amount -= vol;
|
||||
filled += vol;
|
||||
if (remaining <= 0) {
|
||||
if (resource.amount <= 0) {
|
||||
break;
|
||||
}
|
||||
resource.amount = remaining;
|
||||
}
|
||||
}
|
||||
if (!tank.con.isRoundRobin(tank.conDir)) iterator.rewind();
|
||||
@@ -200,7 +203,7 @@ public class EnderLiquidConduitNetwork extends AbstractConduitNetwork<ILiquidCon
|
||||
}
|
||||
|
||||
public FluidTankInfo[] getTankInfo(AbstractEnderLiquidConduit con, ForgeDirection conDir) {
|
||||
List<FluidTankInfo> res = new ArrayList<FluidTankInfo>(tanks.size());
|
||||
List<FluidTankInfo> res = new ArrayList<>(tanks.size());
|
||||
NetworkTank tank = getTank(con, conDir);
|
||||
for (NetworkTank target : tanks) {
|
||||
if (!target.equals(tank) && target.isValid()) {
|
||||
|
||||
@@ -19,7 +19,7 @@ import crazypants.enderio.config.Config;
|
||||
|
||||
public class ItemLiquidConduit extends AbstractItemConduit implements IAdvancedTooltipProvider {
|
||||
|
||||
private static ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
|
||||
private static final ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
|
||||
new ItemConduitSubtype(ModObject.itemLiquidConduit.name(), "enderio:itemLiquidConduit"),
|
||||
new ItemConduitSubtype(
|
||||
ModObject.itemLiquidConduit.name() + "Advanced",
|
||||
|
||||
@@ -21,10 +21,10 @@ public class LiquidConduitNetwork extends AbstractTankConduitNetwork<LiquidCondu
|
||||
|
||||
private int ticksEmpty = 0;
|
||||
|
||||
private int maxFlowsPerTick = 10;
|
||||
private static final int maxFlowsPerTick = 10;
|
||||
private int lastFlowIndex = 0;
|
||||
|
||||
private boolean printFlowTiming = false;
|
||||
private static final boolean printFlowTiming = false;
|
||||
|
||||
private int lastPushToken = 0;
|
||||
|
||||
@@ -100,7 +100,7 @@ public class LiquidConduitNetwork extends AbstractTankConduitNetwork<LiquidCondu
|
||||
private boolean doFlow() {
|
||||
|
||||
int pushToken = getNextPushToken();
|
||||
List<FlowAction> actions = new ArrayList<FlowAction>();
|
||||
List<FlowAction> actions = new ArrayList<>();
|
||||
for (int i = 0; i < Math.min(maxFlowsPerTick, conduits.size()); i++) {
|
||||
|
||||
if (lastFlowIndex >= conduits.size()) {
|
||||
@@ -116,7 +116,7 @@ public class LiquidConduitNetwork extends AbstractTankConduitNetwork<LiquidCondu
|
||||
boolean result = !actions.isEmpty();
|
||||
|
||||
// Flush any tanks with a tiny bit left
|
||||
List<LiquidConduit> toEmpty = new ArrayList<LiquidConduit>();
|
||||
List<LiquidConduit> toEmpty = new ArrayList<>();
|
||||
for (LiquidConduit con : conduits) {
|
||||
if (con != null && con.getTank().getFluidAmount() < 10) {
|
||||
toEmpty.add(con);
|
||||
@@ -129,7 +129,7 @@ public class LiquidConduitNetwork extends AbstractTankConduitNetwork<LiquidCondu
|
||||
return result;
|
||||
}
|
||||
|
||||
List<LocatedFluidHandler> externals = new ArrayList<LocatedFluidHandler>();
|
||||
List<LocatedFluidHandler> externals = new ArrayList<>();
|
||||
for (AbstractTankConduit con : conduits) {
|
||||
Set<ForgeDirection> extCons = con.getExternalConnections();
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import crazypants.enderio.gui.IconEIO;
|
||||
|
||||
public class ItemMEConduit extends AbstractItemConduit {
|
||||
|
||||
private static ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
|
||||
private static final ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
|
||||
new ItemConduitSubtype(ModObject.itemMEConduit.name(), "enderio:itemMeConduit"),
|
||||
new ItemConduitSubtype(ModObject.itemMEConduit.name() + "Dense", "enderio:itemMeConduitDense") };
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import crazypants.enderio.gui.IconEIO;
|
||||
|
||||
public class ItemOCConduit extends AbstractItemConduit {
|
||||
|
||||
private static ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
|
||||
private static final ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
|
||||
new ItemConduitSubtype(ModObject.itemOCConduit.name(), "enderio:itemOCConduit") };
|
||||
|
||||
public static ItemOCConduit create() {
|
||||
|
||||
@@ -15,7 +15,9 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -49,7 +51,7 @@ public class OCConduit extends AbstractConduit implements IOCConduit {
|
||||
|
||||
protected OCConduitNetwork network;
|
||||
|
||||
private Map<ForgeDirection, DyeColor> signalColors = new HashMap<ForgeDirection, DyeColor>();
|
||||
private final Map<ForgeDirection, DyeColor> signalColors = new HashMap<>();
|
||||
|
||||
public static IIcon[] coreTextures;
|
||||
public static IIcon[] longTextures;
|
||||
@@ -86,7 +88,7 @@ public class OCConduit extends AbstractConduit implements IOCConduit {
|
||||
|
||||
@Override
|
||||
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
setSignalColor(dir, DyeColor.values()[dataRoot.getShort("signalColor")]);
|
||||
setSignalColor(dir, DyeColor.VALUES[dataRoot.getShort("signalColor")]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,7 +115,7 @@ public class OCConduit extends AbstractConduit implements IOCConduit {
|
||||
BoundingBox bb = ConduitGeometryUtil.instance.createBoundsForConnectionController(key.dir, key.offset);
|
||||
CollidableComponent cc = new CollidableComponent(IOCConduit.class, bb, key.dir, COLOR_CONTROLLER_ID);
|
||||
|
||||
List<CollidableComponent> result = new ArrayList<CollidableComponent>();
|
||||
List<CollidableComponent> result = new ArrayList<>();
|
||||
result.addAll(baseCollidables);
|
||||
result.add(cc);
|
||||
|
||||
@@ -148,7 +150,7 @@ public class OCConduit extends AbstractConduit implements IOCConduit {
|
||||
int i = 0;
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (cols[i] >= 0) {
|
||||
signalColors.put(dir, DyeColor.values()[cols[i]]);
|
||||
signalColors.put(dir, DyeColor.VALUES[cols[i]]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@@ -213,14 +215,20 @@ public class OCConduit extends AbstractConduit implements IOCConduit {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String prettyNode(Node o) {
|
||||
String at = "";
|
||||
private static IChatComponent prettyNode(Node o) {
|
||||
Environment host = o.host();
|
||||
String name = host.getClass().getName().replaceFirst("^.*\\.", "");
|
||||
if (host instanceof TileEntity) {
|
||||
BlockCoord bc = new BlockCoord((TileEntity) host);
|
||||
at = " at " + bc.x + "/" + bc.y + "/" + bc.z;
|
||||
return new ChatComponentTranslation(
|
||||
EnderIO.lang.addPrefix("itemOCConduit.chat.nodeAt"),
|
||||
name,
|
||||
coords(new BlockCoord((TileEntity) host)));
|
||||
}
|
||||
return host.getClass().getName().replaceFirst("^.*\\.", "") + at;
|
||||
return new ChatComponentText(name);
|
||||
}
|
||||
|
||||
private static String coords(BlockCoord bc) {
|
||||
return bc.x + "/" + bc.y + "/" + bc.z;
|
||||
}
|
||||
|
||||
private static EnumChatFormatting dye2chat(DyeColor dyeColor) {
|
||||
@@ -274,26 +282,37 @@ public class OCConduit extends AbstractConduit implements IOCConduit {
|
||||
BlockCoord bc = getLocation();
|
||||
if (network != null) {
|
||||
boolean noconnections = true;
|
||||
for (DyeColor color : DyeColor.values()) {
|
||||
for (DyeColor color : DyeColor.VALUES) {
|
||||
if (node(color).neighbors().iterator().hasNext()) {
|
||||
noconnections = false;
|
||||
ChatComponentText coltxt = new ChatComponentText(color.getLocalisedName());
|
||||
ChatComponentTranslation coltxt = new ChatComponentTranslation(
|
||||
DyeColor.DYE_ORE_UNLOCAL_NAMES[color.ordinal()]);
|
||||
coltxt.getChatStyle().setColor(dye2chat(color));
|
||||
ChatComponentText chantxt = new ChatComponentText("Channel ");
|
||||
chantxt.appendSibling(coltxt);
|
||||
chantxt.appendText(" at " + bc.x + "/" + bc.y + "/" + bc.z);
|
||||
player.addChatMessage(chantxt);
|
||||
player.addChatMessage(
|
||||
new ChatComponentTranslation(
|
||||
EnderIO.lang.addPrefix("itemOCConduit.chat.channel"),
|
||||
coltxt,
|
||||
coords(bc)));
|
||||
for (Node other : node(color).neighbors()) {
|
||||
player.addChatMessage(new ChatComponentText(" Connected to: " + prettyNode(other)));
|
||||
player.addChatMessage(
|
||||
new ChatComponentText(" ").appendSibling(
|
||||
new ChatComponentTranslation(
|
||||
EnderIO.lang.addPrefix("itemOCConduit.chat.connectedTo"),
|
||||
prettyNode(other))));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (noconnections) {
|
||||
player.addChatMessage(
|
||||
new ChatComponentText("No connections at " + bc.x + "/" + bc.y + "/" + bc.z));
|
||||
new ChatComponentTranslation(
|
||||
EnderIO.lang.addPrefix("itemOCConduit.chat.noConnections"),
|
||||
coords(bc)));
|
||||
}
|
||||
} else {
|
||||
player.addChatMessage(new ChatComponentText("No network at " + bc.x + "/" + bc.y + "/" + bc.z));
|
||||
player.addChatMessage(
|
||||
new ChatComponentTranslation(
|
||||
EnderIO.lang.addPrefix("itemOCConduit.chat.noNetwork"),
|
||||
coords(bc)));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -350,8 +369,8 @@ public class OCConduit extends AbstractConduit implements IOCConduit {
|
||||
if (loc != null && network != null) {
|
||||
World world = getBundle().getWorld();
|
||||
EnumSet<ForgeDirection> conns = getConnections();
|
||||
for (DyeColor color : DyeColor.values()) {
|
||||
Set<Node> should = new HashSet<Node>();
|
||||
for (DyeColor color : DyeColor.VALUES) {
|
||||
Set<Node> should = new HashSet<>();
|
||||
for (ForgeDirection direction : conns) {
|
||||
if (getSignalColor(direction) == color) {
|
||||
TileEntity te = getLocation().getLocation(direction).getTileEntity(world);
|
||||
@@ -417,7 +436,7 @@ public class OCConduit extends AbstractConduit implements IOCConduit {
|
||||
// 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
|
||||
// be just one, may be many.
|
||||
List<TileEntity> toCheck = new ArrayList<TileEntity>();
|
||||
List<TileEntity> toCheck = new ArrayList<>();
|
||||
if (otherHost instanceof TileEntity) {
|
||||
TileEntity otherTe = (TileEntity) otherHost;
|
||||
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")
|
||||
public class OCConduitNetwork extends AbstractConduitNetwork<IOCConduit, IOCConduit> implements ManagedEnvironment {
|
||||
|
||||
private Node[] node = new Node[DyeColor.values().length];
|
||||
private final Node[] node = new Node[DyeColor.VALUES.length];
|
||||
|
||||
public OCConduitNetwork() {
|
||||
super(IOCConduit.class, IOCConduit.class);
|
||||
for (DyeColor dyeColor : DyeColor.values()) {
|
||||
for (DyeColor dyeColor : DyeColor.VALUES) {
|
||||
node[dyeColor.ordinal()] = Network.newNode(this, Visibility.Network).create();
|
||||
Network.joinNewNetwork(node[dyeColor.ordinal()]);
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class OCConduitNetwork extends AbstractConduitNetwork<IOCConduit, IOCCond
|
||||
|
||||
@Override
|
||||
public void destroyNetwork() {
|
||||
for (DyeColor dyeColor : DyeColor.values()) {
|
||||
for (DyeColor dyeColor : DyeColor.VALUES) {
|
||||
node[dyeColor.ordinal()].remove();
|
||||
}
|
||||
super.destroyNetwork();
|
||||
|
||||
@@ -8,6 +8,7 @@ import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class PacketConnectionMode extends AbstractConduitPacket<IConduit>
|
||||
@@ -34,8 +35,8 @@ public class PacketConnectionMode extends AbstractConduitPacket<IConduit>
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
dir = ForgeDirection.values()[buf.readShort()];
|
||||
mode = ConnectionMode.values()[buf.readShort()];
|
||||
dir = ForgeDirections.DIRECTIONS[buf.readShort()];
|
||||
mode = ConnectionMode.VALUES[buf.readShort()];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,6 +9,7 @@ import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import crazypants.enderio.conduit.IExtractor;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class PacketExtractMode extends AbstractConduitPacket<IExtractor>
|
||||
@@ -38,9 +39,9 @@ public class PacketExtractMode extends AbstractConduitPacket<IExtractor>
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
dir = ForgeDirection.values()[buf.readShort()];
|
||||
mode = RedstoneControlMode.values()[buf.readShort()];
|
||||
color = DyeColor.values()[buf.readShort()];
|
||||
dir = ForgeDirections.DIRECTIONS[buf.readShort()];
|
||||
mode = RedstoneControlMode.VALUES[buf.readShort()];
|
||||
color = DyeColor.VALUES[buf.readShort()];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,6 +10,7 @@ import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import crazypants.enderio.conduit.item.FilterRegister;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.item.filter.IItemFilter;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class PacketItemConduitFilter extends AbstractConduitPacket<IItemConduit>
|
||||
@@ -56,12 +57,12 @@ public class PacketItemConduitFilter extends AbstractConduitPacket<IItemConduit>
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
dir = ForgeDirection.values()[buf.readShort()];
|
||||
dir = ForgeDirections.DIRECTIONS[buf.readShort()];
|
||||
loopMode = buf.readBoolean();
|
||||
roundRobin = buf.readBoolean();
|
||||
priority = buf.readInt();
|
||||
colIn = DyeColor.values()[buf.readShort()];
|
||||
colOut = DyeColor.values()[buf.readShort()];
|
||||
colIn = DyeColor.VALUES[buf.readShort()];
|
||||
colOut = DyeColor.VALUES[buf.readShort()];
|
||||
inputFilter = FilterRegister.readFilter(buf);
|
||||
outputFilter = FilterRegister.readFilter(buf);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import crazypants.enderio.conduit.oc.IOCConduit;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class PacketOCConduitSignalColor extends AbstractConduitPacket<IOCConduit>
|
||||
@@ -34,8 +35,8 @@ public class PacketOCConduitSignalColor extends AbstractConduitPacket<IOCConduit
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
dir = ForgeDirection.values()[buf.readShort()];
|
||||
col = DyeColor.values()[buf.readShort()];
|
||||
dir = ForgeDirections.DIRECTIONS[buf.readShort()];
|
||||
col = DyeColor.VALUES[buf.readShort()];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@ import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class PacketRedstoneConduitOutputStrength extends AbstractConduitPacket<IInsulatedRedstoneConduit>
|
||||
@@ -32,7 +33,7 @@ public class PacketRedstoneConduitOutputStrength extends AbstractConduitPacket<I
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
dir = ForgeDirection.values()[buf.readShort()];
|
||||
dir = ForgeDirections.DIRECTIONS[buf.readShort()];
|
||||
isStrong = buf.readBoolean();
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -8,6 +8,7 @@ import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class PacketRedstoneConduitSignalColor extends AbstractConduitPacket<IInsulatedRedstoneConduit>
|
||||
@@ -34,8 +35,8 @@ public class PacketRedstoneConduitSignalColor extends AbstractConduitPacket<IIns
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
dir = ForgeDirection.values()[buf.readShort()];
|
||||
col = DyeColor.values()[buf.readShort()];
|
||||
dir = ForgeDirections.DIRECTIONS[buf.readShort()];
|
||||
col = DyeColor.VALUES[buf.readShort()];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,6 +7,7 @@ import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import crazypants.enderio.conduit.liquid.AbstractEnderLiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class PacketRoundRobinMode extends AbstractConduitPacket<ILiquidConduit>
|
||||
@@ -33,7 +34,7 @@ public class PacketRoundRobinMode extends AbstractConduitPacket<ILiquidConduit>
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
dir = ForgeDirection.values()[buf.readShort()];
|
||||
dir = ForgeDirections.DIRECTIONS[buf.readShort()];
|
||||
roundRobin = buf.readBoolean();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,17 +26,17 @@ public class NetworkPowerManager {
|
||||
int maxEnergyStored;
|
||||
int energyStored;
|
||||
|
||||
private int updateRenderTicks = 10;
|
||||
private int inactiveTicks = 100;
|
||||
private static final int updateRenderTicks = 10;
|
||||
private static final int inactiveTicks = 100;
|
||||
|
||||
private final List<ReceptorEntry> receptors = new ArrayList<PowerConduitNetwork.ReceptorEntry>();
|
||||
private final List<ReceptorEntry> receptors = new ArrayList<>();
|
||||
private ListIterator<ReceptorEntry> receptorIterator = receptors.listIterator();
|
||||
|
||||
private final List<ReceptorEntry> storageReceptors = new ArrayList<ReceptorEntry>();
|
||||
private final List<ReceptorEntry> storageReceptors = new ArrayList<>();
|
||||
|
||||
private boolean receptorsDirty = true;
|
||||
|
||||
private final Map<IPowerConduit, PowerTracker> powerTrackers = new HashMap<IPowerConduit, PowerTracker>();
|
||||
private final Map<IPowerConduit, PowerTracker> powerTrackers = new HashMap<>();
|
||||
|
||||
private final PowerTracker networkPowerTracker = new PowerTracker();
|
||||
|
||||
@@ -79,7 +79,7 @@ public class NetworkPowerManager {
|
||||
|
||||
public long getPowerInReceptors() {
|
||||
long result = 0;
|
||||
Set<Object> done = new HashSet<Object>();
|
||||
Set<Object> done = new HashSet<>();
|
||||
for (ReceptorEntry re : receptors) {
|
||||
if (!re.emmiter.getConnectionsDirty()) {
|
||||
IPowerInterface powerReceptor = re.powerInterface;
|
||||
@@ -94,7 +94,7 @@ public class NetworkPowerManager {
|
||||
|
||||
public long getMaxPowerInReceptors() {
|
||||
long result = 0;
|
||||
Set<Object> done = new HashSet<Object>();
|
||||
Set<Object> done = new HashSet<>();
|
||||
for (ReceptorEntry re : receptors) {
|
||||
if (!re.emmiter.getConnectionsDirty()) {
|
||||
IPowerInterface powerReceptor = re.powerInterface;
|
||||
@@ -346,13 +346,13 @@ public class NetworkPowerManager {
|
||||
|
||||
int canExtract;
|
||||
int canFill;
|
||||
Set<IPowerStorage> capBanks = new HashSet<IPowerStorage>();
|
||||
Set<IPowerStorage> capBanks = new HashSet<>();
|
||||
|
||||
double filledRatio;
|
||||
long stored = 0;
|
||||
long maxCap = 0;
|
||||
|
||||
List<CapBankSupplyEntry> enteries = new ArrayList<NetworkPowerManager.CapBankSupplyEntry>();
|
||||
List<CapBankSupplyEntry> enteries = new ArrayList<>();
|
||||
|
||||
CapBankSupply() {}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ import crazypants.enderio.tool.ToolUtil;
|
||||
|
||||
public class PowerConduit extends AbstractConduit implements IPowerConduit {
|
||||
|
||||
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
|
||||
static final Map<String, IIcon> ICONS = new HashMap<>();
|
||||
|
||||
private static ICapacitor[] capacitors;
|
||||
|
||||
@@ -106,14 +106,12 @@ public class PowerConduit extends AbstractConduit implements IPowerConduit {
|
||||
|
||||
private int subtype;
|
||||
|
||||
protected final EnumMap<ForgeDirection, RedstoneControlMode> rsModes = new EnumMap<ForgeDirection, RedstoneControlMode>(
|
||||
ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> rsColors = new EnumMap<ForgeDirection, DyeColor>(
|
||||
ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, RedstoneControlMode> rsModes = new EnumMap<>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> rsColors = new EnumMap<>(ForgeDirection.class);
|
||||
|
||||
protected EnumMap<ForgeDirection, Long> recievedTicks;
|
||||
|
||||
private final Map<ForgeDirection, Integer> externalRedstoneSignals = new HashMap<ForgeDirection, Integer>();
|
||||
private final Map<ForgeDirection, Integer> externalRedstoneSignals = new HashMap<>();
|
||||
|
||||
private boolean redstoneStateDirty = true;
|
||||
|
||||
@@ -210,8 +208,8 @@ public class PowerConduit extends AbstractConduit implements IPowerConduit {
|
||||
|
||||
@Override
|
||||
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
setExtractionSignalColor(dir, DyeColor.values()[dataRoot.getShort("extractionSignalColor")]);
|
||||
setExtractionRedstoneMode(RedstoneControlMode.values()[dataRoot.getShort("extractionRedstoneMode")], dir);
|
||||
setExtractionSignalColor(dir, DyeColor.VALUES[dataRoot.getShort("extractionSignalColor")]);
|
||||
setExtractionRedstoneMode(RedstoneControlMode.VALUES[dataRoot.getShort("extractionRedstoneMode")], dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -255,15 +253,15 @@ public class PowerConduit extends AbstractConduit implements IPowerConduit {
|
||||
String key = "pRsMode." + dir.name();
|
||||
if (nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if (ord >= 0 && ord < RedstoneControlMode.values().length) {
|
||||
rsModes.put(dir, RedstoneControlMode.values()[ord]);
|
||||
if (ord >= 0 && ord < RedstoneControlMode.VALUES.length) {
|
||||
rsModes.put(dir, RedstoneControlMode.VALUES[ord]);
|
||||
}
|
||||
}
|
||||
key = "pRsCol." + dir.name();
|
||||
if (nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if (ord >= 0 && ord < DyeColor.values().length) {
|
||||
rsColors.put(dir, DyeColor.values()[ord]);
|
||||
if (ord >= 0 && ord < DyeColor.VALUES.length) {
|
||||
rsColors.put(dir, DyeColor.VALUES[ord]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -388,7 +386,7 @@ public class PowerConduit extends AbstractConduit implements IPowerConduit {
|
||||
|
||||
if (getBundle() != null) {
|
||||
if (recievedTicks == null) {
|
||||
recievedTicks = new EnumMap<ForgeDirection, Long>(ForgeDirection.class);
|
||||
recievedTicks = new EnumMap<>(ForgeDirection.class);
|
||||
}
|
||||
recievedTicks.put(from, getBundle().getWorld().getTotalWorldTime());
|
||||
}
|
||||
@@ -544,7 +542,7 @@ public class PowerConduit extends AbstractConduit implements IPowerConduit {
|
||||
BoundingBox bb = ConduitGeometryUtil.instance.createBoundsForConnectionController(key.dir, key.offset);
|
||||
CollidableComponent cc = new CollidableComponent(IPowerConduit.class, bb, key.dir, COLOR_CONTROLLER_ID);
|
||||
|
||||
List<CollidableComponent> result = new ArrayList<CollidableComponent>();
|
||||
List<CollidableComponent> result = new ArrayList<>();
|
||||
result.addAll(baseCollidables);
|
||||
result.add(cc);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public class PowerConduitNetwork extends AbstractConduitNetwork<IPowerConduit, I
|
||||
|
||||
public NetworkPowerManager powerManager;
|
||||
|
||||
private final Map<ReceptorKey, ReceptorEntry> powerReceptors = new HashMap<ReceptorKey, ReceptorEntry>();
|
||||
private final Map<ReceptorKey, ReceptorEntry> powerReceptors = new HashMap<>();
|
||||
|
||||
public PowerConduitNetwork() {
|
||||
super(IPowerConduit.class, IPowerConduit.class);
|
||||
@@ -92,7 +92,7 @@ public class PowerConduitNetwork extends AbstractConduitNetwork<IPowerConduit, I
|
||||
|
||||
public void powerReceptorRemoved(int x, int y, int z) {
|
||||
BlockCoord bc = new BlockCoord(x, y, z);
|
||||
List<ReceptorKey> remove = new ArrayList<ReceptorKey>();
|
||||
List<ReceptorKey> remove = new ArrayList<>();
|
||||
for (ReceptorKey key : powerReceptors.keySet()) {
|
||||
if (key != null && key.coord.equals(bc)) {
|
||||
remove.add(key);
|
||||
|
||||
@@ -19,7 +19,7 @@ import crazypants.enderio.power.ICapacitor;
|
||||
|
||||
public class PowerConduitEndergy extends PowerConduit {
|
||||
|
||||
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
|
||||
static final Map<String, IIcon> ICONS = new HashMap<>();
|
||||
|
||||
private static ICapacitor[] capacitors;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ import crazypants.enderio.tool.ToolUtil;
|
||||
|
||||
public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsulatedRedstoneConduit {
|
||||
|
||||
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
|
||||
static final Map<String, IIcon> ICONS = new HashMap<>();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void initIcons() {
|
||||
@@ -130,7 +130,7 @@ public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsula
|
||||
|
||||
private static Map<Class<?>, Boolean> getConnectableInterfaces() {
|
||||
if (CONNECTABLE_CLASSES == null) {
|
||||
CONNECTABLE_CLASSES = new HashMap<Class<?>, Boolean>();
|
||||
CONNECTABLE_CLASSES = new HashMap<>();
|
||||
CONNECTABLE_CLASSES.put(IRedstoneControl.class, false);
|
||||
try {
|
||||
Class<?> conInterface = Class
|
||||
@@ -149,11 +149,11 @@ public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsula
|
||||
return CONNECTABLE_CLASSES;
|
||||
}
|
||||
|
||||
private Map<ForgeDirection, ConnectionMode> forcedConnections = new HashMap<ForgeDirection, ConnectionMode>();
|
||||
private final Map<ForgeDirection, ConnectionMode> forcedConnections = new HashMap<>();
|
||||
|
||||
private Map<ForgeDirection, DyeColor> signalColors = new HashMap<ForgeDirection, DyeColor>();
|
||||
private final Map<ForgeDirection, DyeColor> signalColors = new HashMap<>();
|
||||
|
||||
private Map<ForgeDirection, Boolean> signalStrengths = new HashMap<ForgeDirection, Boolean>();
|
||||
private final Map<ForgeDirection, Boolean> signalStrengths = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(EntityPlayer player, RaytraceResult res, List<RaytraceResult> all) {
|
||||
@@ -242,7 +242,7 @@ public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsula
|
||||
|
||||
@Override
|
||||
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
setSignalColor(dir, DyeColor.values()[dataRoot.getShort("signalColor")]);
|
||||
setSignalColor(dir, DyeColor.VALUES[dataRoot.getShort("signalColor")]);
|
||||
setOutputStrength(dir, dataRoot.getBoolean("signalStrong"));
|
||||
}
|
||||
|
||||
@@ -460,7 +460,7 @@ public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsula
|
||||
}
|
||||
|
||||
DyeColor col = getSignalColor(side);
|
||||
Set<Signal> result = new HashSet<Signal>();
|
||||
Set<Signal> result = new HashSet<>();
|
||||
for (Signal signal : allSigs) {
|
||||
if (signal.color == col) {
|
||||
result.add(signal);
|
||||
@@ -494,7 +494,7 @@ public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsula
|
||||
BoundingBox bb = ConduitGeometryUtil.instance.createBoundsForConnectionController(key.dir, key.offset);
|
||||
CollidableComponent cc = new CollidableComponent(IRedstoneConduit.class, bb, key.dir, COLOR_CONTROLLER_ID);
|
||||
|
||||
List<CollidableComponent> result = new ArrayList<CollidableComponent>();
|
||||
List<CollidableComponent> result = new ArrayList<>();
|
||||
result.addAll(baseCollidables);
|
||||
result.add(cc);
|
||||
|
||||
@@ -583,7 +583,7 @@ public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsula
|
||||
int i = 0;
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (modes[i] >= 0) {
|
||||
forcedConnections.put(dir, ConnectionMode.values()[modes[i]]);
|
||||
forcedConnections.put(dir, ConnectionMode.VALUES[modes[i]]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@@ -595,7 +595,7 @@ public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsula
|
||||
int i = 0;
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (cols[i] >= 0) {
|
||||
signalColors.put(dir, DyeColor.values()[cols[i]]);
|
||||
signalColors.put(dir, DyeColor.VALUES[cols[i]]);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import crazypants.enderio.conduit.ItemConduitSubtype;
|
||||
|
||||
public class ItemRedstoneConduit extends AbstractItemConduit {
|
||||
|
||||
private static ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
|
||||
private static final ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
|
||||
new ItemConduitSubtype(ModObject.itemRedstoneConduit.name(), "enderio:itemRedstoneConduit"),
|
||||
new ItemConduitSubtype(ModObject.itemRedstoneConduit.name() + "Switch", "enderio:itemRedstoneSwitch"),
|
||||
new ItemConduitSubtype(
|
||||
|
||||
@@ -68,7 +68,7 @@ public class RedstoneConduit extends AbstractConduit implements IRedstoneConduit
|
||||
|
||||
protected RedstoneConduitNetwork network;
|
||||
|
||||
protected final List<Set<Signal>> externalSignals = new ArrayList<Set<Signal>>();
|
||||
protected final List<Set<Signal>> externalSignals = new ArrayList<>();
|
||||
|
||||
protected boolean neighbourDirty = true;
|
||||
|
||||
@@ -140,7 +140,7 @@ public class RedstoneConduit extends AbstractConduit implements IRedstoneConduit
|
||||
network.setNetworkEnabled(false);
|
||||
}
|
||||
|
||||
Set<Signal> res = new HashSet<Signal>();
|
||||
Set<Signal> res = new HashSet<>();
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if ((side == null || dir == side) && acceptSignalsForDir(dir)) {
|
||||
int input = getExternalPowerLevel(dir);
|
||||
|
||||
@@ -20,7 +20,7 @@ import crazypants.enderio.conduit.IConduitBundle;
|
||||
|
||||
public class RedstoneConduitNetwork extends AbstractConduitNetwork<IRedstoneConduit, IRedstoneConduit> {
|
||||
|
||||
private final Set<Signal> signals = new HashSet<Signal>();
|
||||
private final Set<Signal> signals = new HashSet<>();
|
||||
|
||||
boolean updatingNetwork = false;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class RedstoneConduitNetwork extends AbstractConduitNetwork<IRedstoneCond
|
||||
con.setActive(false);
|
||||
}
|
||||
// Notify neighbours that all signals have been lost
|
||||
List<Signal> copy = new ArrayList<Signal>(signals);
|
||||
List<Signal> copy = new ArrayList<>(signals);
|
||||
signals.clear();
|
||||
for (Signal s : copy) {
|
||||
notifyNeigborsOfSignalUpdate(s);
|
||||
@@ -172,7 +172,7 @@ public class RedstoneConduitNetwork extends AbstractConduitNetwork<IRedstoneCond
|
||||
}
|
||||
|
||||
public void notifyNeigborsOfSignalUpdate(Signal signal) {
|
||||
ArrayList<IRedstoneConduit> conduitsCopy = new ArrayList<IRedstoneConduit>(conduits);
|
||||
ArrayList<IRedstoneConduit> conduitsCopy = new ArrayList<>(conduits);
|
||||
for (IRedstoneConduit con : conduitsCopy) {
|
||||
notifyConduitNeighbours(con, signal);
|
||||
}
|
||||
|
||||
@@ -77,11 +77,11 @@ public class SignalSource {
|
||||
}
|
||||
|
||||
public static Set<SignalSource> fromIntArray(int[] enc) {
|
||||
Set<SignalSource> result = new HashSet<SignalSource>();
|
||||
Set<SignalSource> result = new HashSet<>();
|
||||
for (int i = 0; i < enc.length; i += 5) {
|
||||
// Signal sig = new Signal(enc[i], enc[i + 1], enc[i + 2], enc[i + 3], ForgeDirection.UNKNOWN,14,
|
||||
// SignalColor.values()[enc[i + 4]]);
|
||||
// result.add(new SignalSource(sig, ForgeDirection.values()[enc[i + 4]]));
|
||||
// result.add(new SignalSource(sig, ForgeDirections.DIRECTIONS[enc[i + 4]]));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ import crazypants.enderio.conduit.geom.Offsets.Axis;
|
||||
public class RoundedSegmentRenderer {
|
||||
|
||||
private static final int NUM_VERTICES = 16;
|
||||
private static Vertex[][] DIR_COORDS = new Vertex[ForgeDirection.VALID_DIRECTIONS.length][];
|
||||
private static Vertex[][] DIR_STUB_COORDS = new Vertex[ForgeDirection.VALID_DIRECTIONS.length][];
|
||||
private static Vertex[][] DIR_STUB_CAPS = new Vertex[ForgeDirection.VALID_DIRECTIONS.length][];
|
||||
private static final Vertex[][] DIR_COORDS = new Vertex[ForgeDirection.VALID_DIRECTIONS.length][];
|
||||
private static final Vertex[][] DIR_STUB_COORDS = new Vertex[ForgeDirection.VALID_DIRECTIONS.length][];
|
||||
private static final Vertex[][] DIR_STUB_CAPS = new Vertex[ForgeDirection.VALID_DIRECTIONS.length][];
|
||||
|
||||
private static final Vector3d REF_TRANS = new Vector3d(0.5, 0.5, 0.5);
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public final class Config {
|
||||
public static final List<Section> sections;
|
||||
|
||||
static {
|
||||
sections = new ArrayList<Section>();
|
||||
sections = new ArrayList<>();
|
||||
}
|
||||
|
||||
public static Configuration config;
|
||||
@@ -145,6 +145,7 @@ public final class Config {
|
||||
public static int travelAnchorCooldown = 0;
|
||||
public static boolean travelAnchorSneak = true;
|
||||
public static boolean travelAnchorSkipWarning = true;
|
||||
public static double travelAnchorSnapAngle = 0.175;
|
||||
|
||||
public static int travelStaffMaxDistance = 128;
|
||||
public static float travelStaffPowerPerBlockRF = 250;
|
||||
@@ -388,7 +389,7 @@ public final class Config {
|
||||
"ThermalFoundation:tool.hoeSilver", "ThermalFoundation:tool.hoeElectrum", "ThermalFoundation:tool.hoeTin",
|
||||
"ThermalFoundation:tool.hoeLead", "ThermalFoundation:tool.hoeNickel", "ThermalFoundation:tool.hoePlatinum",
|
||||
"TwilightForest:item.steeleafHoe", "TwilightForest:item.ironwoodHoe", "IC2:itemToolBronzeHoe" };
|
||||
public static List<ItemStack> farmHoes = new ArrayList<ItemStack>();
|
||||
public static List<ItemStack> farmHoes = new ArrayList<>();
|
||||
public static int farmSaplingReserveAmount = 8;
|
||||
public static double farmParticlesMaxRange = 64;
|
||||
public static int farmParticlesCount = 15;
|
||||
@@ -597,6 +598,11 @@ public final class Config {
|
||||
|
||||
public static float fusedQuartzExplosionResistance = 2000.0f;
|
||||
|
||||
public static boolean enchanterOutputEnableBlockRestriction = false;
|
||||
public static boolean enchanterOutputAllowlistAsDenylist = false;
|
||||
public static String[] enchanterOutputFilterlist = new String[] { "minecraft:hopper",
|
||||
"EnderIO:blockConduitBundle" };
|
||||
|
||||
public static void load(FMLPreInitializationEvent event) {
|
||||
PacketHandler.INSTANCE
|
||||
.registerMessage(PacketConfigSync.class, PacketConfigSync.class, PacketHandler.nextID(), Side.CLIENT);
|
||||
@@ -1162,6 +1168,14 @@ public final class Config {
|
||||
"Travel Anchors send a chat warning when skipping inaccessible anchors")
|
||||
.getBoolean(travelAnchorSkipWarning);
|
||||
|
||||
travelAnchorSnapAngle = Math.toRadians(
|
||||
config.get(
|
||||
sectionAnchor.name,
|
||||
"travelAnchorSnapAngle",
|
||||
Math.round(Math.toDegrees(travelAnchorSnapAngle)),
|
||||
"The maximum angle to snap to an anchor when selecting target")
|
||||
.getDouble(Math.toDegrees(travelAnchorSnapAngle)));
|
||||
|
||||
travelStaffMaxDistance = config
|
||||
.get(
|
||||
sectionStaff.name,
|
||||
@@ -2978,6 +2992,22 @@ public final class Config {
|
||||
0.0f,
|
||||
Float.MAX_VALUE,
|
||||
"How blast resistant the three Fused Quartz blocks should be.");
|
||||
|
||||
enchanterOutputEnableBlockRestriction = config.getBoolean(
|
||||
"enchanterOutputEnableBlockRestriction",
|
||||
sectionMisc.name,
|
||||
enchanterOutputEnableBlockRestriction,
|
||||
"Enable restricting the valid blocks that are allowed to pull from the output slot of an Enchanter, to prevent dupes");
|
||||
enchanterOutputAllowlistAsDenylist = config.getBoolean(
|
||||
"enchanterOutputAllowlistAsDenylist",
|
||||
sectionMisc.name,
|
||||
enchanterOutputAllowlistAsDenylist,
|
||||
"Treat the list of blocks allowed to pull from an Enchanter's output slot as a denylist instead (if you know only some specific blocks bypass inventory APIs)");
|
||||
enchanterOutputFilterlist = config.getStringList(
|
||||
"enchanterOutputFilterlist",
|
||||
sectionMisc.name,
|
||||
enchanterOutputFilterlist,
|
||||
"These blocks are allowed/denied from pulling from the output slot of an Enchanter (default is allowlist)");
|
||||
}
|
||||
|
||||
public static void checkYetaAccess() {
|
||||
|
||||
@@ -28,7 +28,7 @@ public class GuiConfigFactoryEIO extends GuiConfig {
|
||||
}
|
||||
|
||||
private static List<IConfigElement> getConfigElements(GuiScreen parent) {
|
||||
List<IConfigElement> list = new ArrayList<IConfigElement>();
|
||||
List<IConfigElement> list = new ArrayList<>();
|
||||
String prefix = EnderIO.lang.addPrefix("config.");
|
||||
|
||||
for (Section section : Config.sections) {
|
||||
|
||||
@@ -21,7 +21,7 @@ public enum EnderIOController {
|
||||
|
||||
INSTANCE;
|
||||
|
||||
private TObjectIntMap<UUID> openedContainers = new TObjectIntHashMap<UUID>();
|
||||
private final TObjectIntMap<UUID> openedContainers = new TObjectIntHashMap<>();
|
||||
private int clientWindowId;
|
||||
private boolean locked = false;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import crazypants.enderio.teleport.anchor.TravelEntitySpecialRenderer;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class EnderIoRenderer extends TileEntitySpecialRenderer implements IItemRenderer {
|
||||
|
||||
private TravelEntitySpecialRenderer selectionRenderer = new TravelEntitySpecialRenderer() {
|
||||
private final TravelEntitySpecialRenderer selectionRenderer = new TravelEntitySpecialRenderer() {
|
||||
|
||||
protected void renderBlock() {}
|
||||
|
||||
@@ -46,7 +46,10 @@ public class EnderIoRenderer extends TileEntitySpecialRenderer implements IItemR
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
|
||||
|
||||
EntityLivingBase entityPlayer = Minecraft.getMinecraft().thePlayer;
|
||||
Matrix4d lookMat = RenderUtil.createBillboardMatrix(te, entityPlayer);
|
||||
EntityLivingBase viewEntity = Minecraft.getMinecraft().renderViewEntity != null
|
||||
? Minecraft.getMinecraft().renderViewEntity
|
||||
: entityPlayer;
|
||||
Matrix4d lookMat = RenderUtil.createBillboardMatrix(te, viewEntity);
|
||||
|
||||
int brightness = RenderUtil.setTesselatorBrightness(entityPlayer.worldObj, te.xCoord, te.yCoord, te.zCoord);
|
||||
render(x, y, z, lookMat, brightness);
|
||||
|
||||
@@ -53,9 +53,9 @@ public class GuiEnderface extends GuiScreen {
|
||||
private final int ioX;
|
||||
private final int ioY;
|
||||
private final int ioZ;
|
||||
private boolean chunkLoaded;
|
||||
private final boolean chunkLoaded;
|
||||
|
||||
private List<ViewableBlocks> blocks = new ArrayList<ViewableBlocks>();
|
||||
private final List<ViewableBlocks> blocks = new ArrayList<>();
|
||||
|
||||
private int gw;
|
||||
private int gh;
|
||||
@@ -77,8 +77,6 @@ public class GuiEnderface extends GuiScreen {
|
||||
|
||||
private float scaleAnimX;
|
||||
|
||||
private int range;
|
||||
|
||||
boolean dragging = false;
|
||||
|
||||
private double distance;
|
||||
@@ -92,7 +90,7 @@ public class GuiEnderface extends GuiScreen {
|
||||
this.ioY = ioY;
|
||||
this.ioZ = ioZ;
|
||||
|
||||
range = Config.enderIoRange;
|
||||
int range = Config.enderIoRange;
|
||||
distance = 10 + (range * 2);
|
||||
|
||||
TileEntity te = world.getTileEntity(ioX, ioY, ioZ);
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package crazypants.enderio.etfuturum;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import ganymedes01.etfuturum.elytra.IElytraPlayer;
|
||||
|
||||
public final class EtFuturumCompat {
|
||||
|
||||
private EtFuturumCompat() {}
|
||||
|
||||
public static boolean isElytraFlying(EntityPlayer player) {
|
||||
return EnderIO.hasEtFuturum && player instanceof IElytraPlayer
|
||||
&& ((IElytraPlayer) player).etfu$isElytraFlying();
|
||||
}
|
||||
|
||||
public static void stopElytraFlying(EntityPlayer player) {
|
||||
if (EnderIO.hasEtFuturum && player instanceof IElytraPlayer) {
|
||||
((IElytraPlayer) player).etfu$setElytraFlying(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ public class BucketHandler {
|
||||
MinecraftForge.EVENT_BUS.register(instance);
|
||||
}
|
||||
|
||||
private Map<Block, Item> buckets = new HashMap<Block, Item>();
|
||||
private final Map<Block, Item> buckets = new HashMap<>();
|
||||
|
||||
private BucketHandler() {}
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@ public class FluidFuelRegister implements IFluidRegister {
|
||||
private static final String KEY_TOTAL_BURN_TIME = "totalBurnTime";
|
||||
private static final String KEY_COOLING_PER_MB = "coolingPerMb";
|
||||
|
||||
private final Map<String, IFluidCoolant> coolants = new HashMap<String, IFluidCoolant>();
|
||||
private final Map<String, IFluidFuel> fuels = new HashMap<String, IFluidFuel>();
|
||||
private final Map<String, IFluidCoolant> coolants = new HashMap<>();
|
||||
private final Map<String, IFluidFuel> fuels = new HashMap<>();
|
||||
|
||||
private final List<IFluidRegister> otherRegisters = new ArrayList<IFluidRegister>();
|
||||
private final List<IFluidRegister> otherRegisters = new ArrayList<>();
|
||||
|
||||
private FluidFuelRegister() {
|
||||
addCoolant(FluidRegistry.WATER, 0.0023f);
|
||||
|
||||
@@ -25,7 +25,7 @@ public class ItemBucketEio extends ItemBucket {
|
||||
return b;
|
||||
}
|
||||
|
||||
private String fluidName;
|
||||
private final String fluidName;
|
||||
|
||||
protected ItemBucketEio(Block block, String fluidName) {
|
||||
super(block);
|
||||
|
||||
Loaded 100 of 1153 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user