mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-15 01:25:13 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
No files matched your search
@@ -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
|
||||
+19
-16
@@ -1,24 +1,26 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:EnderCore:0.4.8:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.10.17:dev')
|
||||
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.7.90-GTNH:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.6.39:dev")
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.44:dev')
|
||||
api('com.github.GTNewHorizons:EnderCore:0.5.7:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.4:dev')
|
||||
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.8.60-GTNH:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.9.10:dev")
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.55: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.54-GTNH:dev")
|
||||
api("com.github.GTNewHorizons:TinkersConstruct:1.14.27-GTNH:dev")
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.8.14:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-689-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Baubles:1.0.4:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.464:dev') {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:ModularUI2:2.2.18-1.7.10:dev") {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.16.33:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.1.7-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Chisel:2.16.13-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.19-GTNH:api') {transitive = false}
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:waila:1.19.22:dev') {transitive = false}
|
||||
runtimeOnlyNonPublishable('com.github.GTNewHorizons:WAILAPlugins:0.7.2:dev') {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:Backhand:1.8.4:dev") { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-812-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.6-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.52.261:dev') {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:ModularUI2:2.3.37-1.7.10:dev") {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.17.17:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.2.9-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Chisel:2.17.14-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.16-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
|
||||
@@ -26,5 +28,6 @@ dependencies {
|
||||
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-beta56:api') {transitive = false}
|
||||
compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-beta66a:api') {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.7.58:dev")
|
||||
}
|
||||
+39
-4
@@ -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!
|
||||
@@ -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/df211d3c3eefdc408b462041881bc575/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/b41931cf1e70bc8e08d7dd19c343ef00/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/b41931cf1e70bc8e08d7dd19c343ef00/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/46949723aaa20c7b64d7ecfed7207034/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/d6690dfd71c4c91e08577437b5b2beb0/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/b41931cf1e70bc8e08d7dd19c343ef00/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/3cd7045fca9a72cd9bc7d14a385e594c/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/552c7bffe0370c66410a51c55985b511/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.2.1-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.
|
||||
@@ -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.43'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.19'
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -111,7 +112,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;
|
||||
@@ -213,6 +213,8 @@ 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 hasWailaPlugins = Loader.isModLoaded("wailaplugins");
|
||||
|
||||
// Materials
|
||||
public static ItemCapacitor itemBasicCapacitor;
|
||||
@@ -486,7 +488,9 @@ public class EnderIO {
|
||||
itemGrindingBall = ItemGrindingBall.create();
|
||||
itemAlloyEndergy = ItemAlloyEndergy.create();
|
||||
itemGrindingBallEndergy = ItemGrindingBallEndergy.create();
|
||||
itemPowderIngot = ItemPowderIngot.create();
|
||||
if (!hasGT5) {
|
||||
itemPowderIngot = ItemPowderIngot.create();
|
||||
}
|
||||
|
||||
registerFluids();
|
||||
|
||||
@@ -726,7 +730,9 @@ public class EnderIO {
|
||||
SkeletonHandler.registerSkeleton(this);
|
||||
}
|
||||
|
||||
MaterialRecipes.registerDependantOresInDictionary();
|
||||
if (!hasGT5) {
|
||||
MaterialRecipes.registerDependantOresInDictionary();
|
||||
}
|
||||
|
||||
EnderfaceRecipes.addRecipes();
|
||||
MaterialRecipes.addRecipes();
|
||||
@@ -889,22 +895,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
|
||||
@@ -916,4 +918,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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -118,7 +119,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 +383,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 +398,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++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ 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> {
|
||||
|
||||
@@ -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
|
||||
@@ -823,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;
|
||||
}
|
||||
@@ -838,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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,10 +32,11 @@ 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;
|
||||
@@ -115,7 +116,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;
|
||||
|
||||
@@ -193,8 +193,8 @@ public abstract class AbstractGasConduit extends AbstractConduit implements IGas
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
|
||||
+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();
|
||||
|
||||
@@ -164,10 +164,10 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
|
||||
|
||||
@Override
|
||||
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
setExtractionSignalColor(dir, DyeColor.values()[dataRoot.getShort("extractionSignalColor")]);
|
||||
setExtractionSignalColor(dir, DyeColor.VALUES[dataRoot.getShort("extractionSignalColor")]);
|
||||
setExtractionRedstoneMode(RedstoneControlMode.values()[dataRoot.getShort("extractionRedstoneMode")], dir);
|
||||
setInputColor(dir, DyeColor.values()[dataRoot.getShort("inputColor")]);
|
||||
setOutputColor(dir, DyeColor.values()[dataRoot.getShort("outputColor")]);
|
||||
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"));
|
||||
@@ -857,8 +857,8 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
|
||||
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 +882,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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ 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.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -25,6 +24,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 {
|
||||
|
||||
@@ -41,8 +41,8 @@ public class NetworkedInventory {
|
||||
|
||||
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 +61,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 +104,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 +145,6 @@ public class NetworkedInventory {
|
||||
}
|
||||
|
||||
private boolean transferItems() {
|
||||
|
||||
if (recheckInv) {
|
||||
updateInventory();
|
||||
}
|
||||
|
||||
int[] slotIndices = getInventory().getAccessibleSlotsFromSide(inventorySide);
|
||||
if (slotIndices == null) {
|
||||
return false;
|
||||
@@ -257,9 +253,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 +274,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 +328,7 @@ public class NetworkedInventory {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return ItemUtil.doInsertItem(getInventory(), item, ForgeDirection.values()[inventorySide]);
|
||||
return ItemUtil.doInsertItem(getInventory(), item, ForgeDirections.DIRECTIONS[inventorySide]);
|
||||
}
|
||||
|
||||
void updateInsertOrder() {
|
||||
@@ -410,7 +426,7 @@ public class NetworkedInventory {
|
||||
}
|
||||
|
||||
public ISidedInventory getInventoryRecheck() {
|
||||
if (recheckInv) {
|
||||
if (isInvalid()) {
|
||||
updateInventory();
|
||||
}
|
||||
return inv;
|
||||
|
||||
@@ -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,20 +89,20 @@ 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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -424,10 +424,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 +542,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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ public abstract class AbstractLiquidConduit extends AbstractConduit implements I
|
||||
|
||||
@Override
|
||||
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
setExtractionSignalColor(dir, DyeColor.values()[dataRoot.getShort("extractionSignalColor")]);
|
||||
setExtractionSignalColor(dir, DyeColor.VALUES[dataRoot.getShort("extractionSignalColor")]);
|
||||
setExtractionRedstoneMode(RedstoneControlMode.values()[dataRoot.getShort("extractionRedstoneMode")], dir);
|
||||
}
|
||||
|
||||
@@ -248,8 +248,8 @@ public abstract class AbstractLiquidConduit extends AbstractConduit implements I
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -86,7 +86,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
|
||||
@@ -148,7 +148,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++;
|
||||
}
|
||||
@@ -274,7 +274,7 @@ 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());
|
||||
@@ -350,7 +350,7 @@ 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()) {
|
||||
for (DyeColor color : DyeColor.VALUES) {
|
||||
Set<Node> should = new HashSet<Node>();
|
||||
for (ForgeDirection direction : conns) {
|
||||
if (getSignalColor(direction) == color) {
|
||||
|
||||
@@ -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()];
|
||||
dir = ForgeDirections.DIRECTIONS[buf.readShort()];
|
||||
mode = RedstoneControlMode.values()[buf.readShort()];
|
||||
color = DyeColor.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();
|
||||
}
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ public class PowerConduit extends AbstractConduit implements IPowerConduit {
|
||||
|
||||
@Override
|
||||
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
setExtractionSignalColor(dir, DyeColor.values()[dataRoot.getShort("extractionSignalColor")]);
|
||||
setExtractionSignalColor(dir, DyeColor.VALUES[dataRoot.getShort("extractionSignalColor")]);
|
||||
setExtractionRedstoneMode(RedstoneControlMode.values()[dataRoot.getShort("extractionRedstoneMode")], dir);
|
||||
}
|
||||
|
||||
@@ -262,8 +262,8 @@ public class PowerConduit extends AbstractConduit implements IPowerConduit {
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class SignalSource {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ public class ItemSoulVessel extends Item implements IResourceTooltipProvider {
|
||||
if (colorIdx < 0 || colorIdx > 15) {
|
||||
return null;
|
||||
}
|
||||
return DyeColor.values()[15 - colorIdx];
|
||||
return DyeColor.VALUES[15 - colorIdx];
|
||||
}
|
||||
|
||||
private float getHealthFromStack(ItemStack item) {
|
||||
|
||||
@@ -122,12 +122,13 @@ public class ItemDarkSteelShears extends ItemShears
|
||||
BlockCoord bc = new BlockCoord(x, y, z);
|
||||
HarvestResult res = new HarvestResult(null, bc);
|
||||
|
||||
for (int dx = -Config.darkSteelShearsBlockAreaBoostWhenPowered; dx
|
||||
<= Config.darkSteelShearsBlockAreaBoostWhenPowered; dx++) {
|
||||
for (int dy = -Config.darkSteelShearsBlockAreaBoostWhenPowered; dy
|
||||
<= Config.darkSteelShearsBlockAreaBoostWhenPowered; dy++) {
|
||||
for (int dz = -Config.darkSteelShearsBlockAreaBoostWhenPowered; dz
|
||||
<= Config.darkSteelShearsBlockAreaBoostWhenPowered; dz++) {
|
||||
int range = Config.darkSteelShearsBlockAreaBoostWhenPowered;
|
||||
for (int dx = -range; dx <= range; dx++) {
|
||||
for (int dy = -range; dy <= range; dy++) {
|
||||
for (int dz = -range; dz <= range; dz++) {
|
||||
// Skip center block, already added via HarvestResult constructor
|
||||
if (dx == 0 && dy == 0 && dz == 0) continue;
|
||||
|
||||
Block block2 = player.worldObj.getBlock(x + dx, y + dy, z + dz);
|
||||
if (block2 instanceof IShearable && ((IShearable) block2)
|
||||
.isShearable(itemstack, player.worldObj, x + dx, y + dy, z + dz)) {
|
||||
@@ -144,9 +145,12 @@ public class ItemDarkSteelShears extends ItemShears
|
||||
int maxBlocks = Math.min(sortedTargets.size(), powerStored / Config.darkSteelShearsPowerUsePerDamagePoint);
|
||||
for (int i = 0; i < maxBlocks; i++) {
|
||||
BlockCoord bc2 = sortedTargets.get(i);
|
||||
super.onBlockStartBreak(itemstack, bc2.x, bc2.y, bc2.z, player);
|
||||
if (bc2 != bc) {
|
||||
player.worldObj.setBlockToAir(bc2.x, bc2.y, bc2.z);
|
||||
Block target = player.worldObj.getBlock(bc2.x, bc2.y, bc2.z);
|
||||
if (target instanceof IShearable
|
||||
&& ((IShearable) target).isShearable(itemstack, player.worldObj, bc2.x, bc2.y, bc2.z)) {
|
||||
if (!super.onBlockStartBreak(itemstack, bc2.x, bc2.y, bc2.z, player)) {
|
||||
player.worldObj.setBlockToAir(bc2.x, bc2.y, bc2.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class ItemGliderWing extends Item implements IResourceTooltipProvider {
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack par1ItemStack) {
|
||||
int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, Capacitors.values().length - 1);
|
||||
int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, Capacitors.VALUES.length - 1);
|
||||
if (i == 0) {
|
||||
return super.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ public abstract class AbstractPoweredMachineEntity extends AbstractMachineEntity
|
||||
if (contents == null || contents.getItem() != EnderIO.itemBasicCapacitor) {
|
||||
setCapacitor(Capacitors.BASIC_CAPACITOR);
|
||||
} else {
|
||||
setCapacitor(Capacitors.values()[contents.getItemDamage()]);
|
||||
setCapacitor(Capacitors.VALUES[contents.getItemDamage()]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ public abstract class AbstractPoweredMachineEntity extends AbstractMachineEntity
|
||||
@Override
|
||||
public void readCommon(NBTTagCompound nbtRoot) {
|
||||
super.readCommon(nbtRoot);
|
||||
setCapacitor(Capacitors.values()[nbtRoot.getShort("capacitorType")]);
|
||||
setCapacitor(Capacitors.VALUES[nbtRoot.getShort("capacitorType")]);
|
||||
int energy;
|
||||
if (nbtRoot.hasKey("storedEnergy")) {
|
||||
float storedEnergyMJ = nbtRoot.getFloat("storedEnergy");
|
||||
|
||||
@@ -25,19 +25,19 @@ public enum IoMode {
|
||||
|
||||
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 pulls() {
|
||||
|
||||
@@ -10,6 +10,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.network.PacketUtil;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class PacketIoMode implements IMessage, IMessageHandler<PacketIoMode, IMessage> {
|
||||
@@ -55,7 +56,7 @@ public class PacketIoMode implements IMessage, IMessageHandler<PacketIoMode, IMe
|
||||
y = buf.readInt();
|
||||
z = buf.readInt();
|
||||
mode = IoMode.values()[buf.readShort()];
|
||||
face = ForgeDirection.values()[buf.readShort()];
|
||||
face = ForgeDirections.DIRECTIONS[buf.readShort()];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -54,6 +54,7 @@ import crazypants.enderio.power.PowerDisplayUtil;
|
||||
import crazypants.enderio.power.PowerHandlerUtil;
|
||||
import crazypants.enderio.tool.ToolUtil;
|
||||
import crazypants.enderio.waila.IWailaInfoProvider;
|
||||
import crazypants.util.ForgeDirections;
|
||||
|
||||
public class BlockCapBank extends BlockEio
|
||||
implements IGuiHandler, IAdvancedTooltipProvider, IWailaInfoProvider, IRedstoneConnectable {
|
||||
@@ -345,7 +346,7 @@ public class BlockCapBank extends BlockEio
|
||||
// }
|
||||
|
||||
TileCapBank cb = (TileCapBank) te;
|
||||
ForgeDirection face = ForgeDirection.values()[side];
|
||||
ForgeDirection face = ForgeDirections.DIRECTIONS[side];
|
||||
|
||||
int meta = ba.getBlockMetadata(x, y, z);
|
||||
meta = MathHelper.clamp_int(meta, 0, CapBankType.types().size() - 1);
|
||||
@@ -452,14 +453,14 @@ public class BlockCapBank extends BlockEio
|
||||
protected ForgeDirection getDirForHeading(int heading) {
|
||||
switch (heading) {
|
||||
case 0:
|
||||
return ForgeDirection.values()[2];
|
||||
return ForgeDirections.DIRECTIONS[2];
|
||||
case 1:
|
||||
return ForgeDirection.values()[5];
|
||||
return ForgeDirections.DIRECTIONS[5];
|
||||
case 2:
|
||||
return ForgeDirection.values()[3];
|
||||
return ForgeDirections.DIRECTIONS[3];
|
||||
case 3:
|
||||
default:
|
||||
return ForgeDirection.values()[4];
|
||||
return ForgeDirections.DIRECTIONS[4];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import com.enderio.core.common.util.RoundRobinIterator;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent;
|
||||
import crazypants.enderio.conduit.ConduitNetworkTickHandler;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.ConduitNetworkTickHandler.TickListener;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
@@ -212,7 +212,7 @@ public class CapBankNetwork implements ICapBankNetwork {
|
||||
long curTime = world.getTotalWorldTime();
|
||||
if (curTime != timeAtLastApply) {
|
||||
timeAtLastApply = curTime;
|
||||
ConduitNetworkTickHandler.instance.addListener(tickListener);
|
||||
EnderIO.proxy.conduitNetworkTickHandler.addListener(tickListener);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.machine.AbstractMachineBlock;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.util.ForgeDirections;
|
||||
|
||||
public class BlockCrusher extends AbstractMachineBlock<TileCrusher> {
|
||||
|
||||
@@ -70,7 +71,7 @@ public class BlockCrusher extends AbstractMachineBlock<TileCrusher> {
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
TileCrusher te = (TileCrusher) world.getTileEntity(x, y, z);
|
||||
if (te != null && te.isActive()) {
|
||||
ForgeDirection front = ForgeDirection.values()[te.facing];
|
||||
ForgeDirection front = ForgeDirections.DIRECTIONS[te.facing];
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
double px = x + 0.5 + front.offsetX * 0.51;
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
package crazypants.enderio.machine.farm;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.BitSet;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemShears;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
@@ -31,7 +33,6 @@ import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.AbstractPoweredTaskEntity;
|
||||
import crazypants.enderio.machine.ContinuousTask;
|
||||
import crazypants.enderio.machine.IMachineRecipe.ResultStack;
|
||||
import crazypants.enderio.machine.IPoweredTask;
|
||||
import crazypants.enderio.machine.SlotDefinition;
|
||||
import crazypants.enderio.machine.farm.farmers.FarmersCommune;
|
||||
@@ -48,6 +49,8 @@ public class TileFarmStation extends AbstractPoweredTaskEntity implements IRange
|
||||
private static final int TICKS_PER_WORK = 20;
|
||||
private boolean showingRange;
|
||||
|
||||
private final List<ItemStack> harvestBuffer = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
return worldObj;
|
||||
@@ -424,6 +427,38 @@ public class TileFarmStation extends AbstractPoweredTaskEntity implements IRange
|
||||
wasActive = isActive();
|
||||
worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord);
|
||||
}
|
||||
tryMoveFromBuffer();
|
||||
}
|
||||
|
||||
private void tryMoveFromBuffer() {
|
||||
if (harvestBuffer.isEmpty() || worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<ItemStack> toRemove = new ArrayList<>();
|
||||
for (ItemStack stack : harvestBuffer) {
|
||||
if (stack == null || stack.stackSize <= 0) {
|
||||
toRemove.add(stack);
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack remaining = tryInsertToInputSlots(stack);
|
||||
if (remaining != null && remaining.stackSize > 0) {
|
||||
remaining = tryInsertToOutputSlots(remaining);
|
||||
}
|
||||
|
||||
if (remaining == null || remaining.stackSize == 0) {
|
||||
toRemove.add(stack);
|
||||
} else {
|
||||
stack.stackSize = remaining.stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
harvestBuffer.removeAll(toRemove);
|
||||
|
||||
if (!toRemove.isEmpty()) {
|
||||
markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -445,9 +480,18 @@ public class TileFarmStation extends AbstractPoweredTaskEntity implements IRange
|
||||
setNotification("noPower");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBufferNotEmpty() || isOutputFull()) {
|
||||
setNotification("outputFull");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean isBufferNotEmpty() {
|
||||
return !harvestBuffer.isEmpty();
|
||||
}
|
||||
|
||||
protected void doTick() {
|
||||
|
||||
if (sendNotification && shouldDoWorkThisTick(TICKS_PER_WORK)) {
|
||||
@@ -488,7 +532,7 @@ public class TileFarmStation extends AbstractPoweredTaskEntity implements IRange
|
||||
block = worldObj.getBlock(bc.x, bc.y, bc.z);
|
||||
}
|
||||
|
||||
if (isOutputFull()) {
|
||||
if (isOutputFull() || isBufferNotEmpty()) {
|
||||
setNotification("outputFull");
|
||||
return;
|
||||
}
|
||||
@@ -507,10 +551,8 @@ public class TileFarmStation extends AbstractPoweredTaskEntity implements IRange
|
||||
new TargetPoint(worldObj.provider.dimensionId, bc.x, bc.y, bc.z, Config.farmParticlesMaxRange));
|
||||
for (EntityItem ei : harvest.getDrops()) {
|
||||
if (ei != null) {
|
||||
insertHarvestDrop(ei, bc);
|
||||
if (!ei.isDead) {
|
||||
worldObj.spawnEntityInWorld(ei);
|
||||
}
|
||||
addToBuffer(ei.getEntityItem().copy());
|
||||
ei.setDead();
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -552,6 +594,99 @@ public class TileFarmStation extends AbstractPoweredTaskEntity implements IRange
|
||||
}
|
||||
}
|
||||
|
||||
private void addToBuffer(ItemStack stack) {
|
||||
if (stack == null || stack.stackSize <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (ItemStack bufStack : harvestBuffer) {
|
||||
if (bufStack.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(bufStack, stack)) {
|
||||
int canAdd = bufStack.stackSize;
|
||||
if (canAdd > 0) {
|
||||
int addAmount = Math.min(canAdd, stack.stackSize);
|
||||
bufStack.stackSize += addAmount;
|
||||
stack.stackSize -= addAmount;
|
||||
|
||||
if (stack.stackSize <= 0) {
|
||||
markDirty();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
harvestBuffer.add(stack.copy());
|
||||
markDirty();
|
||||
}
|
||||
|
||||
private ItemStack tryInsertToInputSlots(ItemStack stack) {
|
||||
if (stack == null || stack.stackSize <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (int i = minSupSlot; i <= maxSupSlot; i++) {
|
||||
if (stack.stackSize <= 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
ItemStack slotStack = inventory[i];
|
||||
int stackLimit = getInventoryStackLimit(i);
|
||||
|
||||
if (isItemValidForSlot(i, stack)) {
|
||||
if (slotStack == null) {
|
||||
if (!isSlotLocked(i)) {
|
||||
int amount = Math.min(stack.stackSize, stackLimit);
|
||||
inventory[i] = stack.copy();
|
||||
inventory[i].stackSize = amount;
|
||||
stack.stackSize -= amount;
|
||||
markDirty();
|
||||
}
|
||||
} else if (slotStack.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(slotStack, stack)) {
|
||||
int canAdd = Math.min(stackLimit - slotStack.stackSize, stack.stackSize);
|
||||
if (canAdd > 0) {
|
||||
slotStack.stackSize += canAdd;
|
||||
stack.stackSize -= canAdd;
|
||||
markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return stack.stackSize > 0 ? stack : null;
|
||||
}
|
||||
|
||||
private ItemStack tryInsertToOutputSlots(ItemStack stack) {
|
||||
if (stack == null || stack.stackSize <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (int i = slotDefinition.minOutputSlot; i <= slotDefinition.maxOutputSlot; i++) {
|
||||
if (stack.stackSize <= 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
ItemStack slotStack = inventory[i];
|
||||
int stackLimit = 64;
|
||||
|
||||
if (slotStack == null) {
|
||||
int amount = Math.min(stack.stackSize, stackLimit);
|
||||
inventory[i] = stack.copy();
|
||||
inventory[i].stackSize = amount;
|
||||
stack.stackSize -= amount;
|
||||
markDirty();
|
||||
} else if (slotStack.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(slotStack, stack)) {
|
||||
int canAdd = Math.min(stackLimit - slotStack.stackSize, stack.stackSize);
|
||||
if (canAdd > 0) {
|
||||
slotStack.stackSize += canAdd;
|
||||
stack.stackSize -= canAdd;
|
||||
markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return stack.stackSize > 0 ? stack : null;
|
||||
}
|
||||
|
||||
private int bonemealCooldown = 5; // no need to persist this
|
||||
|
||||
private boolean hasBonemeal() {
|
||||
@@ -652,68 +787,6 @@ public class TileFarmStation extends AbstractPoweredTaskEntity implements IRange
|
||||
return minSupSlot + 3;
|
||||
}
|
||||
|
||||
private void insertHarvestDrop(Entity entity, BlockCoord bc) {
|
||||
if (!worldObj.isRemote) {
|
||||
if (entity instanceof EntityItem && !entity.isDead) {
|
||||
EntityItem item = (EntityItem) entity;
|
||||
ItemStack stack = item.getEntityItem().copy();
|
||||
int numInserted = insertResult(stack, bc);
|
||||
stack.stackSize -= numInserted;
|
||||
item.setEntityItemStack(stack);
|
||||
if (stack.stackSize == 0) {
|
||||
item.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int insertResult(ItemStack stack, BlockCoord bc) {
|
||||
|
||||
int slot = bc != null ? getSupplySlotForCoord(bc) : minSupSlot;
|
||||
int[] slots = new int[NUM_SUPPLY_SLOTS];
|
||||
int k = 0;
|
||||
for (int j = slot; j <= maxSupSlot; j++) {
|
||||
slots[k++] = j;
|
||||
}
|
||||
for (int j = minSupSlot; j < slot; j++) {
|
||||
slots[k++] = j;
|
||||
}
|
||||
|
||||
int origSize = stack.stackSize;
|
||||
stack = stack.copy();
|
||||
|
||||
int inserted = 0;
|
||||
for (int j = 0; j < slots.length && inserted < stack.stackSize; j++) {
|
||||
int i = slots[j];
|
||||
ItemStack curStack = inventory[i];
|
||||
int inventoryStackLimit = getInventoryStackLimit(i);
|
||||
if (isItemValidForSlot(i, stack) && (curStack == null || curStack.stackSize < inventoryStackLimit)) {
|
||||
if (curStack == null) {
|
||||
if (stack.stackSize < inventoryStackLimit) {
|
||||
inventory[i] = stack.copy();
|
||||
inserted = stack.stackSize;
|
||||
} else {
|
||||
inventory[i] = stack.copy();
|
||||
inserted = inventoryStackLimit;
|
||||
inventory[i].stackSize = inserted;
|
||||
}
|
||||
} else if (curStack.isItemEqual(stack)) {
|
||||
inserted = Math.min(inventoryStackLimit - curStack.stackSize, stack.stackSize);
|
||||
inventory[i].stackSize += inserted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stack.stackSize -= inserted;
|
||||
if (inserted >= origSize) {
|
||||
return origSize;
|
||||
}
|
||||
|
||||
ResultStack[] in = new ResultStack[] { new ResultStack(stack) };
|
||||
mergeResults(in);
|
||||
return origSize - (in[0].item == null ? 0 : in[0].item.stackSize);
|
||||
}
|
||||
|
||||
private @Nonnull BlockCoord getNextCoord() {
|
||||
|
||||
int size = getFarmSize();
|
||||
@@ -752,11 +825,6 @@ public class TileFarmStation extends AbstractPoweredTaskEntity implements IRange
|
||||
return EnderIO.blockFarmStation.getLocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockFarmStation.unlocalisedName;
|
||||
@@ -811,6 +879,17 @@ public class TileFarmStation extends AbstractPoweredTaskEntity implements IRange
|
||||
} else if (slotLayoutVersion == 2) {
|
||||
inventory = (new ArrayMappingTool<ItemStack>("TTTSSSSOOOOOOC", "TTTBBSSSSOOOOOOC")).map(inventory);
|
||||
}
|
||||
|
||||
if (nbtRoot.hasKey("HarvestBuffer")) {
|
||||
NBTTagList bufferList = nbtRoot.getTagList("HarvestBuffer", 10);
|
||||
for (int i = 0; i < bufferList.tagCount(); i++) {
|
||||
NBTTagCompound itemTag = bufferList.getCompoundTagAt(i);
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(itemTag);
|
||||
if (stack != null && stack.stackSize > 0) {
|
||||
harvestBuffer.add(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IPoweredTask createTask() {
|
||||
@@ -834,6 +913,18 @@ public class TileFarmStation extends AbstractPoweredTaskEntity implements IRange
|
||||
nbtRoot.setIntArray("lockedSlots", locked);
|
||||
}
|
||||
nbtRoot.setInteger("slotLayoutVersion", 3);
|
||||
|
||||
if (!harvestBuffer.isEmpty()) {
|
||||
NBTTagList bufferList = new NBTTagList();
|
||||
for (ItemStack stack : harvestBuffer) {
|
||||
if (stack != null && stack.stackSize > 0) {
|
||||
NBTTagCompound itemTag = new NBTTagCompound();
|
||||
stack.writeToNBT(itemTag);
|
||||
bufferList.appendTag(itemTag);
|
||||
}
|
||||
}
|
||||
nbtRoot.setTag("HarvestBuffer", bufferList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,7 +17,9 @@ import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import com.mitchej123.hodgepodge.mixins.interfaces.INetherSeed;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.machine.farm.TileFarmStation;
|
||||
|
||||
public class PlantableFarmer implements IFarmerJoe {
|
||||
@@ -109,7 +111,13 @@ public class PlantableFarmer implements IFarmerJoe {
|
||||
|
||||
protected boolean plant(TileFarmStation farm, World worldObj, BlockCoord bc, IPlantable plantable) {
|
||||
worldObj.setBlock(bc.x, bc.y, bc.z, Blocks.air, 0, 1 | 2);
|
||||
Block target = plantable.getPlant(null, 0, 0, 0);
|
||||
Block target;
|
||||
// needed for Pam's nether seeds
|
||||
if (EnderIO.hasHP && plantable instanceof INetherSeed netherSeed) {
|
||||
target = netherSeed.hodgepodge$getPlant(null, 0, 0, 0);
|
||||
} else {
|
||||
target = plantable.getPlant(null, 0, 0, 0);
|
||||
}
|
||||
int meta = plantable.getPlantMetadata(null, 0, 0, 0);
|
||||
worldObj.setBlock(bc.x, bc.y, bc.z, target, meta, 1 | 2);
|
||||
farm.actionPerformed(false);
|
||||
@@ -117,7 +125,13 @@ public class PlantableFarmer implements IFarmerJoe {
|
||||
}
|
||||
|
||||
protected boolean canPlant(World worldObj, BlockCoord bc, IPlantable plantable) {
|
||||
Block target = plantable.getPlant(null, 0, 0, 0);
|
||||
Block target;
|
||||
// needed for Pam's nether seeds
|
||||
if (EnderIO.hasHP && plantable instanceof INetherSeed netherSeed) {
|
||||
target = netherSeed.hodgepodge$getPlant(null, 0, 0, 0);
|
||||
} else {
|
||||
target = plantable.getPlant(null, 0, 0, 0);
|
||||
}
|
||||
Block ground = worldObj.getBlock(bc.x, bc.y - 1, bc.z);
|
||||
if (target != null && target.canPlaceBlockAt(worldObj, bc.x, bc.y, bc.z)
|
||||
&& target.canBlockStay(worldObj, bc.x, bc.y, bc.z)
|
||||
@@ -182,10 +196,14 @@ public class PlantableFarmer implements IFarmerJoe {
|
||||
}
|
||||
|
||||
private boolean isPlantableForBlock(ItemStack stack, Block block) {
|
||||
if (!(stack.getItem() instanceof IPlantable)) {
|
||||
return false;
|
||||
if (stack.getItem() instanceof IPlantable plantable) {
|
||||
// needed for Pam's nether seeds
|
||||
if (EnderIO.hasHP && plantable instanceof INetherSeed netherSeed) {
|
||||
return netherSeed.hodgepodge$getPlant(null, 0, 0, 0) == block;
|
||||
} else {
|
||||
return plantable.getPlant(null, 0, 0, 0) == block;
|
||||
}
|
||||
}
|
||||
IPlantable plantable = (IPlantable) stack.getItem();
|
||||
return plantable.getPlant(null, 0, 0, 0) == block;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -12,6 +12,7 @@ import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.machine.AbstractMachineBlock;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.util.ForgeDirections;
|
||||
|
||||
public class BlockStirlingGenerator extends AbstractMachineBlock<TileEntityStirlingGenerator> {
|
||||
|
||||
@@ -59,7 +60,7 @@ public class BlockStirlingGenerator extends AbstractMachineBlock<TileEntityStirl
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
TileEntityStirlingGenerator te = (TileEntityStirlingGenerator) world.getTileEntity(x, y, z);
|
||||
if (te != null && te.isActive()) {
|
||||
ForgeDirection front = ForgeDirection.values()[te.facing];
|
||||
ForgeDirection front = ForgeDirections.DIRECTIONS[te.facing];
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
double px = x + 0.5 + front.offsetX * 0.6;
|
||||
|
||||
@@ -159,10 +159,13 @@ public class BlockZombieGenerator extends AbstractMachineBlock<TileZombieGenerat
|
||||
|
||||
@Override
|
||||
public void getWailaInfo(List<String> tooltip, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te != null && te instanceof TileZombieGenerator) {
|
||||
if (EnderIO.hasWailaPlugins) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (world.getTileEntity(x, y, z) instanceof TileZombieGenerator generator) {
|
||||
tooltip.add(
|
||||
((TileZombieGenerator) te).getFluidStored(ForgeDirection.UNKNOWN) + " "
|
||||
generator.getFluidStored(ForgeDirection.UNKNOWN) + " "
|
||||
+ EnderIO.lang.localize("fluid.millibucket.abr"));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -23,6 +23,7 @@ import com.enderio.core.common.vecmath.Vector3d;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.util.ForgeDirections;
|
||||
import crazypants.util.RenderPassHelper;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -64,7 +65,7 @@ public class ZombieGeneratorRenderer extends TileEntitySpecialRenderer implement
|
||||
Tessellator tes = Tessellator.instance;
|
||||
tes.startDrawingQuads();
|
||||
|
||||
ForgeDirection facingDir = ForgeDirection.values()[gen.facing];
|
||||
ForgeDirection facingDir = ForgeDirections.DIRECTIONS[gen.facing];
|
||||
double facingOffset = 0.075;
|
||||
|
||||
BoundingBox bb = BoundingBox.UNIT_CUBE.scale(0.85, 0.96, 0.85);
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.enderio.core.common.vecmath.Vector3d;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.machine.generator.zombie.ModelZombieJar;
|
||||
import crazypants.util.ForgeDirections;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class KillerJoeRenderer extends TileEntitySpecialRenderer implements IItemRenderer {
|
||||
@@ -130,7 +131,7 @@ public class KillerJoeRenderer extends TileEntitySpecialRenderer implements IIte
|
||||
bb = bb.scale(1, 0.85 * fullness, 1);
|
||||
float ty = -(0.85f - (bb.maxY - bb.minY)) / 2;
|
||||
|
||||
Vector3d offset = ForgeDirectionOffsets.offsetScaled(ForgeDirection.values()[gen.facing], -0.075);
|
||||
Vector3d offset = ForgeDirectionOffsets.offsetScaled(ForgeDirections.DIRECTIONS[gen.facing], -0.075);
|
||||
bb = bb.translate((float) offset.x, ty, (float) offset.z);
|
||||
|
||||
int brightness;
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.enderio.core.api.client.gui.IResourceTooltipProvider;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.util.ForgeDirections;
|
||||
|
||||
public class BlockItemElectricLight extends ItemBlockWithMetadata implements IResourceTooltipProvider {
|
||||
|
||||
@@ -70,7 +71,7 @@ public class BlockItemElectricLight extends ItemBlockWithMetadata implements IRe
|
||||
return false;
|
||||
}
|
||||
if (world.getBlock(x, y, z) == field_150939_a) {
|
||||
ForgeDirection onFace = ForgeDirection.values()[side].getOpposite();
|
||||
ForgeDirection onFace = ForgeDirections.DIRECTIONS[side].getOpposite();
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te instanceof TileElectricLight) {
|
||||
TileElectricLight el = ((TileElectricLight) te);
|
||||
|
||||
@@ -22,6 +22,7 @@ import crazypants.enderio.machine.wireless.WirelessChargedLocation;
|
||||
import crazypants.enderio.power.Capacitors;
|
||||
import crazypants.enderio.power.IInternalPowerReceiver;
|
||||
import crazypants.enderio.power.PowerHandlerUtil;
|
||||
import crazypants.util.ForgeDirections;
|
||||
|
||||
public class TileElectricLight extends TileEntityEio implements IInternalPowerReceiver {
|
||||
|
||||
@@ -334,7 +335,7 @@ public class TileElectricLight extends TileEntityEio implements IInternalPowerRe
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound root) {
|
||||
|
||||
face = ForgeDirection.values()[root.getShort("face")];
|
||||
face = ForgeDirections.DIRECTIONS[root.getShort("face")];
|
||||
isInvereted = root.getBoolean("isInverted");
|
||||
requiresPower = root.getBoolean("requiresPower");
|
||||
setWireless(root.getBoolean("isWireless"));
|
||||
|
||||
@@ -4,7 +4,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
|
||||
@@ -14,6 +13,7 @@ import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.machine.AbstractMachineBlock;
|
||||
import crazypants.enderio.machine.ContainerNoInv;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.util.ForgeDirections;
|
||||
|
||||
public class BlockPowerMonitor extends AbstractMachineBlock<TilePowerMonitor> {
|
||||
|
||||
@@ -74,7 +74,8 @@ public class BlockPowerMonitor extends AbstractMachineBlock<TilePowerMonitor> {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te instanceof TilePowerMonitor) {
|
||||
|
||||
return ((TilePowerMonitor) te).getRednetOutputValue(ForgeDirection.values()[side], DyeColor.RED.ordinal());
|
||||
return ((TilePowerMonitor) te)
|
||||
.getRednetOutputValue(ForgeDirections.DIRECTIONS[side], DyeColor.RED.ordinal());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -53,8 +53,8 @@ public class TilePowerMonitor extends AbstractPowerConsumerEntity implements IIn
|
||||
if (currentlyEmmittedSignal == null) {
|
||||
return new int[16];
|
||||
}
|
||||
int[] res = new int[DyeColor.values().length];
|
||||
for (DyeColor col : DyeColor.values()) {
|
||||
int[] res = new int[DyeColor.VALUES.length];
|
||||
for (DyeColor col : DyeColor.VALUES) {
|
||||
res[col.ordinal()] = currentlyEmmittedSignal.color == col ? 15 : 0;
|
||||
}
|
||||
return res;
|
||||
|
||||
@@ -58,7 +58,7 @@ public class TileReservoir extends TileEntityEio implements IFluidHandler, ITank
|
||||
}
|
||||
}
|
||||
|
||||
static final FluidStack WATER_BUCKET = FluidRegistry.getFluidStack("water", BUCKET_VOLUME);
|
||||
static final FluidStack WATER_BUCKET = new FluidStack(FluidRegistry.WATER, BUCKET_VOLUME);
|
||||
|
||||
BlockCoord[] multiblock = null;
|
||||
|
||||
@@ -156,7 +156,7 @@ public class TileReservoir extends TileEntityEio implements IFluidHandler, ITank
|
||||
if (tank.getFluid() == null) {
|
||||
return true;
|
||||
}
|
||||
if (fluid != null && fluid.getID() == tank.getFluid().getFluidID()) {
|
||||
if (fluid != null && fluid == tank.getFluid().getFluid()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -167,7 +167,7 @@ public class TileReservoir extends TileEntityEio implements IFluidHandler, ITank
|
||||
if (tank.getFluid() == null || fluid == null) {
|
||||
return false;
|
||||
}
|
||||
return tank.getFluid().getFluid().getID() == fluid.getID();
|
||||
return tank.getFluid().getFluid() == fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,6 +14,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.machine.AbstractMachineBlock;
|
||||
import crazypants.util.ForgeDirections;
|
||||
|
||||
public class BlockSliceAndSplice extends AbstractMachineBlock<TileSliceAndSplice> {
|
||||
|
||||
@@ -84,7 +85,7 @@ public class BlockSliceAndSplice extends AbstractMachineBlock<TileSliceAndSplice
|
||||
TileSliceAndSplice te = (TileSliceAndSplice) world.getTileEntity(x, y, z);
|
||||
if (isActive(world, x, y, z) && te != null) {
|
||||
|
||||
ForgeDirection front = ForgeDirection.values()[te.facing];
|
||||
ForgeDirection front = ForgeDirections.DIRECTIONS[te.facing];
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
double px = x + 0.5 + front.offsetX * 0.6;
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import crazypants.enderio.ClientProxy;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.util.ForgeDirections;
|
||||
|
||||
@ThreadSafeISBRH(perThread = true)
|
||||
public class SoulBinderRenderer implements ISimpleBlockRenderingHandler {
|
||||
@@ -97,7 +98,7 @@ public class SoulBinderRenderer implements ISimpleBlockRenderingHandler {
|
||||
}
|
||||
|
||||
private ForgeDirection forFacing(ForgeDirection side, int facing) {
|
||||
return ForgeDirection.values()[ClientProxy.sideAndFacingToSpriteOffset[side.ordinal()][facing]];
|
||||
return ForgeDirections.DIRECTIONS[ClientProxy.sideAndFacingToSpriteOffset[side.ordinal()][facing]];
|
||||
}
|
||||
|
||||
private void renderSkull(ForgeDirection face, IIcon soulariumIcon, IIcon faceIcon) {
|
||||
|
||||
@@ -187,6 +187,10 @@ public class BlockTank extends AbstractMachineBlock<TileTank> implements IAdvanc
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addBasicEntries(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag) {
|
||||
if (EnderIO.hasWailaPlugins) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemstack.stackTagCompound != null && itemstack.stackTagCompound.hasKey("tankContents")) {
|
||||
FluidStack fl = FluidStack
|
||||
.loadFluidStackFromNBT((NBTTagCompound) itemstack.stackTagCompound.getTag("tankContents"));
|
||||
@@ -219,9 +223,11 @@ public class BlockTank extends AbstractMachineBlock<TileTank> implements IAdvanc
|
||||
|
||||
@Override
|
||||
public void getWailaInfo(List<String> tooltip, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te instanceof TileTank) {
|
||||
TileTank tank = (TileTank) te;
|
||||
if (EnderIO.hasWailaPlugins) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (world.getTileEntity(x, y, z) instanceof TileTank tank) {
|
||||
FluidStack stored = tank.tank.getFluid();
|
||||
String fluid = stored == null ? EnderIO.lang.localize("tooltip.none")
|
||||
: stored.getFluid().getLocalizedName(stored);
|
||||
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.TileEntityEio;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.power.IInternalPowerReceiver;
|
||||
@@ -28,7 +29,12 @@ public class TileWirelessCharger extends TileEntityEio implements IInternalPower
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
WirelessChargerController.instance.deregisterCharger(this);
|
||||
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
EnderIO.proxy.wirelessChargerController.deregisterCharger(this);
|
||||
registered = false;
|
||||
}
|
||||
|
||||
@@ -40,7 +46,7 @@ public class TileWirelessCharger extends TileEntityEio implements IInternalPower
|
||||
}
|
||||
|
||||
if (!registered) {
|
||||
WirelessChargerController.instance.registerCharger(this);
|
||||
EnderIO.proxy.wirelessChargerController.registerCharger(this);
|
||||
registered = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package crazypants.enderio.machine.wireless;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -10,6 +8,8 @@ import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
|
||||
public class WirelessChargedLocation {
|
||||
|
||||
private final TileEntity te;
|
||||
@@ -18,34 +18,30 @@ public class WirelessChargedLocation {
|
||||
|
||||
public WirelessChargedLocation(TileEntity te) {
|
||||
this.te = te;
|
||||
this.chargers = new ArrayList<IWirelessCharger>();
|
||||
this.chargers = new ArrayList<>();
|
||||
/*
|
||||
* Set lastChangeCount to one less than the current change count so that the charger list is updated on first
|
||||
* use (unless ~4B changes happen in between). Do this instead directly updating so that WirelessChargedLocation
|
||||
* can be used while the TileEntity is still in construction (or loading).
|
||||
*/
|
||||
this.lastChangeCount = WirelessChargerController.instance.getChangeCount() - 1;
|
||||
this.lastChangeCount = EnderIO.proxy.wirelessChargerController.getChangeCount() - 1;
|
||||
}
|
||||
|
||||
private void updateChargers() {
|
||||
WirelessChargerController wcc = WirelessChargerController.instance;
|
||||
WirelessChargerController wcc = EnderIO.proxy.wirelessChargerController;
|
||||
chargers.clear();
|
||||
lastChangeCount = wcc.getChangeCount();
|
||||
final BlockCoord bc = new BlockCoord(te);
|
||||
wcc.getChargers(te.getWorldObj(), bc, chargers);
|
||||
Collections.sort(chargers, new Comparator<IWirelessCharger>() {
|
||||
|
||||
@Override
|
||||
public int compare(IWirelessCharger o1, IWirelessCharger o2) {
|
||||
int dist1 = o1.getLocation().getDistSq(bc);
|
||||
int dist2 = o2.getLocation().getDistSq(bc);
|
||||
return dist1 - dist2;
|
||||
}
|
||||
chargers.sort((o1, o2) -> {
|
||||
int dist1 = o1.getLocation().getDistSq(bc);
|
||||
int dist2 = o2.getLocation().getDistSq(bc);
|
||||
return dist1 - dist2;
|
||||
});
|
||||
}
|
||||
|
||||
private void checkChangeCount() {
|
||||
if (lastChangeCount != WirelessChargerController.instance.getChangeCount()) {
|
||||
if (lastChangeCount != EnderIO.proxy.wirelessChargerController.getChangeCount()) {
|
||||
updateChargers();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,9 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -21,20 +19,17 @@ import crazypants.util.BaublesUtil;
|
||||
|
||||
public class WirelessChargerController {
|
||||
|
||||
public static WirelessChargerController instance = new WirelessChargerController();
|
||||
|
||||
public static final int RANGE = Config.wirelessChargerRange;
|
||||
public static final int RANGE_SQ = RANGE * RANGE;
|
||||
|
||||
static {
|
||||
FMLCommonHandler.instance().bus().register(WirelessChargerController.instance);
|
||||
MinecraftForge.EVENT_BUS.register(WirelessChargerController.instance);
|
||||
}
|
||||
|
||||
private static final int RANGE = Config.wirelessChargerRange;
|
||||
private static final int RANGE_SQ = RANGE * RANGE;
|
||||
private final Map<Integer, Map<BlockCoord, IWirelessCharger>> perWorldChargers = new HashMap<Integer, Map<BlockCoord, IWirelessCharger>>();
|
||||
private int changeCount;
|
||||
|
||||
private WirelessChargerController() {}
|
||||
@SubscribeEvent
|
||||
public void onPlayerTick(TickEvent.PlayerTickEvent event) {
|
||||
if (event.side != Side.CLIENT && event.phase == TickEvent.Phase.END) {
|
||||
chargePlayersItems(event.player);
|
||||
}
|
||||
}
|
||||
|
||||
public void registerCharger(IWirelessCharger charger) {
|
||||
if (charger == null) {
|
||||
@@ -54,28 +49,7 @@ public class WirelessChargerController {
|
||||
changeCount++;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerTick(TickEvent.PlayerTickEvent event) {
|
||||
if (event.side == Side.CLIENT || event.phase != TickEvent.Phase.END) {
|
||||
return;
|
||||
}
|
||||
chargePlayersItems(event.player);
|
||||
}
|
||||
|
||||
public int getChangeCount() {
|
||||
return changeCount;
|
||||
}
|
||||
|
||||
public void getChargers(World world, BlockCoord bc, Collection<IWirelessCharger> res) {
|
||||
Map<BlockCoord, IWirelessCharger> chargers = getChargersForWorld(world);
|
||||
for (IWirelessCharger wc : chargers.values()) {
|
||||
if (wc.getLocation().getDistSq(bc) <= RANGE_SQ) {
|
||||
res.add(wc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void chargePlayersItems(EntityPlayer player) {
|
||||
private void chargePlayersItems(EntityPlayer player) {
|
||||
Map<BlockCoord, IWirelessCharger> chargers = getChargersForWorld(player.worldObj);
|
||||
if (chargers.isEmpty()) {
|
||||
return;
|
||||
@@ -108,13 +82,21 @@ public class WirelessChargerController {
|
||||
return res;
|
||||
}
|
||||
|
||||
private Map<BlockCoord, IWirelessCharger> getChargersForWorld(World world) {
|
||||
Map<BlockCoord, IWirelessCharger> res = perWorldChargers.get(world.provider.dimensionId);
|
||||
if (res == null) {
|
||||
res = new HashMap<BlockCoord, IWirelessCharger>();
|
||||
perWorldChargers.put(world.provider.dimensionId, res);
|
||||
public int getChangeCount() {
|
||||
return changeCount;
|
||||
}
|
||||
|
||||
public void getChargers(World world, BlockCoord bc, Collection<IWirelessCharger> res) {
|
||||
Map<BlockCoord, IWirelessCharger> chargers = getChargersForWorld(world);
|
||||
for (IWirelessCharger wc : chargers.values()) {
|
||||
if (wc.getLocation().getDistSq(bc) <= RANGE_SQ) {
|
||||
res.add(wc);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private Map<BlockCoord, IWirelessCharger> getChargersForWorld(World world) {
|
||||
return perWorldChargers.computeIfAbsent(world.provider.dimensionId, k -> new HashMap<>());
|
||||
}
|
||||
|
||||
public Collection<IWirelessCharger> getChargers(World world) {
|
||||
|
||||
@@ -21,13 +21,17 @@ public enum Alloy {
|
||||
SOULARIUM("soularium", 10.0f),
|
||||
END_STEEL("endSteel", 10.0f);
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final Alloy[] VALUES = values();
|
||||
public final String unlocalisedName;
|
||||
public final String iconKey;
|
||||
private final List<String> oreIngots = new ArrayList<String>();
|
||||
private final List<String> oreBlocks = new ArrayList<String>();
|
||||
private final float hardness;
|
||||
|
||||
private Alloy(String baseName, float hardness, String oreDictName) {
|
||||
Alloy(String baseName, float hardness, String oreDictName) {
|
||||
this.unlocalisedName = "enderio." + baseName;
|
||||
this.iconKey = "enderio:" + baseName;
|
||||
if (oreDictName != null) {
|
||||
@@ -40,7 +44,7 @@ public enum Alloy {
|
||||
this.hardness = hardness;
|
||||
}
|
||||
|
||||
private Alloy(String baseName, float hardness) {
|
||||
Alloy(String baseName, float hardness) {
|
||||
this(baseName, hardness, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,8 +45,8 @@ public class BlockIngotStorage extends BlockEio implements IAdvancedTooltipProvi
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
icons = new IIcon[Alloy.values().length];
|
||||
for (Alloy alloy : Alloy.values()) {
|
||||
icons = new IIcon[Alloy.VALUES.length];
|
||||
for (Alloy alloy : Alloy.VALUES) {
|
||||
icons[alloy.ordinal()] = register.registerIcon(alloy.iconKey + "Block");
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public class BlockIngotStorage extends BlockEio implements IAdvancedTooltipProvi
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
meta = MathHelper.clamp_int(meta, 0, Alloy.values().length - 1);
|
||||
meta = MathHelper.clamp_int(meta, 0, Alloy.VALUES.length - 1);
|
||||
return icons[meta];
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class BlockIngotStorage extends BlockEio implements IAdvancedTooltipProvi
|
||||
|
||||
@Override
|
||||
public float getBlockHardness(World world, int x, int y, int z) {
|
||||
return Alloy.values()[world.getBlockMetadata(x, y, z)].getHardness();
|
||||
return Alloy.VALUES[world.getBlockMetadata(x, y, z)].getHardness();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,7 +21,7 @@ public class BlockItemIngotStorage extends ItemBlock {
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return "tile." + Alloy.values()[stack.getItemDamage()].unlocalisedName;
|
||||
return "tile." + Alloy.VALUES[stack.getItemDamage()].unlocalisedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -32,7 +32,7 @@ public class BlockItemIngotStorage extends ItemBlock {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||
for (Alloy alloy : Alloy.values()) {
|
||||
for (Alloy alloy : Alloy.VALUES) {
|
||||
list.add(new ItemStack(this, 1, alloy.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ItemAlloy extends Item {
|
||||
setCreativeTab(EnderIOTab.tabEnderIO);
|
||||
setUnlocalizedName(ModObject.itemAlloy.unlocalisedName);
|
||||
|
||||
numItems = Alloy.values().length;
|
||||
numItems = Alloy.VALUES.length;
|
||||
if (useNuggets) {
|
||||
numItems = numItems * 2;
|
||||
}
|
||||
@@ -55,13 +55,13 @@ public class ItemAlloy extends Item {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister IIconRegister) {
|
||||
int numAlloys = Alloy.values().length;
|
||||
int numAlloys = Alloy.VALUES.length;
|
||||
for (int i = 0; i < numAlloys; i++) {
|
||||
icons[i] = IIconRegister.registerIcon(Alloy.values()[i].iconKey);
|
||||
icons[i] = IIconRegister.registerIcon(Alloy.VALUES[i].iconKey);
|
||||
}
|
||||
if (useNuggets) {
|
||||
for (int i = 0; i < numAlloys; i++) {
|
||||
icons[i + numAlloys] = IIconRegister.registerIcon(Alloy.values()[i].iconKey + "Nugget");
|
||||
icons[i + numAlloys] = IIconRegister.registerIcon(Alloy.VALUES[i].iconKey + "Nugget");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,10 +69,10 @@ public class ItemAlloy extends Item {
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack par1ItemStack) {
|
||||
int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, numItems - 1);
|
||||
if (i < Alloy.values().length) {
|
||||
return Alloy.values()[i].unlocalisedName;
|
||||
if (i < Alloy.VALUES.length) {
|
||||
return Alloy.VALUES[i].unlocalisedName;
|
||||
} else {
|
||||
return Alloy.values()[i - Alloy.values().length].unlocalisedName + "Nugget";
|
||||
return Alloy.VALUES[i - Alloy.VALUES.length].unlocalisedName + "Nugget";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package crazypants.enderio.material;
|
||||
|
||||
import static net.minecraft.util.EnumChatFormatting.RESET;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -9,6 +12,7 @@ import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
@@ -20,6 +24,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.power.BasicCapacitor;
|
||||
import crazypants.enderio.power.Capacitors;
|
||||
import crazypants.enderio.power.ICapacitor;
|
||||
@@ -28,6 +33,7 @@ import crazypants.enderio.power.ICapacitorItem;
|
||||
public class ItemCapacitor extends Item implements ICapacitorItem {
|
||||
|
||||
private static final BasicCapacitor CAP = new BasicCapacitor();
|
||||
private static final String SPACE = " ";
|
||||
|
||||
public static ItemCapacitor create() {
|
||||
ItemCapacitor result = new ItemCapacitor();
|
||||
@@ -44,7 +50,7 @@ public class ItemCapacitor extends Item implements ICapacitorItem {
|
||||
setMaxDamage(0);
|
||||
setMaxStackSize(64);
|
||||
|
||||
icons = new IIcon[Capacitors.values().length];
|
||||
icons = new IIcon[Capacitors.VALUES.length];
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
@@ -54,30 +60,30 @@ public class ItemCapacitor extends Item implements ICapacitorItem {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int damage) {
|
||||
damage = MathHelper.clamp_int(damage, 0, Capacitors.values().length - 1);
|
||||
damage = MathHelper.clamp_int(damage, 0, Capacitors.VALUES.length - 1);
|
||||
return icons[damage];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister IIconRegister) {
|
||||
for (int i = 0; i < Capacitors.values().length; i++) {
|
||||
icons[i] = IIconRegister.registerIcon(Capacitors.values()[i].iconKey);
|
||||
for (int i = 0; i < Capacitors.VALUES.length; i++) {
|
||||
icons[i] = IIconRegister.registerIcon(Capacitors.VALUES[i].iconKey);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack par1ItemStack) {
|
||||
int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, Capacitors.values().length - 1);
|
||||
return Capacitors.values()[i].unlocalisedName;
|
||||
int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, Capacitors.VALUES.length - 1);
|
||||
return Capacitors.VALUES[i].unlocalisedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List<ItemStack> par3List) {
|
||||
for (int j = 0; j < Capacitors.values().length; ++j) {
|
||||
for (int j = 0; j < Capacitors.VALUES.length; ++j) {
|
||||
par3List.add(new ItemStack(par1, 1, j));
|
||||
if (Capacitors.values()[j] == Capacitors.TOTEMIC_CAPACITOR) {
|
||||
if (Capacitors.VALUES[j] == Capacitors.TOTEMIC_CAPACITOR) {
|
||||
ItemStack stack = new ItemStack(par1, 1, j);
|
||||
stack.addEnchantment(Enchantment.efficiency, 5);
|
||||
par3List.add(stack);
|
||||
@@ -87,16 +93,16 @@ public class ItemCapacitor extends Item implements ICapacitorItem {
|
||||
|
||||
@Override
|
||||
public ICapacitor getCapacitor(ItemStack stack) {
|
||||
int damage = MathHelper.clamp_int(stack.getItemDamage(), 0, Capacitors.values().length - 1);
|
||||
int damage = MathHelper.clamp_int(stack.getItemDamage(), 0, Capacitors.VALUES.length - 1);
|
||||
|
||||
if (Capacitors.values()[damage] == Capacitors.TOTEMIC_CAPACITOR) {
|
||||
if (Capacitors.VALUES[damage] == Capacitors.TOTEMIC_CAPACITOR) {
|
||||
damage = MathHelper.clamp_int(
|
||||
EnchantmentHelper.getEnchantmentLevel(Enchantment.efficiency.effectId, stack) + 1,
|
||||
1,
|
||||
Capacitors.TOTEMIC_CAPACITOR.ordinal());
|
||||
}
|
||||
|
||||
return Capacitors.values()[damage].capacitor;
|
||||
return Capacitors.VALUES[damage].capacitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -104,12 +110,43 @@ public class ItemCapacitor extends Item implements ICapacitorItem {
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List<String> par3List,
|
||||
boolean par4) {
|
||||
if (par1ItemStack != null && par1ItemStack.getItemDamage() > 0 && par1ItemStack.getItemDamage() != 7) {
|
||||
par3List.add(EnderIO.lang.localize("machine.tooltip.upgrade"));
|
||||
ICapacitor capacitor = getCapacitor(par1ItemStack);
|
||||
par3List.add(EnumChatFormatting.GREEN + EnderIO.lang.localize("machine.tooltip.upgrade.name"));
|
||||
if (SpecialTooltipHandler.showAdvancedTooltips()) {
|
||||
SpecialTooltipHandler.addDetailedTooltipFromResources(par3List, "enderio.machine.tooltip.upgrade");
|
||||
addUpgrades(par3List, capacitor);
|
||||
addRangeUpgrade(par3List, capacitor);
|
||||
} else {
|
||||
SpecialTooltipHandler.addShowDetailsTooltip(par3List);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addUpgrades(List<String> list, ICapacitor capacitor) {
|
||||
DecimalFormat formatter = new DecimalFormat("#,###");
|
||||
String tierString = EnumChatFormatting.AQUA + EnderIO.lang.localize("machine.tooltip.upgrade.tier");
|
||||
String maxEnergyStorageString = EnumChatFormatting.AQUA
|
||||
+ EnderIO.lang.localize("machine.tooltip.upgrade.energystorage");
|
||||
String maxEnergyReceivedString = EnumChatFormatting.AQUA
|
||||
+ EnderIO.lang.localize("machine.tooltip.upgrade.energyreceived");
|
||||
String maxEnergyExtractedString = EnumChatFormatting.AQUA
|
||||
+ EnderIO.lang.localize("machine.tooltip.upgrade.energyextracted");
|
||||
String upgrades = EnumChatFormatting.GOLD + EnderIO.lang.localize("machine.tooltip.upgrade");
|
||||
String maxEnergyStorage = formatter.format(capacitor.getMaxEnergyStored());
|
||||
int tier = capacitor.getTier();
|
||||
String maxEnergyReceived = formatter.format(capacitor.getMaxEnergyReceived());
|
||||
String maxEnergyExtracted = formatter.format(capacitor.getMaxEnergyExtracted());
|
||||
list.add(upgrades);
|
||||
list.add(SPACE + tierString + RESET + tier);
|
||||
list.add(SPACE + maxEnergyReceivedString + RESET + maxEnergyReceived);
|
||||
list.add(SPACE + maxEnergyExtractedString + RESET + maxEnergyExtracted);
|
||||
list.add(SPACE + maxEnergyStorageString + RESET + maxEnergyStorage);
|
||||
}
|
||||
|
||||
public void addRangeUpgrade(List<String> list, ICapacitor capacitor) {
|
||||
String farmStation = EnumChatFormatting.AQUA + EnderIO.lang.localize("machine.tooltip.upgrade.farmstation");
|
||||
String rangeUpgrade = EnumChatFormatting.GOLD + EnderIO.lang.localize("machine.tooltip.upgrade.range");
|
||||
int range = Config.farmBonusSize * capacitor.getTier() - 1 + 2;
|
||||
list.add(rangeUpgrade);
|
||||
list.add(SPACE + farmStation + RESET + range);
|
||||
}
|
||||
}
|
||||
@@ -36,14 +36,14 @@ public class ItemGrindingBall extends ItemAlloy {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister IIconRegister) {
|
||||
int numAlloys = Alloy.values().length;
|
||||
int numAlloys = Alloy.VALUES.length;
|
||||
for (int i = 0; i < numAlloys; i++)
|
||||
icons[i] = IIconRegister.registerIcon(Alloy.values()[i].iconKey + "GrindingBall");
|
||||
icons[i] = IIconRegister.registerIcon(Alloy.VALUES[i].iconKey + "GrindingBall");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack par1ItemStack) {
|
||||
int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, numItems - 1);
|
||||
return Alloy.values()[i].unlocalisedName + "_ball";
|
||||
return Alloy.VALUES[i].unlocalisedName + "_ball";
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public class ItemMaterial extends Item {
|
||||
setCreativeTab(EnderIOTab.tabEnderIO);
|
||||
setUnlocalizedName(ModObject.itemMaterial.unlocalisedName);
|
||||
|
||||
icons = new IIcon[Material.values().length];
|
||||
icons = new IIcon[Material.VALUES.length];
|
||||
}
|
||||
|
||||
private void init() {
|
||||
@@ -41,29 +41,29 @@ public class ItemMaterial extends Item {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int damage) {
|
||||
damage = MathHelper.clamp_int(damage, 0, Material.values().length - 1);
|
||||
damage = MathHelper.clamp_int(damage, 0, Material.VALUES.length - 1);
|
||||
return icons[damage];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister IIconRegister) {
|
||||
int numParts = Material.values().length;
|
||||
int numParts = Material.VALUES.length;
|
||||
for (int i = 0; i < numParts; i++) {
|
||||
icons[i] = IIconRegister.registerIcon(Material.values()[i].iconKey);
|
||||
icons[i] = IIconRegister.registerIcon(Material.VALUES[i].iconKey);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack par1ItemStack) {
|
||||
int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, Material.values().length - 1);
|
||||
return Material.values()[i].unlocalisedName;
|
||||
int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, Material.VALUES.length - 1);
|
||||
return Material.VALUES[i].unlocalisedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List<ItemStack> par3List) {
|
||||
for (int j = 0; j < Material.values().length; ++j) {
|
||||
for (int j = 0; j < Material.VALUES.length; ++j) {
|
||||
par3List.add(new ItemStack(par1, 1, j));
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class ItemMaterial extends Item {
|
||||
if (par1ItemStack == null) {
|
||||
return false;
|
||||
}
|
||||
int damage = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, Material.values().length - 1);
|
||||
return Material.values()[damage].hasEffect;
|
||||
int damage = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, Material.VALUES.length - 1);
|
||||
return Material.VALUES[damage].hasEffect;
|
||||
}
|
||||
}
|
||||
@@ -29,16 +29,20 @@ public enum Material {
|
||||
ENDER_POWDER("enderCrystalPowder", true),
|
||||
PRECIENT_POWDER("precientPowder", true);
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final Material[] VALUES = values();
|
||||
public final String unlocalisedName;
|
||||
public final String iconKey;
|
||||
public final String oreDict;
|
||||
public final boolean hasEffect;
|
||||
|
||||
private Material(String unlocalisedName) {
|
||||
Material(String unlocalisedName) {
|
||||
this(unlocalisedName, false);
|
||||
}
|
||||
|
||||
private Material(String unlocalisedName, boolean hasEffect) {
|
||||
Material(String unlocalisedName, boolean hasEffect) {
|
||||
this.unlocalisedName = "enderio." + unlocalisedName;
|
||||
this.iconKey = "enderio:" + unlocalisedName;
|
||||
this.hasEffect = hasEffect;
|
||||
@@ -46,7 +50,7 @@ public enum Material {
|
||||
}
|
||||
|
||||
public static void registerOres(Item item) {
|
||||
for (Material m : values()) {
|
||||
for (Material m : VALUES) {
|
||||
OreDictionary.registerOre(m.oreDict, new ItemStack(item, 1, m.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package crazypants.enderio.material;
|
||||
|
||||
import static crazypants.enderio.EnderIO.hasGT5;
|
||||
import static crazypants.enderio.material.Alloy.DARK_STEEL;
|
||||
import static crazypants.enderio.material.Alloy.END_STEEL;
|
||||
import static crazypants.enderio.material.Alloy.ENERGETIC_ALLOY;
|
||||
@@ -58,20 +59,23 @@ public class MaterialRecipes {
|
||||
|
||||
public static void registerOresInDictionary() {
|
||||
// Ore Dictionary Registration
|
||||
for (PowderIngot powder : PowderIngot.values()) {
|
||||
if (!powder.hasDependancy()) {
|
||||
OreDictionary
|
||||
.registerOre(powder.oreDictName, new ItemStack(EnderIO.itemPowderIngot, 1, powder.ordinal()));
|
||||
if (!hasGT5) {
|
||||
for (PowderIngot powder : PowderIngot.values()) {
|
||||
if (!powder.hasDependancy()) {
|
||||
OreDictionary.registerOre(
|
||||
powder.oreDictName,
|
||||
new ItemStack(EnderIO.itemPowderIngot, 1, powder.ordinal()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Capacitors capacitor : Capacitors.values()) {
|
||||
for (Capacitors capacitor : Capacitors.VALUES) {
|
||||
OreDictionary.registerOre(
|
||||
capacitor.getOreTag(),
|
||||
new ItemStack(EnderIO.itemBasicCapacitor, 1, capacitor.ordinal()));
|
||||
}
|
||||
|
||||
for (Alloy alloy : Alloy.values()) {
|
||||
for (Alloy alloy : Alloy.VALUES) {
|
||||
boolean isPrimaryName = true;
|
||||
for (String oreDictName : alloy.getOreIngots()) {
|
||||
OreDictionary.registerOre(oreDictName, alloy.getStackIngot());
|
||||
@@ -95,7 +99,7 @@ public class MaterialRecipes {
|
||||
}
|
||||
}
|
||||
|
||||
for (AlloyEndergy alloy : AlloyEndergy.values()) {
|
||||
for (AlloyEndergy alloy : AlloyEndergy.VALUES) {
|
||||
boolean isPrimaryName = true;
|
||||
for (String oreDictName : alloy.getOreIngots()) {
|
||||
OreDictionary.registerOre(oreDictName, alloy.getStackIngot());
|
||||
@@ -431,17 +435,19 @@ public class MaterialRecipes {
|
||||
RecipeUtil.addShaped(vibCry, "nnn", "ngn", "nnn", 'n', vibrantNugget, 'g', "gemEmerald");
|
||||
|
||||
// Smelting
|
||||
ItemStack dustIron = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_IRON.ordinal());
|
||||
ItemStack dustGold = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_GOLD.ordinal());
|
||||
ItemStack ingotIron = new ItemStack(Items.iron_ingot);
|
||||
ItemStack ingotGold = new ItemStack(Items.gold_ingot);
|
||||
if (!hasGT5) {
|
||||
ItemStack dustIron = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_IRON.ordinal());
|
||||
ItemStack dustGold = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_GOLD.ordinal());
|
||||
ItemStack ingotIron = new ItemStack(Items.iron_ingot);
|
||||
ItemStack ingotGold = new ItemStack(Items.gold_ingot);
|
||||
|
||||
GameRegistry.addSmelting(dustIron, ingotIron, 0);
|
||||
GameRegistry.addSmelting(dustGold, ingotGold, 0);
|
||||
GameRegistry.addSmelting(dustIron, ingotIron, 0);
|
||||
GameRegistry.addSmelting(dustGold, ingotGold, 0);
|
||||
|
||||
// Ender Dusts
|
||||
ItemStack enderDust = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_ENDER.ordinal());
|
||||
RecipeUtil.addShaped(new ItemStack(Items.ender_pearl), "eee", "eee", "eee", 'e', enderDust);
|
||||
// Ender Dusts
|
||||
ItemStack enderDust = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_ENDER.ordinal());
|
||||
RecipeUtil.addShaped(new ItemStack(Items.ender_pearl), "eee", "eee", "eee", 'e', enderDust);
|
||||
}
|
||||
|
||||
// Dark Iron Bars
|
||||
ItemStack diBars = new ItemStack(EnderIO.blockDarkIronBars, 16, 0);
|
||||
@@ -548,13 +554,13 @@ public class MaterialRecipes {
|
||||
'b',
|
||||
EnderIO.blockDarkIronBars);
|
||||
|
||||
for (Alloy alloy : Alloy.values()) {
|
||||
for (Alloy alloy : Alloy.VALUES) {
|
||||
RecipeUtil.addShaped(alloy.getStackBlock(), "iii", "iii", "iii", 'i', alloy.getOreIngot());
|
||||
RecipeUtil.addShaped(alloy.getStackBall(5), " i ", "iii", " i ", 'i', alloy.getOreIngot());
|
||||
RecipeUtil.addShapeless(alloy.getStackIngot(9), alloy.getOreBlock());
|
||||
}
|
||||
|
||||
for (AlloyEndergy alloy : AlloyEndergy.values()) {
|
||||
for (AlloyEndergy alloy : AlloyEndergy.VALUES) {
|
||||
RecipeUtil.addShaped(alloy.getStackBlock(), "iii", "iii", "iii", 'i', alloy.getOreIngot());
|
||||
RecipeUtil.addShaped(alloy.getStackBall(5), " i ", "iii", " i ", 'i', alloy.getOreIngot());
|
||||
RecipeUtil.addShapeless(alloy.getStackIngot(9), alloy.getOreBlock());
|
||||
@@ -564,24 +570,29 @@ public class MaterialRecipes {
|
||||
ItemStack darkRod = new ItemStack(EnderIO.itemMaterial, 1, Material.DARK_STEEL_ROD.ordinal());
|
||||
RecipeUtil.addShaped(darkRod, " ns", "nsn", "sn ", 's', darkSteel, 'n', endSteelNugget);
|
||||
|
||||
// Food
|
||||
ItemStack flour = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.FLOUR.ordinal());
|
||||
ItemStack bread = new ItemStack(Items.bread, 1, 0);
|
||||
if (!hasGT5) {
|
||||
// Food
|
||||
ItemStack flour = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.FLOUR.ordinal());
|
||||
ItemStack bread = new ItemStack(Items.bread, 1, 0);
|
||||
|
||||
GameRegistry.addSmelting(flour, bread, 0.35f);
|
||||
GameRegistry.addSmelting(flour, bread, 0.35f);
|
||||
}
|
||||
|
||||
ItemStack enderios = EnderFood.ENDERIOS.getStack();
|
||||
RecipeUtil.addShapeless(enderios, Items.bowl, Items.milk_bucket, "cropWheat", "dustEnderPearl");
|
||||
|
||||
if (OreDictionaryHelper.hasCopper()) {
|
||||
ItemStack dustCopper = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_COPPER.ordinal());
|
||||
ItemStack ingotCoppper = OreDictionaryPreferences.instance.getPreferred(OreDictionaryHelper.INGOT_COPPER);
|
||||
GameRegistry.addSmelting(dustCopper, ingotCoppper, 0);
|
||||
}
|
||||
if (OreDictionaryHelper.hasTin()) {
|
||||
ItemStack dustTin = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_TIN.ordinal());
|
||||
ItemStack ingotTin = OreDictionaryPreferences.instance.getPreferred(OreDictionaryHelper.INGOT_TIN);
|
||||
GameRegistry.addSmelting(dustTin, ingotTin, 0);
|
||||
if (!hasGT5) {
|
||||
if (OreDictionaryHelper.hasCopper()) {
|
||||
ItemStack dustCopper = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_COPPER.ordinal());
|
||||
ItemStack ingotCoppper = OreDictionaryPreferences.instance
|
||||
.getPreferred(OreDictionaryHelper.INGOT_COPPER);
|
||||
GameRegistry.addSmelting(dustCopper, ingotCoppper, 0);
|
||||
}
|
||||
if (OreDictionaryHelper.hasTin()) {
|
||||
ItemStack dustTin = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_TIN.ordinal());
|
||||
ItemStack ingotTin = OreDictionaryPreferences.instance.getPreferred(OreDictionaryHelper.INGOT_TIN);
|
||||
GameRegistry.addSmelting(dustTin, ingotTin, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,13 +19,17 @@ public enum AlloyEndergy {
|
||||
ENERGETIC_SILVER("energeticSilver", 7.0f),
|
||||
VIVID_ALLOY("vividAlloy", 4.0f);
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final AlloyEndergy[] VALUES = values();
|
||||
public final String unlocalisedName;
|
||||
public final String iconKey;
|
||||
private final List<String> oreIngots = new ArrayList<String>();
|
||||
private final List<String> oreBlocks = new ArrayList<String>();
|
||||
private final float hardness;
|
||||
|
||||
private AlloyEndergy(String baseName, float hardness, String oreDictName) {
|
||||
AlloyEndergy(String baseName, float hardness, String oreDictName) {
|
||||
this.unlocalisedName = "enderio." + baseName;
|
||||
this.iconKey = "enderio:" + baseName;
|
||||
if (oreDictName != null) {
|
||||
@@ -37,7 +41,7 @@ public enum AlloyEndergy {
|
||||
this.hardness = hardness;
|
||||
}
|
||||
|
||||
private AlloyEndergy(String baseName, float hardness) {
|
||||
AlloyEndergy(String baseName, float hardness) {
|
||||
this(baseName, hardness, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@ public class BlockIngotStorageEndergy extends BlockEio implements IAdvancedToolt
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
icons = new IIcon[AlloyEndergy.values().length];
|
||||
for (AlloyEndergy alloy : AlloyEndergy.values()) {
|
||||
icons = new IIcon[AlloyEndergy.VALUES.length];
|
||||
for (AlloyEndergy alloy : AlloyEndergy.VALUES) {
|
||||
icons[alloy.ordinal()] = register.registerIcon(alloy.iconKey + "Block");
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class BlockIngotStorageEndergy extends BlockEio implements IAdvancedToolt
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
meta = MathHelper.clamp_int(meta, 0, AlloyEndergy.values().length - 1);
|
||||
meta = MathHelper.clamp_int(meta, 0, AlloyEndergy.VALUES.length - 1);
|
||||
return icons[meta];
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class BlockIngotStorageEndergy extends BlockEio implements IAdvancedToolt
|
||||
|
||||
@Override
|
||||
public float getBlockHardness(World world, int x, int y, int z) {
|
||||
return AlloyEndergy.values()[world.getBlockMetadata(x, y, z)].getHardness();
|
||||
return AlloyEndergy.VALUES[world.getBlockMetadata(x, y, z)].getHardness();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,7 +21,7 @@ public class BlockItemIngotStorageEndergy extends ItemBlock {
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return "tile." + AlloyEndergy.values()[stack.getItemDamage()].unlocalisedName;
|
||||
return "tile." + AlloyEndergy.VALUES[stack.getItemDamage()].unlocalisedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -32,7 +32,7 @@ public class BlockItemIngotStorageEndergy extends ItemBlock {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||
for (AlloyEndergy alloy : AlloyEndergy.values()) {
|
||||
for (AlloyEndergy alloy : AlloyEndergy.VALUES) {
|
||||
list.add(new ItemStack(this, 1, alloy.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ItemAlloyEndergy extends Item {
|
||||
setCreativeTab(EnderIOTab.tabEnderIO);
|
||||
setUnlocalizedName(ModObject.itemAlloyEndergy.unlocalisedName);
|
||||
|
||||
numItems = AlloyEndergy.values().length;
|
||||
numItems = AlloyEndergy.VALUES.length;
|
||||
if (useNuggets) {
|
||||
numItems = numItems * 2;
|
||||
}
|
||||
@@ -55,13 +55,13 @@ public class ItemAlloyEndergy extends Item {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister IIconRegister) {
|
||||
int numAlloys = AlloyEndergy.values().length;
|
||||
int numAlloys = AlloyEndergy.VALUES.length;
|
||||
for (int i = 0; i < numAlloys; i++) {
|
||||
icons[i] = IIconRegister.registerIcon(AlloyEndergy.values()[i].iconKey);
|
||||
icons[i] = IIconRegister.registerIcon(AlloyEndergy.VALUES[i].iconKey);
|
||||
}
|
||||
if (useNuggets) {
|
||||
for (int i = 0; i < numAlloys; i++) {
|
||||
icons[i + numAlloys] = IIconRegister.registerIcon(AlloyEndergy.values()[i].iconKey + "Nugget");
|
||||
icons[i + numAlloys] = IIconRegister.registerIcon(AlloyEndergy.VALUES[i].iconKey + "Nugget");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,10 +69,10 @@ public class ItemAlloyEndergy extends Item {
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack par1ItemStack) {
|
||||
int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, numItems - 1);
|
||||
if (i < AlloyEndergy.values().length) {
|
||||
return AlloyEndergy.values()[i].unlocalisedName;
|
||||
if (i < AlloyEndergy.VALUES.length) {
|
||||
return AlloyEndergy.VALUES[i].unlocalisedName;
|
||||
} else {
|
||||
return AlloyEndergy.values()[i - AlloyEndergy.values().length].unlocalisedName + "Nugget";
|
||||
return AlloyEndergy.VALUES[i - AlloyEndergy.VALUES.length].unlocalisedName + "Nugget";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,14 +36,14 @@ public class ItemGrindingBallEndergy extends ItemAlloyEndergy {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister IIconRegister) {
|
||||
int numAlloys = AlloyEndergy.values().length;
|
||||
int numAlloys = AlloyEndergy.VALUES.length;
|
||||
for (int i = 0; i < numAlloys; i++)
|
||||
icons[i] = IIconRegister.registerIcon(AlloyEndergy.values()[i].iconKey + "GrindingBall");
|
||||
icons[i] = IIconRegister.registerIcon(AlloyEndergy.VALUES[i].iconKey + "GrindingBall");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack par1ItemStack) {
|
||||
int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, numItems - 1);
|
||||
return AlloyEndergy.values()[i].unlocalisedName + "GrindingBall";
|
||||
return AlloyEndergy.VALUES[i].unlocalisedName + "GrindingBall";
|
||||
}
|
||||
}
|
||||
@@ -26,12 +26,16 @@ public enum Capacitors {
|
||||
|
||||
ENDERGISED_CAPACITOR(new BasicCapacitor(3, 400, 500000, 100), "endergisedCapacitor", "Ender");
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final Capacitors[] VALUES = values();
|
||||
public final ICapacitor capacitor;
|
||||
public final String unlocalisedName;
|
||||
public final String iconKey;
|
||||
public final String oreDict;
|
||||
|
||||
private Capacitors(ICapacitor capacitor, String unlocalisedName, String oreDict) {
|
||||
Capacitors(ICapacitor capacitor, String unlocalisedName, String oreDict) {
|
||||
this.capacitor = capacitor;
|
||||
this.unlocalisedName = "enderio." + unlocalisedName;
|
||||
this.iconKey = "enderio:" + unlocalisedName;
|
||||
|
||||
@@ -15,6 +15,7 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
@@ -66,7 +67,9 @@ import crazypants.enderio.teleport.packet.PacketDrainStaff;
|
||||
import crazypants.enderio.teleport.packet.PacketLongDistanceTravelEvent;
|
||||
import crazypants.enderio.teleport.packet.PacketOpenAuthGui;
|
||||
import crazypants.enderio.teleport.packet.PacketTravelEvent;
|
||||
import crazypants.util.BackhandUtil;
|
||||
import crazypants.util.BaublesUtil;
|
||||
import xonin.backhand.api.core.BackhandUtils;
|
||||
|
||||
public class TravelController {
|
||||
|
||||
@@ -538,6 +541,21 @@ public class TravelController {
|
||||
return action < 2;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private TravelSource getTravelSource(final EntityPlayer ep, final ItemStack stack) {
|
||||
final Item item = stack.getItem();
|
||||
if (item instanceof ItemTeleportStaff) {
|
||||
if (((ItemTeleportStaff) item).isActive(ep, stack)) {
|
||||
return TravelSource.TELEPORT_STAFF;
|
||||
}
|
||||
} else if (item instanceof IItemOfTravel) {
|
||||
if (((IItemOfTravel) item).isActive(ep, stack)) {
|
||||
return TravelSource.STAFF;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Returns null if no travel item is in inventory/baubles. */
|
||||
@Nullable
|
||||
public TravelSource getTravelItemTravelSource(EntityPlayer ep, boolean checkInventoryAndBaubles) {
|
||||
@@ -545,6 +563,16 @@ public class TravelController {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (BackhandUtil.backhandLoaded) {
|
||||
final ItemStack offhand = BackhandUtils.getOffhandItem(ep);
|
||||
if (offhand != null && offhand.getItem() != null) {
|
||||
final TravelSource source = getTravelSource(ep, offhand);
|
||||
if (source != null) {
|
||||
return source;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack equipped = ep.getCurrentEquippedItem();
|
||||
if (checkInventoryAndBaubles) {
|
||||
if (equipped == null || !(equipped.getItem() instanceof IItemOfTravel)
|
||||
@@ -552,16 +580,9 @@ public class TravelController {
|
||||
equipped = findTravelItemInInventoryOrBaubles(ep);
|
||||
}
|
||||
}
|
||||
|
||||
if (equipped != null) {
|
||||
if (equipped.getItem() instanceof ItemTeleportStaff) {
|
||||
if (((ItemTeleportStaff) equipped.getItem()).isActive(ep, equipped)) {
|
||||
return TravelSource.TELEPORT_STAFF;
|
||||
}
|
||||
} else if (equipped.getItem() instanceof IItemOfTravel) {
|
||||
if (((IItemOfTravel) equipped.getItem()).isActive(ep, equipped)) {
|
||||
return TravelSource.STAFF;
|
||||
}
|
||||
}
|
||||
return getTravelSource(ep, equipped);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -634,6 +655,7 @@ public class TravelController {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return travelItemSlot;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import crazypants.enderio.material.FrankenSkull;
|
||||
import crazypants.enderio.material.Material;
|
||||
import crazypants.enderio.power.Capacitors;
|
||||
import thaumcraft.api.ThaumcraftApi;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
@@ -153,19 +152,6 @@ public class ThaumcraftCompat {
|
||||
ThaumcraftApi.registerObjectTag(
|
||||
new ItemStack(EnderIO.blockFusedQuartz, 1, BlockFusedQuartz.Type.ENLIGHTENED_GLASS.ordinal()),
|
||||
new AspectList().add(Aspect.CRYSTAL, 2).add(Aspect.LIGHT, 8).add(Aspect.SENSES, 2));
|
||||
|
||||
// This is a horrible hack due to the fact that I am assembling my aspects after TC does recipe parsing
|
||||
// Therefore I redo all EIO items
|
||||
for (Object o : Item.itemRegistry.getKeys()) {
|
||||
if (o instanceof String) {
|
||||
String ownermod = ((String) o).substring(0, ((String) o).indexOf(':'));
|
||||
if (EnderIO.MODID.equals(ownermod)) {
|
||||
for (int idx = 0; idx < 16; idx++) {
|
||||
addAspectsFromRecipes((Item) Item.itemRegistry.getObject((String) o), idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static AspectList getAspects(Block block) {
|
||||
@@ -185,10 +171,6 @@ public class ThaumcraftCompat {
|
||||
return new AspectList(item);
|
||||
}
|
||||
|
||||
private static void addAspectsFromRecipes(Item item, int meta) {
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(item, 1, meta), ThaumcraftApiHelper.generateTags(item, meta));
|
||||
}
|
||||
|
||||
public static void loadUpgrades(List<IDarkSteelUpgrade> upgrades) {
|
||||
upgrades.add(GogglesOfRevealingUpgrade.INSTANCE);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class SmartTank extends FluidTank {
|
||||
if (fl == null || fluid == null) {
|
||||
return false;
|
||||
}
|
||||
return fl.getID() == fluid.getFluidID();
|
||||
return fl == fluid.getFluid();
|
||||
}
|
||||
|
||||
public FluidStack drain(FluidStack resource, boolean doDrain) {
|
||||
@@ -67,7 +67,7 @@ public class SmartTank extends FluidTank {
|
||||
if (fluid != null) {
|
||||
return fluid.isFluidEqual(resource);
|
||||
} else if (restriction != null) {
|
||||
return resource.getFluid() != null && restriction.getID() == resource.getFluid().getID();
|
||||
return resource.getFluid() != null && restriction == resource.getFluid();
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@@ -75,9 +75,9 @@ public class SmartTank extends FluidTank {
|
||||
|
||||
public boolean canFill(Fluid fl) {
|
||||
if (fluid != null) {
|
||||
return fluid.getFluid().getID() == fl.getID();
|
||||
return fluid.getFluid() == fl;
|
||||
} else if (restriction != null) {
|
||||
return restriction.getID() == fl.getID();
|
||||
return restriction == fl;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ public class WailaCompat implements IWailaDataProvider {
|
||||
PowerDisplayUtil.abrevation()));
|
||||
}
|
||||
|
||||
} else if (itemStack.getItem() == EnderIO.itemLiquidConduit) {
|
||||
} else if (itemStack.getItem() == EnderIO.itemLiquidConduit && !EnderIO.hasWailaPlugins) {
|
||||
NBTTagCompound nbtRoot = accessor.getNBTData();
|
||||
if (nbtRoot.hasKey("fluidLocked") && nbtRoot.hasKey("FluidName")) {
|
||||
boolean fluidTypeLocked = nbtRoot.getBoolean("fluidLocked");
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package crazypants.util;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
public class BackhandUtil {
|
||||
|
||||
public final static boolean backhandLoaded = Loader.isModLoaded("backhand");
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package crazypants.util;
|
||||
|
||||
import static crazypants.enderio.EnderIO.hasGT5;
|
||||
import static crazypants.enderio.material.Material.BINDER_COMPOSITE;
|
||||
import static crazypants.enderio.material.Material.CONDUIT_BINDER;
|
||||
import static crazypants.enderio.material.Material.PHASED_IRON_NUGGET;
|
||||
@@ -9,6 +10,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -20,6 +22,7 @@ import com.pahimar.ee3.api.exchange.EnergyValueRegistryProxy;
|
||||
import com.pahimar.ee3.api.exchange.RecipeRegistryProxy;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.item.ItemEnderFood.EnderFood;
|
||||
@@ -93,47 +96,59 @@ public class EE3Util {
|
||||
*/
|
||||
public static void registerMiscRecipes() {
|
||||
if (IS_EE3_LOADED) {
|
||||
ItemStack basicGear = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.BASIC_GEAR.ordinal());
|
||||
ItemStack stick4 = new ItemStack(Items.stick, 4);
|
||||
ItemStack cobble4 = new ItemStack(Blocks.cobblestone, 4);
|
||||
registerRecipe(basicGear, stick4, cobble4);
|
||||
|
||||
ItemStack flour10 = new ItemStack(EnderIO.itemPowderIngot, 10, PowderIngot.FLOUR.ordinal());
|
||||
ItemStack wheat5 = new ItemStack(Items.wheat, 5);
|
||||
ItemStack seeds1 = new ItemStack(Items.wheat_seeds, 1);
|
||||
registerRecipe(flour10, wheat5, seeds1);
|
||||
if (!hasGT5) {
|
||||
ItemStack basicGear = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.BASIC_GEAR.ordinal());
|
||||
ItemStack stick4 = new ItemStack(Items.stick, 4);
|
||||
ItemStack cobble4 = new ItemStack(Blocks.cobblestone, 4);
|
||||
registerRecipe(basicGear, stick4, cobble4);
|
||||
ItemStack flour10 = new ItemStack(EnderIO.itemPowderIngot, 10, PowderIngot.FLOUR.ordinal());
|
||||
ItemStack wheat5 = new ItemStack(Items.wheat, 5);
|
||||
ItemStack seeds1 = new ItemStack(Items.wheat_seeds, 1);
|
||||
registerRecipe(flour10, wheat5, seeds1);
|
||||
}
|
||||
|
||||
ItemStack enderios = EnderFood.ENDERIOS.getStack();
|
||||
ItemStack bowl = new ItemStack(Items.bowl, 1);
|
||||
ItemStack wheat = new ItemStack(Items.wheat, 1);
|
||||
ItemStack milkb = new ItemStack(Items.milk_bucket, 1);
|
||||
FluidStack milk = FluidContainerRegistry.getFluidForFilledItem(milkb);
|
||||
ItemStack dustEnderPearl = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_ENDER.ordinal());
|
||||
ItemStack dustEnderPearl;
|
||||
if (hasGT5) {
|
||||
dustEnderPearl = GameRegistry.findItemStack("gregtech", "gt.metaitem.01", 1);
|
||||
Items.feather.setDamage(Objects.requireNonNull(dustEnderPearl), 2532);
|
||||
} else {
|
||||
dustEnderPearl = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_ENDER.ordinal());
|
||||
}
|
||||
if (milk != null) {
|
||||
registerRecipe(enderios, bowl, milk, wheat, dustEnderPearl);
|
||||
} else {
|
||||
registerRecipe(enderios, bowl, milkb, wheat, dustEnderPearl);
|
||||
}
|
||||
|
||||
ItemStack dustCoal = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_COAL.ordinal());
|
||||
ItemStack coal = new ItemStack(Items.coal, 1);
|
||||
registerRecipe(dustCoal, coal);
|
||||
if (!hasGT5) {
|
||||
ItemStack dustCoal = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_COAL.ordinal());
|
||||
ItemStack coal = new ItemStack(Items.coal, 1);
|
||||
registerRecipe(dustCoal, coal);
|
||||
|
||||
ItemStack dustIron = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_IRON.ordinal());
|
||||
ItemStack iron = new ItemStack(Items.iron_ingot, 1);
|
||||
registerRecipe(dustIron, iron);
|
||||
ItemStack dustIron = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_IRON.ordinal());
|
||||
ItemStack iron = new ItemStack(Items.iron_ingot, 1);
|
||||
registerRecipe(dustIron, iron);
|
||||
|
||||
ItemStack dustGold = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_GOLD.ordinal());
|
||||
ItemStack gold = new ItemStack(Items.gold_ingot, 1);
|
||||
registerRecipe(dustGold, gold);
|
||||
ItemStack dustGold = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_GOLD.ordinal());
|
||||
ItemStack gold = new ItemStack(Items.gold_ingot, 1);
|
||||
registerRecipe(dustGold, gold);
|
||||
|
||||
ItemStack dustObsidian4 = new ItemStack(EnderIO.itemPowderIngot, 4, PowderIngot.POWDER_OBSIDIAN.ordinal());
|
||||
ItemStack obsidian = new ItemStack(Blocks.obsidian, 1);
|
||||
registerRecipe(dustObsidian4, obsidian);
|
||||
ItemStack dustObsidian4 = new ItemStack(
|
||||
EnderIO.itemPowderIngot,
|
||||
4,
|
||||
PowderIngot.POWDER_OBSIDIAN.ordinal());
|
||||
ItemStack obsidian = new ItemStack(Blocks.obsidian, 1);
|
||||
registerRecipe(dustObsidian4, obsidian);
|
||||
|
||||
ItemStack enderDust9 = new ItemStack(EnderIO.itemPowderIngot, 9, PowderIngot.POWDER_ENDER.ordinal());
|
||||
ItemStack enderPearl = new ItemStack(Items.ender_pearl);
|
||||
registerRecipe(enderDust9, enderPearl);
|
||||
ItemStack enderDust9 = new ItemStack(EnderIO.itemPowderIngot, 9, PowderIngot.POWDER_ENDER.ordinal());
|
||||
ItemStack enderPearl = new ItemStack(Items.ender_pearl);
|
||||
registerRecipe(enderDust9, enderPearl);
|
||||
}
|
||||
|
||||
ItemStack cbc8 = BINDER_COMPOSITE.getStack(8);
|
||||
ItemStack sand2 = new ItemStack(Blocks.sand, 2);
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package crazypants.util;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class ForgeDirections {
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final ForgeDirection[] DIRECTIONS = ForgeDirection.values();
|
||||
}
|
||||
@@ -373,9 +373,14 @@ enderio.endergeticCapacitor.name=Endergetic Capacitor
|
||||
enderio.endergisedCapacitor.name=Endergised Capacitor
|
||||
enderio.totemicCapacitor.name=Totemic Capacitor
|
||||
|
||||
enderio.machine.tooltip.upgrade=Machine Upgrade
|
||||
enderio.machine.tooltip.upgrade.tooltip.detailed.line1=Increases energy storage and
|
||||
enderio.machine.tooltip.upgrade.tooltip.detailed.line2=speed / range of machines
|
||||
enderio.machine.tooltip.upgrade.name=Machine Upgrade
|
||||
enderio.machine.tooltip.upgrade=Upgrades:
|
||||
enderio.machine.tooltip.upgrade.tier=Tier:
|
||||
enderio.machine.tooltip.upgrade.energyreceived=Max Energy Received:
|
||||
enderio.machine.tooltip.upgrade.energyextracted=Max Energy Extracted:
|
||||
enderio.machine.tooltip.upgrade.farmstation=Farming station radius:
|
||||
enderio.machine.tooltip.upgrade.energystorage=Max energy storage:
|
||||
enderio.machine.tooltip.upgrade.range=Range upgrade:
|
||||
enderio.machine.tooltip.clearConfig=This will clear all stored info!
|
||||
|
||||
#Machines
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.0 KiB |
Loaded 100 of 844 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user